Skip to content

Commit

Permalink
fix locales
Browse files Browse the repository at this point in the history
  • Loading branch information
microstudi committed Nov 14, 2023
1 parent d5ec810 commit 8e3ce4a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ def up
models = ActiveRecord::Base.descendants.select { |c| c.included_modules.include?(Decidim::HasReference) }

models.each do |model|
next unless model.table_exists?

model.find_each(&:touch)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,25 @@
# This migration comes from decidim (originally 20180810092428)

class MoveOrganizationFieldsToHeroContentBlock < ActiveRecord::Migration[5.2]
class ::Decidim::Organization < ApplicationRecord
# This migration made use CarrierWave, which in future will be eliminated.
# The organization homepage image was moved to the content block background
# image using CarrierWave. This operation has been removed, so if there is
# an existing homepage image previous to this migration the content block
# background image should be loaded manually
class Organization < ApplicationRecord
self.table_name = :decidim_organizations

mount_uploader :homepage_image, ::Decidim::HomepageImageUploader
end

def change
Decidim::ContentBlock.reset_column_information
Decidim::Organization.find_each do |organization|
Organization.find_each do |organization|
content_block = Decidim::ContentBlock.find_by(organization: organization, scope: :homepage, manifest_name: :hero)
settings = {}
welcome_text = organization.welcome_text || {}
settings = welcome_text.inject(settings) { |acc, (k, v)| acc.update("welcome_text_#{k}" => v) }

content_block.settings = settings
content_block.images_container.background_image = organization.homepage_image.file
content_block.settings_will_change!
content_block.images_will_change!
content_block.save!
end

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
# frozen_string_literal: true

# This migration comes from decidim_forms (originally 20170515144119)

class CreateDecidimFormsAnswers < ActiveRecord::Migration[5.0]
def change
create_table :decidim_forms_answers do |t|
t.jsonb :body, default: []
t.text :body
t.references :decidim_user, index: true
t.references :decidim_questionnaire, index: true
t.references :decidim_question, index: { name: "index_decidim_forms_answers_question_id" }
t.text :body

t.timestamps
end
Expand Down
4 changes: 2 additions & 2 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
Kernel.srand config.seed

config.before do
I18n.available_locales = [:en, :ca, :es]
I18n.available_locales = [:en, :es, :eu]
I18n.default_locale = :en
Decidim.available_locales = [:en, :ca, :es]
Decidim.available_locales = [:en, :es, :eu]
Decidim.default_locale = :en
end

Expand Down

0 comments on commit 8e3ce4a

Please sign in to comment.