Commit 78d5d7b5 by Mykhailo Makohin

add tranlations for project model fields

parent 9a1fec27
......@@ -30,6 +30,7 @@ gem 'cancancan'
gem 'cocoon'
gem 'friendly_id'
gem 'globalize'
gem 'globalize-accessors'
group :development, :test do
gem 'byebug', platform: :mri
......
......@@ -109,6 +109,8 @@ GEM
activemodel (>= 4.2, < 5.3)
activerecord (>= 4.2, < 5.3)
request_store (~> 1.0)
globalize-accessors (0.2.1)
globalize (~> 5.0, >= 5.0.0)
gmaps4rails (2.1.2)
haml (5.1.2)
temple (>= 0.8.0)
......@@ -305,6 +307,7 @@ DEPENDENCIES
devise
friendly_id
globalize
globalize-accessors
gmaps4rails
haml
jbuilder (~> 2.5)
......
class Project < ApplicationRecord
translates :title, :individual_type, :heading, :related_links,
:short_description, :description
globalize_accessors :locales => [:en, :uk], :attributes => [:individual_type, :title,
:heading, :short_description, :description, :related_links]
extend FriendlyId
friendly_id :title_uk, :use => :slugged
......
......@@ -6,7 +6,7 @@
%span.info_title_text= t "#{@project.types}"
%a.info_link{"data-target" => "#modal3", "data-toggle" => "modal", :href => "#"} #{@project.site}
%h2.heading_with_btn
%span Urban Space Radio
%span #{@project.title}
%a.btn.btn_default{"data-target" => "#modal", "data-toggle" => "modal", :href => "#"}
%i.icon.icon_plus>
= t ('donate')
......@@ -41,30 +41,12 @@
.project_content
.container
.text_container
%h3 Реалізовано нами
%p
Urban Space Radio має підвищити рівень залученості громадськості до процесів розвитку наших міст. Це досягатиметься через створення незалежного і на 100% прозорого медіа-каналу. Прозорість і публічність радіостанції буде інституційною та фізичною, адже її скляна студія буде розташована у публічному просторі – громадському ресторані
= succeed "." do
%strong Urban Space 100 у центрі міста
#slider.beer-slider{"data-beer-label" => "before"}
= image_tag(@project.photo.url)
.beer-reveal{"data-beer-label" => "after"}
= image_tag(@project.photo_preview.url)
%p
Радіо мовитиме в інтернеті, в «Urban Space 100», а також частково в
%a{:href => "#"} FM-діапазоні
у партнерстві з відомою міською станцією. Записи ефірів можна буде безкоштовно прослухати на популярному подкаст-сервісі. В ефірі – сучасна та якісна українська мука,
%strong власні інформаційні
%p.no_margin
Завдяки фінансуванню від Urban Space 100 у 2015 р. було підтримано наступні проекти:
%ul.simple_list
%li якісне дослідження унікальних та типових рис Івано-Франківська;
%li активне включення громади у процес розробки концепції розвитку міста;
%li організація конструктивної комунікації між ключовими локальними стейкхолдерами та точок росту
%li якісне дослідження унікальних та типових;
%li розвитку міста;
%li якісне дослідження унікальних та типових рис Івано-Франківська;
%li активне включення громади у процес розробки концепції розвитку міста;
#{@project.short_description}
#slider.beer-slider{"data-beer-label" => "before"}
= image_tag(@project.photo_after.url)
.beer-reveal{"data-beer-label" => "after"}
= image_tag(@project.photo_before.url)
#{@project.description}
.imgs_wrap
.simple_slider.clearfix
#gallery-2.royalSlider.rsUni
......
......@@ -8,14 +8,14 @@ default: &default
development:
<<: *default
database: appname_development
database: warmcity_development
test:
<<: *default
database: appname_test
database: warmcity_test
production:
<<: *default
database: appname_production
username: appname
password: <%= ENV['APPNAME_DATABASE_PASSWORD'] %>
database: warmcity_production
username: warmcity
password: <%= ENV['WARMCITY_DATABASE_PASSWORD'] %>
......@@ -7,22 +7,16 @@ class CreateProjects < ActiveRecord::Migration[5.0]
t.string :photo_after
t.integer :types
t.integer :status
t.string :individual_type_uk
t.string :individual_type_en
t.string :title_uk
t.string :title_en
t.string :heading_uk
t.string :heading_en
t.string :individual_type
t.string :title
t.string :heading
t.string :slug
t.text :short_description_uk
t.text :short_description_en
t.text :description_uk
t.text :description_en
t.text :short_description
t.text :description
t.string :site
t.string :link_to_facebook
t.float :required_amount
t.string :related_links_uk
t.string :related_links_en
t.string :related_links
t.string :footer_photo
t.timestamps
end
......
class TranlasteProjects < ActiveRecord::Migration[5.0]
def change
reversible do |dir| # <=== 1
dir.up do
Project.create_translation_table!({ # <=== 2
title: :string,
individual_type: :string,
heading: :string,
short_description: :text,
description: :text,
related_links: :string
}, {
migrate_data: true, # <=== 4
remove_source_columns: true # <=== 5
})
end
dir.down do
Project.drop_translation_table! migrate_data: true # <=== 6
end
end
end
end
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20190930175107) do
ActiveRecord::Schema.define(version: 20191003075441) do
create_table "active_admin_comments", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "namespace"
......@@ -93,6 +93,21 @@ ActiveRecord::Schema.define(version: 20190930175107) do
t.index ["project_id"], name: "index_project_qoutes_on_project_id", using: :btree
end
create_table "project_translations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.integer "project_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 "individual_type"
t.string "heading"
t.text "short_description", limit: 65535
t.text "description", limit: 65535
t.string "related_links"
t.index ["locale"], name: "index_project_translations_on_locale", using: :btree
t.index ["project_id"], name: "index_project_translations_on_project_id", using: :btree
end
create_table "project_videos", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
t.string "title_uk"
t.string "title_en"
......@@ -115,25 +130,14 @@ ActiveRecord::Schema.define(version: 20190930175107) do
t.string "photo_after"
t.integer "types"
t.integer "status"
t.string "individual_type_uk"
t.string "individual_type_en"
t.string "title_uk"
t.string "title_en"
t.string "heading_uk"
t.string "heading_en"
t.string "slug"
t.text "short_description_uk", limit: 65535
t.text "short_description_en", limit: 65535
t.text "description_uk", limit: 65535
t.text "description_en", limit: 65535
t.string "site"
t.string "link_to_facebook"
t.float "required_amount", limit: 24
t.string "related_links_uk"
t.string "related_links_en"
t.float "required_amount", limit: 24
t.string "footer_photo"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "title_uk"
end
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