Commit cc885d9e by Mykhailo Makohin

finish ot translate projects nested attributes

parent 16b98901
...@@ -127,8 +127,8 @@ ActiveAdmin.register Project do ...@@ -127,8 +127,8 @@ ActiveAdmin.register Project do
project_documents_form.input :_destroy, as: :boolean, label: "#{t "active_admin.attributes.project._destroy"}" project_documents_form.input :_destroy, as: :boolean, label: "#{t "active_admin.attributes.project._destroy"}"
end end
f.has_many :project_videos, heading: false, new_record: true do |project_videos_form| f.has_many :project_videos, heading: false, new_record: true do |project_videos_form|
project_videos_form.input :short_description_uk, as: :ckeditor, input_html: { ckeditor: { height: 400 } }, label: "#{t "active_admin.attributes.project_videos.short_description_uk"}" project_videos_form.input :short_uk, as: :ckeditor, input_html: { ckeditor: { height: 400 } }, label: "#{t "active_admin.attributes.project_videos.short_description_uk"}"
project_videos_form.input :short_description_en, as: :ckeditor, input_html: { ckeditor: { height: 400 } }, label: "#{t "active_admin.attributes.project_videos.short_description_en"}" project_videos_form.input :short_en, as: :ckeditor, input_html: { ckeditor: { height: 400 } }, label: "#{t "active_admin.attributes.project_videos.short_description_en"}"
project_videos_form.input :video_file, label: "#{t "active_admin.attributes.project_videos.video_file"}" project_videos_form.input :video_file, label: "#{t "active_admin.attributes.project_videos.video_file"}"
project_videos_form.input :video_link, label: "#{t "active_admin.attributes.project_videos.video_link"}" project_videos_form.input :video_link, label: "#{t "active_admin.attributes.project_videos.video_link"}"
project_videos_form.input :description_uk, as: :ckeditor, input_html: { ckeditor: { height: 400 } }, label: "#{t "active_admin.attributes.project_videos.description_uk"}" project_videos_form.input :description_uk, as: :ckeditor, input_html: { ckeditor: { height: 400 } }, label: "#{t "active_admin.attributes.project_videos.description_uk"}"
......
class ProjectDocument < ApplicationRecord class ProjectDocument < ApplicationRecord
mount_uploader :document_uk, DocumentUploader mount_uploader :document_uk, DocumentUploader
mount_uploader :document_en, DocumentUploader mount_uploader :document_en, DocumentUploader
translates :document_name
globalize_accessors :locales => [:en, :uk], :attributes => [:document_name]
belongs_to :project belongs_to :project
end end
class ProjectLink < ApplicationRecord class ProjectLink < ApplicationRecord
belongs_to :project belongs_to :project
translates :title
globalize_accessors :locales => [:en, :uk], :attributes => [:title]
end end
class ProjectPhoto < ApplicationRecord class ProjectPhoto < ApplicationRecord
mount_uploader :photo, AvatarUploader mount_uploader :photo, AvatarUploader
translates :name translates :title
globalize_accessors :locales => [:en, :uk], :attributes => [:name] globalize_accessors :locales => [:en, :uk], :attributes => [:title]
belongs_to :project belongs_to :project
end end
class ProjectVideo < ApplicationRecord class ProjectVideo < ApplicationRecord
mount_uploader :video_file, VideoUploader mount_uploader :video_file, VideoUploader
translates :title, :short, :description
globalize_accessors :locales => [:en, :uk], :attributes => [:title, :short, :description]
belongs_to :project belongs_to :project
end end
...@@ -68,129 +68,7 @@ ...@@ -68,129 +68,7 @@
= link_to image_tag('grid_item_first.png'), "#", class: 'grid_item_content' = link_to image_tag('grid_item_first.png'), "#", class: 'grid_item_content'
/ %a.grid_item_content{:href => "#", :style => "background-image: url(grid_item_first.png)"} / %a.grid_item_content{:href => "#", :style => "background-image: url(grid_item_first.png)"}
.grid_item .grid_item
= link_to image_tag(project.photo.url(:thumb)), "#", class: 'grid_item_content tooltipstered' = link_to image_tag(project.photo.url(:thumb)), project_path(project), class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
.grid_item
= link_to image_tag(@video.thumbnail_medium), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
%a.grid_item_content.tooltipstered{"data-tooltip-content" => "#tooltip_content_inner", :href => "#"}
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
= link_to image_tag('grid/grid_item2.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
= link_to image_tag('grid/grid_item3.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
= link_to image_tag('grid/grid_item4.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
= link_to image_tag('grid/grid_item5.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
.grid_item
= link_to image_tag('grid/grid_item1.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
= link_to image_tag('grid/grid_item6.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
= link_to image_tag('grid/grid_item5.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
= link_to image_tag('grid/grid_item2.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
= link_to image_tag('grid/grid_item7.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
= link_to image_tag('grid/grid_item2.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
= link_to image_tag('grid/grid_item8.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
= link_to image_tag('grid/grid_item9.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
= link_to image_tag('grid/grid_item6.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
= link_to image_tag('grid/grid_item2.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
= link_to image_tag('grid/grid_item10.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
= link_to image_tag('grid/grid_item5.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
= link_to image_tag('grid/grid_item11.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
= link_to image_tag('grid/grid_item2.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
= link_to image_tag('grid/grid_item12.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
.grid_item
= link_to image_tag('grid/grid_item2.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
.grid_item
= link_to image_tag('grid/grid_item12.png'), "#", class: 'grid_item_content tooltipstered'
.grid_item
.grid_item
.grid_item
.grid_item.last .grid_item.last
%span.grid_item_content.tooltipstered %span.grid_item_content.tooltipstered
%a.get_involved_link.centered{"data-original-title" => "приєднатись", "data-placement" => "top", "data-toggle" => "tooltip", :href => "#"} %a.get_involved_link.centered{"data-original-title" => "приєднатись", "data-placement" => "top", "data-toggle" => "tooltip", :href => "#"}
......
class TranslateProjectGaleries < ActiveRecord::Migration[5.0]
def change
reversible do |dir| # <=== 1
dir.up do
ProjectGalery.create_translation_table!({ # <=== 2
name: :string
}, {
migrate_data: true, # <=== 4
remove_source_columns: true # <=== 5
})
end
dir.down do
ProjectGalery.drop_translation_table! migrate_data: true # <=== 6
end
end
end
end
\ No newline at end of file
class TranslateProjectQoutes < ActiveRecord::Migration[5.0]
def change
reversible do |dir| # <=== 1
dir.up do
ProjectQoute.create_translation_table!({ # <=== 2
text_over_quote: :text,
text_quote: :text,
text_below_quote: :text
}, {
migrate_data: true, # <=== 4
remove_source_columns: true # <=== 5
})
end
dir.down do
ProjectQoute.drop_translation_table! migrate_data: true # <=== 6
end
end
end
end
class TranslateProjectPhotos < ActiveRecord::Migration[5.0]
def change
reversible do |dir| # <=== 1
dir.up do
ProjectPhoto.create_translation_table!({ # <=== 2
title: :string
}, {
migrate_data: true, # <=== 4
remove_source_columns: true # <=== 5
})
end
dir.down do
ProjectPhoto.drop_translation_table! migrate_data: true # <=== 6
end
end
end
end
class TranslateProjectLinks < ActiveRecord::Migration[5.0]
def change
reversible do |dir| # <=== 1
dir.up do
ProjectLink.create_translation_table!({ # <=== 2
title: :string
}, {
migrate_data: true, # <=== 4
remove_source_columns: true # <=== 5
})
end
dir.down do
ProjectLink.drop_translation_table! migrate_data: true # <=== 6
end
end
end
end
class TranslateProjectDocuments < ActiveRecord::Migration[5.0]
def change
reversible do |dir| # <=== 1
dir.up do
ProjectDocument.create_translation_table!({ # <=== 2
document_name: :string
}, {
migrate_data: true, # <=== 4
remove_source_columns: true # <=== 5
})
end
dir.down do
ProjectDocument.drop_translation_table! migrate_data: true # <=== 6
end
end
end
end
class TranslateProjectVideos < ActiveRecord::Migration[5.0]
def change
reversible do |dir| # <=== 1
dir.up do
ProjectVideo.create_translation_table!({ # <=== 2
title: :string,
short: :string,
description: :string
}, {
migrate_data: true, # <=== 4
remove_source_columns: true # <=== 5
})
end
dir.down do
ProjectVideo.drop_translation_table! migrate_data: true # <=== 6
end
end
end
end
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20191003131124) do ActiveRecord::Schema.define(version: 20191008073420) do
create_table "active_admin_comments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "active_admin_comments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "namespace" t.string "namespace"
...@@ -49,59 +49,97 @@ ActiveRecord::Schema.define(version: 20191003131124) do ...@@ -49,59 +49,97 @@ ActiveRecord::Schema.define(version: 20191003131124) do
t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id", using: :btree t.index ["sluggable_type", "sluggable_id"], name: "index_friendly_id_slugs_on_sluggable_type_and_sluggable_id", using: :btree
end end
create_table "project_document_translations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "project_document_id", null: false
t.string "locale", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "document_name"
t.index ["locale"], name: "index_project_document_translations_on_locale", using: :btree
t.index ["project_document_id"], name: "index_project_document_translations_on_project_document_id", using: :btree
end
create_table "project_documents", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "project_documents", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "document_uk" t.string "document_uk"
t.string "document_en" t.string "document_en"
t.string "document_name_uk"
t.string "document_name_en"
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["project_id"], name: "index_project_documents_on_project_id", using: :btree t.index ["project_id"], name: "index_project_documents_on_project_id", using: :btree
end end
create_table "project_galeries", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "project_galeries", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "photo" t.string "photo"
t.string "name_uk"
t.string "name_en"
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["project_id"], name: "index_project_galeries_on_project_id", using: :btree t.index ["project_id"], name: "index_project_galeries_on_project_id", using: :btree
end end
create_table "project_galery_translations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "project_galery_id", null: false
t.string "locale", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "name"
t.index ["locale"], name: "index_project_galery_translations_on_locale", using: :btree
t.index ["project_galery_id"], name: "index_project_galery_translations_on_project_galery_id", using: :btree
end
create_table "project_link_translations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "project_link_id", null: false
t.string "locale", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "title"
t.index ["locale"], name: "index_project_link_translations_on_locale", using: :btree
t.index ["project_link_id"], name: "index_project_link_translations_on_project_link_id", using: :btree
end
create_table "project_links", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "project_links", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "site" t.string "site"
t.string "title_uk"
t.string "title_en"
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["project_id"], name: "index_project_links_on_project_id", using: :btree t.index ["project_id"], name: "index_project_links_on_project_id", using: :btree
end end
create_table "project_photo_translations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "project_photo_id", null: false
t.string "locale", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "title"
t.index ["locale"], name: "index_project_photo_translations_on_locale", using: :btree
t.index ["project_photo_id"], name: "index_project_photo_translations_on_project_photo_id", using: :btree
end
create_table "project_photos", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "project_photos", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "photo" t.string "photo"
t.string "title_uk"
t.string "title_en"
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["project_id"], name: "index_project_photos_on_project_id", using: :btree t.index ["project_id"], name: "index_project_photos_on_project_id", using: :btree
end end
create_table "project_qoute_translations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "project_qoute_id", null: false
t.string "locale", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.text "text_over_quote", limit: 65535
t.text "text_quote", limit: 65535
t.text "text_below_quote", limit: 65535
t.index ["locale"], name: "index_project_qoute_translations_on_locale", using: :btree
t.index ["project_qoute_id"], name: "index_project_qoute_translations_on_project_qoute_id", using: :btree
end
create_table "project_qoutes", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "project_qoutes", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.text "text_over_quote_uk", limit: 65535
t.text "text_over_quote_en", limit: 65535
t.string "background_color_quote_text" t.string "background_color_quote_text"
t.string "icon" t.string "icon"
t.text "text_quote_uk", limit: 65535
t.text "text_quote", limit: 65535
t.text "text_below_quote_uk", limit: 65535
t.text "text_below_quote", limit: 65535
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["project_id"], name: "index_project_qoutes_on_project_id", using: :btree t.index ["project_id"], name: "index_project_qoutes_on_project_id", using: :btree
end end
...@@ -120,18 +158,24 @@ ActiveRecord::Schema.define(version: 20191003131124) do ...@@ -120,18 +158,24 @@ ActiveRecord::Schema.define(version: 20191003131124) do
t.index ["project_id"], name: "index_project_translations_on_project_id", using: :btree t.index ["project_id"], name: "index_project_translations_on_project_id", using: :btree
end end
create_table "project_video_translations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "project_video_id", null: false
t.string "locale", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "title"
t.string "short"
t.string "description"
t.index ["locale"], name: "index_project_video_translations_on_locale", using: :btree
t.index ["project_video_id"], name: "index_project_video_translations_on_project_video_id", using: :btree
end
create_table "project_videos", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "project_videos", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "title_uk"
t.string "title_en"
t.string "short_description_uk"
t.string "short_description_en"
t.string "video_file" t.string "video_file"
t.string "video_link" t.string "video_link"
t.string "description_uk"
t.string "description_en"
t.integer "project_id" t.integer "project_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["project_id"], name: "index_project_videos_on_project_id", using: :btree t.index ["project_id"], name: "index_project_videos_on_project_id", using: :btree
end end
...@@ -149,7 +193,6 @@ ActiveRecord::Schema.define(version: 20191003131124) do ...@@ -149,7 +193,6 @@ ActiveRecord::Schema.define(version: 20191003131124) do
t.string "footer_photo" t.string "footer_photo"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.string "title_uk"
end end
create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment