diff --git a/back/app/models/custom_field.rb b/back/app/models/custom_field.rb index d4b93d791a30..88871c0fbe14 100644 --- a/back/app/models/custom_field.rb +++ b/back/app/models/custom_field.rb @@ -27,6 +27,7 @@ # maximum_select_count :integer # minimum_select_count :integer # random_option_ordering :boolean default(FALSE), not null +# page_layout :string # # Indexes # @@ -59,6 +60,7 @@ class CustomField < ApplicationRecord ].freeze VISIBLE_TO_PUBLIC = 'public' VISIBLE_TO_ADMINS = 'admins' + PAGE_LAYOUTS = %w[default map].freeze validates :resource_type, presence: true, inclusion: { in: FIELDABLE_TYPES } validates( @@ -78,6 +80,8 @@ class CustomField < ApplicationRecord validates :answer_visible_to, presence: true, inclusion: { in: [VISIBLE_TO_PUBLIC, VISIBLE_TO_ADMINS] } validates :maximum_select_count, comparison: { greater_than_or_equal_to: 0 }, if: :multiselect?, allow_nil: true validates :minimum_select_count, comparison: { greater_than_or_equal_to: 0 }, if: :multiselect?, allow_nil: true + validates :page_layout, presence: true, inclusion: { in: PAGE_LAYOUTS }, if: :page? + validates :page_layout, absence: true, unless: :page? before_validation :set_default_enabled before_validation :set_default_answer_visible_to diff --git a/back/app/serializers/web_api/v1/custom_field_serializer.rb b/back/app/serializers/web_api/v1/custom_field_serializer.rb index 7efa0eaec6ee..586cac5ad24f 100644 --- a/back/app/serializers/web_api/v1/custom_field_serializer.rb +++ b/back/app/serializers/web_api/v1/custom_field_serializer.rb @@ -16,6 +16,10 @@ class WebApi::V1::CustomFieldSerializer < WebApi::V1::BaseSerializer object.resource_type == 'User' } + attribute :page_layout, if: proc { |object, _params| + object.input_type == 'page' + } + attribute :constraints do |object, params| if params[:constraints] params[:constraints][object.code&.to_sym] || {} diff --git a/back/app/services/custom_field_service.rb b/back/app/services/custom_field_service.rb index d340edb82a23..611d1e781870 100644 --- a/back/app/services/custom_field_service.rb +++ b/back/app/services/custom_field_service.rb @@ -35,7 +35,7 @@ def fields_to_json_schema(fields, locale = 'en') elsif field.input_type && respond_to?(override_method_type, true) send(override_method_type, field, locale) else - send("#{field.input_type}_to_json_schema_field", field, locale) + send(:"#{field.input_type}_to_json_schema_field", field, locale) end end }.tap do |output| @@ -68,7 +68,7 @@ def fields_to_ui_schema(fields, locale = 'en') if field.code && respond_to?(override_method, true) send(override_method, field, locale) else - send("#{field.input_type}_to_ui_schema_field", field, locale) + send(:"#{field.input_type}_to_ui_schema_field", field, locale) end end.tap do |output| output['ui:order'] = fields.sort_by { |f| f.ordering || Float::INFINITY }.map(&:key) diff --git a/back/app/services/idea_custom_fields_service.rb b/back/app/services/idea_custom_fields_service.rb index c39003e27427..09e729801783 100644 --- a/back/app/services/idea_custom_fields_service.rb +++ b/back/app/services/idea_custom_fields_service.rb @@ -140,8 +140,8 @@ def duplicate_all_fields end copied_field.options = copied_options - # Duplicate and persist map config if it is a point field - if copied_field.input_type == 'point' && field.map_config + # Duplicate and persist map config for custom_fields that can have an associated map_config + if CustomField::MAP_CONFIG_INPUT_TYPES.include?(copied_field.input_type) && field.map_config original_map_config = CustomMaps::MapConfig.find(field.map_config.id) new_map_config = original_map_config.dup new_map_config.mappable = nil diff --git a/back/app/services/input_ui_schema_generator_service.rb b/back/app/services/input_ui_schema_generator_service.rb index e609be7e8561..b048fa8e0d01 100644 --- a/back/app/services/input_ui_schema_generator_service.rb +++ b/back/app/services/input_ui_schema_generator_service.rb @@ -35,7 +35,9 @@ def visit_page(field) input_type: field.input_type, id: field.id, title: multiloc_service.t(field.title_multiloc), - description: description_option(field) + description: description_option(field), + page_layout: field.page_layout, + map_config_id: field&.map_config&.id }, elements: [ # No elements yet. They will be added after invoking this method. diff --git a/back/app/services/project_copy_service.rb b/back/app/services/project_copy_service.rb index 9fd2e8b75b1a..9bc17b36e0ed 100644 --- a/back/app/services/project_copy_service.rb +++ b/back/app/services/project_copy_service.rb @@ -165,6 +165,7 @@ def yml_custom_fields(shift_timestamps: 0) 'maximum_select_count' => field.maximum_select_count, 'minimum_select_count' => field.minimum_select_count, 'random_option_ordering' => field.random_option_ordering, + 'page_layout' => field.page_layout, 'text_images_attributes' => field.text_images.map do |text_image| { 'imageable_field' => text_image.imageable_field, diff --git a/back/config/locales/cy-GB.yml b/back/config/locales/cy-GB.yml new file mode 100644 index 000000000000..a4af0c914286 --- /dev/null +++ b/back/config/locales/cy-GB.yml @@ -0,0 +1,330 @@ +cy: + locales: + en: Saesneg + ar-MA: Arabeg (Moroco) + ar-SA: Arabeg (Saudi Arabia) + ca-ES: Catalaneg + cy-GB: Cymraeg + da-DK: Daneg + de-DE: Almaeneg + el-GR: Groeg + en-CA: Saesneg (Canada) + en-GB: Saesneg (DU) + en-IE: Saesneg (Iwerddon) + es-CL: Sbaeneg (Chile) + es-ES: Sbaeneg (Sbaen) + fi-FI: Ffinneg + fr-BE: Ffrangeg (Gwlad Belg) + fr-FR: Ffrangeg + hr-HR: Croateg + hu-HU: Hwngareg + it-IT: Eidaleg + kl-GL: Greenlandic + lb-LU: Lwcsembwrgaidd + lv-LV: Latfieg + mi: Maori + nb-NO: Norwyeg (Bokmål) + nl-BE: Iseldireg (Gwlad Belg) + nl-NL: Iseldireg + pl-PL: Pwyleg + pt-BR: Portiwgaleg (Brasil) + ro-RO: Rwmania + sr-Latn: Serbeg (Lladin) + sr-SP: Serbeg (Cyrilig) + sv-SE: Swedeg + tr-TR: Twrceg + symbols: + outside: rhywle arall + idea_statuses: + proposed: arfaethedig + proposed_description: Mae'r syniad hwn wedi'i gynnig i'r ddinas + viewed: gweld + viewed_description: Mae'r syniad hwn wedi'i weld gan rywun o'r ddinas + under_consideration: dan ystyriaeth + under_consideration_description: Mae'r syniad hwn wedi'i gymryd i ystyriaeth gan y ddinas + accepted: derbyn + accepted_description: Mae'r syniad hwn wedi'i dderbyn a bydd yn cael ei weithredu gan y ddinas + implemented: gweithredu + implemented_description: Mae'r syniad hwn wedi'i roi ar waith gan y ddinas + rejected: gwrthodwyd + rejected_description: Mae'r syniad hwn wedi'i wrthod + initiative_statuses: + review_pending: adolygiad yn yr arfaeth + review_pending_description: adolygiad yn yr arfaeth + changes_requested: newidiadau y gofynnwyd amdanynt + changes_requested_description: newidiadau y gofynnwyd amdanynt + proposed: arfaethedig + proposed_description: arfaethedig + expired: wedi dod i ben + expired_description: wedi dod i ben + threshold_reached: trothwy wedi ei gyrraedd + threshold_reached_description: trothwy wedi ei gyrraedd + answered: atebodd + answered_description: atebodd + ineligible: anghymwys + ineligible_description: anghymwys + topics: + nature: Natur a bioamrywiaeth + nature_description: Natur a bioamrywiaeth + waste: Glanweithdra a gwastraff + waste_description: Glanweithdra a gwastraff + sustainability: Datblygu cynaliadwy + sustainability_description: Datblygu cynaliadwy + mobility: Symudedd + mobility_description: Symudedd + technology: Ynni a thechnoleg + technology_description: Ynni a thechnoleg + economy: Gwaith, yr economi a thwristiaeth + economy_description: Gwaith, yr economi a thwristiaeth + housing: Tai + housing_description: Tai + public_space: Mannau cyhoeddus ac adeiladau + public_space_description: Mannau cyhoeddus ac adeiladau + safety: Diogelwch + safety_description: Diogelwch + education: Addysg ac ieuenctid + education_description: Addysg ac ieuenctid + culture: Diwylliant, chwaraeon a digwyddiadau + culture_description: Diwylliant, chwaraeon a digwyddiadau + health: Iechyd a lles + health_description: Iechyd a lles + inclusion: Cynhwysiant cymdeithasol + inclusion_description: Cynhwysiant cymdeithasol + community: Datblygu cymunedol + community_description: Datblygu cymunedol + services: Gwasanaethau cyhoeddus + services_description: Gwasanaethau cyhoeddus + other: Arall + other_description: Arall + static_pages: + terms_and_conditions_title: Telerau ac amodau + terms_and_conditions_body: > +

These terms & conditions outline the rules and guidelines of contributing to the platform and are meant to help ensure a constructive dialogue.

Your ideas to further improve the platform are welcome and can be sent to support@govocal.com.

Who can participate?

Anyone is able to view public projects via the platform. If you’d like to contribute content (e.g., submit input or react), you will need to register and create an account. You can register using your e-mail address; for some platforms, it may also be possible to sign in using an existing Facebook or Google account. If you use either of these services, your name, email address and profile photo will be shared with and added to your platform account.

Please note that the creation of your account does not give you ownership. Platform administrators can refuse, suspend or delete accounts for reasons such as not adhering to the terms and conditions outlined on this page.

The general conditions for your account are the following: