decidim-core 0.22.0 → 0.23.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/assets/config/decidim_core_manifest.js +5 -0
- data/app/assets/javascripts/decidim.js.es6 +2 -0
- data/app/assets/javascripts/decidim/ajax_modals.js.es6 +3 -3
- data/app/assets/javascripts/decidim/confirm.js.es6 +3 -2
- data/app/assets/javascripts/decidim/core/bundle.js +1 -1
- data/app/assets/javascripts/decidim/core/bundle.js.map +1 -1
- data/app/assets/javascripts/decidim/diff_mode_dropdown.js.es6 +18 -4
- data/app/assets/javascripts/decidim/editor.js.es6 +4 -4
- data/app/assets/javascripts/decidim/geocoding.js.es6 +60 -0
- data/app/assets/javascripts/decidim/geocoding/attach_input.js.es6 +106 -0
- data/app/assets/javascripts/decidim/geocoding/format_address.js.es6 +29 -0
- data/app/assets/javascripts/decidim/geocoding/provider/here.js.es6 +107 -0
- data/app/assets/javascripts/decidim/geocoding/provider/photon.js.es6 +77 -0
- data/app/assets/javascripts/decidim/map.js.es6 +34 -124
- data/app/assets/javascripts/decidim/map/controller.js.es6 +92 -0
- data/app/assets/javascripts/decidim/map/controller/markers.js.es6 +65 -0
- data/app/assets/javascripts/decidim/map/controller/static.es6 +48 -0
- data/app/assets/javascripts/decidim/map/factory.js.es6 +51 -0
- data/app/assets/javascripts/decidim/map/icon.js.es6 +31 -0
- data/app/assets/javascripts/decidim/map/legacy.js.es6 +87 -0
- data/app/assets/javascripts/decidim/map/provider/default.js.es6 +22 -0
- data/app/assets/javascripts/decidim/map/provider/here.js.es6 +22 -0
- data/app/assets/javascripts/decidim/security/selfxss_warning.js.es6 +19 -0
- data/app/assets/stylesheets/decidim/_decidim.scss +2 -0
- data/app/assets/stylesheets/decidim/layouts/_home.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_cards.scss +15 -0
- data/app/assets/stylesheets/decidim/modules/_forms.scss +14 -0
- data/app/assets/stylesheets/decidim/modules/_layout.scss +11 -3
- data/app/assets/stylesheets/decidim/modules/_map.scss +35 -0
- data/app/assets/stylesheets/decidim/modules/_progress-bar.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_reveal.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_status-labels.scss +2 -1
- data/app/cells/decidim/author/flag.erb +1 -1
- data/app/cells/decidim/author/profile_inline.erb +2 -2
- data/app/cells/decidim/author_cell.rb +5 -2
- data/app/cells/decidim/card_cell.rb +21 -7
- data/app/cells/decidim/card_m/show.erb +1 -1
- data/app/cells/decidim/card_m_cell.rb +6 -4
- data/app/cells/decidim/collapsible_authors_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/sub_hero/show.erb +3 -1
- data/app/cells/decidim/diff/diff_mode_html.erb +5 -5
- data/app/cells/decidim/follow_button/show.erb +6 -6
- data/app/cells/decidim/follow_button_cell.rb +8 -0
- data/app/cells/decidim/progress_bar/show.erb +11 -4
- data/app/cells/decidim/progress_bar_cell.rb +20 -1
- data/app/cells/decidim/tos_page/announcement.erb +0 -1
- data/app/cells/decidim/tos_page/form.erb +17 -0
- data/app/cells/decidim/translation_bar/show.erb +6 -0
- data/app/cells/decidim/translation_bar_cell.rb +52 -0
- data/app/cells/decidim/version_cell.rb +1 -1
- data/app/cells/decidim/versions_list_cell.rb +1 -1
- data/app/commands/decidim/amendable/accept.rb +9 -3
- data/app/commands/decidim/amendable/create_draft.rb +2 -0
- data/app/commands/decidim/amendable/update_draft.rb +2 -0
- data/app/commands/decidim/attachment_methods.rb +20 -5
- data/app/commands/decidim/destroy_account.rb +1 -0
- data/app/commands/decidim/gallery_methods.rb +16 -9
- data/app/commands/decidim/messaging/reply_to_conversation.rb +1 -1
- data/app/commands/decidim/multiple_attachments_methods.rb +56 -0
- data/app/controllers/concerns/decidim/devise_controllers.rb +1 -0
- data/app/controllers/concerns/decidim/filter_resource.rb +24 -6
- data/app/controllers/concerns/decidim/flaggable.rb +20 -0
- data/app/controllers/concerns/decidim/force_authentication.rb +1 -0
- data/app/controllers/concerns/decidim/impersonate_users.rb +1 -1
- data/app/controllers/concerns/decidim/needs_snippets.rb +20 -0
- data/app/controllers/concerns/decidim/paginable.rb +5 -1
- data/app/controllers/concerns/decidim/withdrawable.rb +20 -0
- data/app/controllers/decidim/application_controller.rb +16 -0
- data/app/controllers/decidim/components/base_controller.rb +6 -1
- data/app/controllers/decidim/cookie_policy_controller.rb +6 -3
- data/app/controllers/decidim/messaging/conversations_controller.rb +5 -2
- data/app/forms/decidim/account_form.rb +5 -1
- data/app/forms/decidim/amendable/create_form.rb +1 -1
- data/app/forms/decidim/amendable/form.rb +44 -3
- data/app/forms/decidim/attachment_form.rb +6 -1
- data/app/forms/decidim/user_group_form.rb +5 -1
- data/app/helpers/decidim/cells_helper.rb +3 -15
- data/app/helpers/decidim/check_boxes_tree_helper.rb +21 -12
- data/app/helpers/decidim/cookies_helper.rb +1 -1
- data/app/helpers/decidim/decidim_form_helper.rb +1 -1
- data/app/helpers/decidim/filter_params_helper.rb +30 -0
- data/app/helpers/decidim/map_helper.rb +86 -23
- data/app/helpers/decidim/orders_helper.rb +6 -1
- data/app/helpers/decidim/paginate_helper.rb +1 -8
- data/app/helpers/decidim/sanitize_helper.rb +8 -0
- data/app/helpers/decidim/scopes_helper.rb +5 -5
- data/app/helpers/decidim/translations_helper.rb +7 -1
- data/app/jobs/decidim/data_portability_export_job.rb +3 -3
- data/app/jobs/decidim/machine_translation_fields_job.rb +30 -0
- data/app/jobs/decidim/machine_translation_resource_job.rb +113 -0
- data/app/jobs/decidim/machine_translation_save_job.rb +33 -0
- data/app/jobs/decidim/open_data_job.rb +1 -1
- data/app/mailers/decidim/application_mailer.rb +1 -0
- data/app/mailers/decidim/reported_mailer.rb +8 -1
- data/app/models/decidim/action_log.rb +1 -1
- data/app/models/decidim/area.rb +3 -0
- data/app/models/decidim/area_type.rb +4 -0
- data/app/models/decidim/attachment.rb +30 -2
- data/app/models/decidim/attachment_collection.rb +3 -0
- data/app/models/decidim/authorization.rb +3 -0
- data/app/models/decidim/category.rb +4 -0
- data/app/models/decidim/component.rb +7 -0
- data/app/models/decidim/content_block.rb +11 -1
- data/app/models/decidim/contextual_help_section.rb +4 -0
- data/app/models/decidim/follow.rb +3 -1
- data/app/models/decidim/messaging/message.rb +1 -1
- data/app/models/decidim/moderation.rb +1 -1
- data/app/models/decidim/newsletter.rb +3 -0
- data/app/models/decidim/oauth_application.rb +2 -0
- data/app/models/decidim/organization.rb +54 -10
- data/app/models/decidim/scope.rb +4 -1
- data/app/models/decidim/scope_type.rb +3 -0
- data/app/models/decidim/share_token.rb +49 -0
- data/app/models/decidim/static_page.rb +4 -1
- data/app/models/decidim/static_page_topic.rb +3 -0
- data/app/models/decidim/user.rb +11 -3
- data/app/models/decidim/user_base_entity.rb +6 -2
- data/app/permissions/decidim/permissions.rb +9 -0
- data/app/presenters/decidim/admin_log/component_presenter.rb +2 -2
- data/app/presenters/decidim/admin_log/moderation_presenter.rb +2 -2
- data/app/presenters/decidim/admin_log/organization_presenter.rb +2 -2
- data/app/presenters/decidim/admin_log/user_presenter.rb +2 -2
- data/app/presenters/decidim/log/base_presenter.rb +10 -2
- data/app/presenters/decidim/log/value_types/default_presenter.rb +1 -1
- data/app/presenters/decidim/official_author_presenter.rb +36 -0
- data/app/presenters/decidim/resource_locator_presenter.rb +63 -12
- data/app/queries/decidim/similar_emendations.rb +4 -4
- data/app/scrubbers/decidim/newsletter_scrubber.rb +31 -0
- data/app/scrubbers/decidim/user_input_scrubber.rb +1 -1
- data/app/serializers/decidim/importers/participatory_space_components_importer.rb +1 -1
- data/app/services/decidim/base_diff_renderer.rb +17 -0
- data/app/services/decidim/open_data_exporter.rb +2 -0
- data/app/services/decidim/resource_search.rb +95 -6
- data/app/services/decidim/static_map_generator.rb +10 -26
- data/app/services/decidim/tokenizer.rb +38 -0
- data/app/services/decidim/traceability.rb +3 -0
- data/app/uploaders/decidim/application_uploader.rb +19 -1
- data/app/uploaders/decidim/attachment_uploader.rb +23 -17
- data/app/uploaders/decidim/banner_image_uploader.rb +1 -1
- data/app/uploaders/decidim/hero_image_uploader.rb +1 -1
- data/app/uploaders/decidim/homepage_image_uploader.rb +1 -1
- data/app/uploaders/decidim/image_uploader.rb +6 -2
- data/app/uploaders/decidim/oauth_application_logo_uploader.rb +1 -1
- data/app/uploaders/decidim/official_image_footer_uploader.rb +1 -1
- data/app/uploaders/decidim/official_image_header_uploader.rb +1 -1
- data/app/uploaders/decidim/organization_logo_uploader.rb +1 -1
- data/app/uploaders/decidim/record_image_uploader.rb +15 -0
- data/app/validators/etiquette_validator.rb +0 -7
- data/app/validators/geocoding_validator.rb +9 -4
- data/app/validators/passthru_validator.rb +111 -0
- data/app/validators/scope_belongs_to_component_validator.rb +16 -0
- data/app/validators/uploader_content_type_validator.rb +44 -0
- data/app/views/decidim/authorization_modals/_content.html.erb +2 -2
- data/app/views/decidim/devise/registrations/new.html.erb +3 -1
- data/app/views/decidim/devise/sessions/new.html.erb +3 -1
- data/app/views/decidim/messaging/conversations/_error_modal.html.erb +21 -0
- data/app/views/decidim/messaging/conversations/error.js.erb +10 -0
- data/app/views/decidim/newsletter_mailer/newsletter.html.erb +1 -1
- data/app/views/decidim/notification_mailer/event_received.html.erb +2 -2
- data/app/views/decidim/pages/_standalone.html.erb +1 -1
- data/app/views/decidim/pages/_tabbed.html.erb +1 -1
- data/app/views/decidim/reported_mailer/report.html.erb +49 -3
- data/app/views/decidim/scopes/_scopes_picker_input.html.erb +15 -14
- data/app/views/decidim/searches/_filters.html.erb +1 -0
- data/app/views/decidim/shared/_login_modal.html.erb +14 -3
- data/app/views/decidim/shared/_static_map.html.erb +1 -1
- data/app/views/layouts/decidim/_head.html.erb +2 -0
- data/app/views/layouts/decidim/_js_configuration.html.erb +7 -1
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +3 -4
- data/config/locales/bg.yml +1508 -0
- data/config/locales/ca.yml +36 -9
- data/config/locales/cs.yml +54 -27
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +156 -128
- data/config/locales/el.yml +0 -4
- data/config/locales/en.yml +30 -3
- data/config/locales/eo.yml +92 -0
- data/config/locales/es-MX.yml +29 -2
- data/config/locales/es-PY.yml +28 -1
- data/config/locales/es.yml +44 -17
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +9 -4
- data/config/locales/fi-plain.yml +28 -1
- data/config/locales/fi.yml +34 -7
- data/config/locales/fr-CA.yml +32 -4
- data/config/locales/fr.yml +65 -37
- data/config/locales/ga-IE.yml +0 -8
- data/config/locales/gl.yml +10 -5
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +7 -5
- data/config/locales/id-ID.yml +3 -4
- data/config/locales/is-IS.yml +3 -9
- data/config/locales/is.yml +463 -0
- data/config/locales/it.yml +37 -9
- data/config/locales/ja-JP.yml +25 -16
- data/config/locales/ja.yml +1605 -0
- data/config/locales/ko-KR.yml +1 -0
- data/config/locales/ko.yml +1 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/{lv-LV.yml → lv.yml} +2 -5
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +34 -12
- data/config/locales/no.yml +150 -8
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +89 -72
- data/config/locales/pt-BR.yml +4 -5
- data/config/locales/pt.yml +10 -4
- data/config/locales/ro-RO.yml +10 -4
- data/config/locales/ru.yml +3 -10
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +3 -5
- data/config/locales/sl.yml +8 -7
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +0 -9
- data/config/locales/sv.yml +19 -8
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +588 -247
- data/config/locales/uk.yml +3 -11
- data/config/locales/vi-VN.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +1584 -0
- data/config/locales/zh-TW.yml +1 -0
- data/db/migrate/20200525184143_add_enable_machine_translation_to_decidim_organizations.rb +7 -0
- data/db/migrate/20200702073419_create_decidim_share_tokens.rb +16 -0
- data/db/migrate/20200707132401_add_comments_max_length_to_decidim_organization.rb +7 -0
- data/db/migrate/20200730142511_add_file_upload_settings_to_decidim_organizations.rb +36 -0
- data/db/migrate/20200806092109_add_machine_translation_display_priority_to_organizations.rb +17 -0
- data/db/migrate/20201004160335_remove_notifications_with_continuity_badge.rb +9 -0
- data/db/seeds.rb +12 -6
- data/lib/decidim/authorable.rb +22 -1
- data/lib/decidim/authorization_form_builder.rb +7 -0
- data/lib/decidim/coauthorable.rb +22 -0
- data/lib/decidim/component_manifest.rb +1 -1
- data/lib/decidim/content_processor.rb +52 -29
- data/lib/decidim/content_renderers/base_renderer.rb +1 -1
- data/lib/decidim/content_renderers/hashtag_renderer.rb +2 -0
- data/lib/decidim/content_renderers/link_renderer.rb +4 -1
- data/lib/decidim/content_renderers/user_group_renderer.rb +3 -1
- data/lib/decidim/content_renderers/user_renderer.rb +3 -1
- data/lib/decidim/core.rb +67 -12
- data/lib/decidim/core/engine.rb +65 -21
- data/lib/decidim/core/test.rb +8 -0
- data/lib/decidim/core/test/factories.rb +34 -8
- data/lib/decidim/core/test/shared_examples/admin_log_presenter_examples.rb +34 -0
- data/lib/decidim/core/test/shared_examples/amendable/accept_amendment_examples.rb +4 -4
- data/lib/decidim/core/test/shared_examples/amendable_proposals_interface_examples.rb +8 -8
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +52 -1
- data/lib/decidim/core/test/shared_examples/counts_commentators_as_newsletter_participants.rb +31 -0
- data/lib/decidim/core/test/shared_examples/embed_resource_examples.rb +49 -0
- data/lib/decidim/core/test/shared_examples/follows_examples.rb +3 -3
- data/lib/decidim/core/test/shared_examples/manage_component_share_tokens.rb +83 -0
- data/lib/decidim/core/test/shared_examples/map_examples.rb +186 -0
- data/lib/decidim/core/test/shared_examples/preview_component_with_share_token_examples.rb +55 -0
- data/lib/decidim/core/test/shared_examples/resource_search_examples.rb +200 -0
- data/lib/decidim/core/test/shared_examples/scopable_resource_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +12 -1
- data/lib/decidim/core/test/shared_examples/searchable_participatory_space_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +15 -2
- data/lib/decidim/core/test/shared_examples/simple_event.rb +7 -0
- data/lib/decidim/core/test/shared_examples/system_endorse_resource_examples.rb +1 -0
- data/lib/decidim/core/test/shared_examples/traceable_interface_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/uncommentable_component_examples.rb +1 -1
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/diffy_extension.rb +21 -0
- data/lib/decidim/events/base_event.rb +29 -11
- data/lib/decidim/exporters.rb +7 -0
- data/lib/decidim/exporters/csv.rb +15 -1
- data/lib/decidim/exporters/excel.rb +1 -1
- data/lib/decidim/exporters/export_manifest.rb +29 -0
- data/lib/decidim/exporters/pdf.rb +56 -0
- data/lib/decidim/file_validator_humanizer.rb +98 -0
- data/lib/decidim/form_builder.rb +68 -56
- data/lib/decidim/geocodable.rb +79 -0
- data/lib/decidim/has_attachments.rb +10 -0
- data/lib/decidim/has_private_users.rb +1 -1
- data/lib/decidim/has_upload_validations.rb +36 -0
- data/lib/decidim/map.rb +214 -0
- data/lib/decidim/map/autocomplete.rb +67 -0
- data/lib/decidim/map/dynamic_map.rb +89 -0
- data/lib/decidim/map/frontend.rb +97 -0
- data/lib/decidim/map/geocoding.rb +115 -0
- data/lib/decidim/map/provider.rb +12 -0
- data/lib/decidim/map/provider/autocomplete/here.rb +20 -0
- data/lib/decidim/map/provider/autocomplete/osm.rb +20 -0
- data/lib/decidim/map/provider/dynamic_map/here.rb +51 -0
- data/lib/decidim/map/provider/dynamic_map/osm.rb +13 -0
- data/lib/decidim/map/provider/geocoding/here.rb +58 -0
- data/lib/decidim/map/provider/geocoding/osm.rb +30 -0
- data/lib/decidim/map/provider/here.rb +21 -0
- data/lib/decidim/map/provider/osm.rb +22 -0
- data/lib/decidim/map/provider/static_map/here.rb +35 -0
- data/lib/decidim/map/provider/static_map/osm.rb +29 -0
- data/lib/decidim/map/static_map.rb +133 -0
- data/lib/decidim/map/utility.rb +38 -0
- data/lib/decidim/newsletter_participant.rb +2 -4
- data/lib/decidim/organization_settings.rb +267 -0
- data/lib/decidim/paddable.rb +11 -4
- data/lib/decidim/resource_manifest.rb +1 -1
- data/lib/decidim/scopable.rb +9 -6
- data/lib/decidim/scopable_component.rb +29 -1
- data/lib/decidim/scopable_participatory_space.rb +19 -0
- data/lib/decidim/scopable_resource.rb +21 -0
- data/lib/decidim/search_resource_fields_mapper.rb +17 -4
- data/lib/decidim/searchable.rb +6 -0
- data/lib/decidim/settings_manifest.rb +2 -1
- data/lib/decidim/shareable_with_token.rb +27 -0
- data/lib/decidim/snippets.rb +30 -0
- data/lib/decidim/translatable_attributes.rb +42 -4
- data/lib/decidim/translatable_resource.rb +78 -0
- data/lib/decidim/view_model.rb +1 -0
- data/lib/premailer/adapter/decidim.rb +33 -0
- data/lib/tasks/decidim_locales_tasks.rake +35 -0
- data/lib/tasks/decidim_tasks.rake +1 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.bg.js +14 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.da.js +14 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.eo.js +17 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.et.js +18 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.fr-CA.js +16 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ga.js +15 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.hr.js +13 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.is.js +14 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.ja.js +16 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.lt.js +16 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.lv.js +17 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.mt.js +15 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.sl.js +14 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.sr.js +16 -0
- metadata +149 -30
- data/app/cells/decidim/tos_page/sticky_form.erb +0 -29
- data/app/helpers/decidim/multi_translation_helper.rb +0 -0
- data/lib/decidim/hashtaggable.rb +0 -24
data/lib/decidim/form_builder.rb
CHANGED
@@ -8,6 +8,7 @@ module Decidim
|
|
8
8
|
class FormBuilder < FoundationRailsHelper::FormBuilder
|
9
9
|
include ActionView::Context
|
10
10
|
include Decidim::TranslatableAttributes
|
11
|
+
include Decidim::Map::Autocomplete::FormBuilder
|
11
12
|
|
12
13
|
# Public: generates a check boxes input from a collection and adds help
|
13
14
|
# text and errors.
|
@@ -32,7 +33,7 @@ module Decidim
|
|
32
33
|
# text and errors.
|
33
34
|
#
|
34
35
|
# attribute - the name of the field
|
35
|
-
# collection - the collection from which we will render the
|
36
|
+
# collection - the collection from which we will render the radio buttons
|
36
37
|
# value_attribute - a Symbol or a Proc defining how to find the value attribute
|
37
38
|
# text_attribute - a Symbol or a Proc defining how to find the text attribute
|
38
39
|
# options - a Hash with options
|
@@ -45,6 +46,14 @@ module Decidim
|
|
45
46
|
end
|
46
47
|
# rubocop:enable Metrics/ParameterLists
|
47
48
|
|
49
|
+
def create_language_selector(locales, tabs_id, name)
|
50
|
+
if Decidim.available_locales.count > 4
|
51
|
+
language_selector_select(locales, tabs_id, name)
|
52
|
+
else
|
53
|
+
language_tabs(locales, tabs_id, name)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
48
57
|
# Public: Generates an form field for each locale.
|
49
58
|
#
|
50
59
|
# type - The form field's type, like `text_area` or `text_input`
|
@@ -60,22 +69,10 @@ module Decidim
|
|
60
69
|
label_tabs = content_tag(:div, class: "label--tabs") do
|
61
70
|
field_label = label_i18n(name, options[:label] || label_for(name))
|
62
71
|
|
63
|
-
|
64
|
-
if options[:label] != false
|
65
|
-
tabs_panels = content_tag(:ul, class: "tabs tabs--lang", id: tabs_id, data: { tabs: true }) do
|
66
|
-
locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
|
67
|
-
string + content_tag(:li, class: tab_element_class_for("title", index)) do
|
68
|
-
title = I18n.with_locale(locale) { I18n.t("name", scope: "locale") }
|
69
|
-
element_class = nil
|
70
|
-
element_class = "is-tab-error" if error?(name_with_locale(name, locale))
|
71
|
-
tab_content_id = sanitize_tabs_selector "#{tabs_id}-#{name}-panel-#{index}"
|
72
|
-
content_tag(:a, title, href: "##{tab_content_id}", class: element_class)
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
76
|
-
end
|
72
|
+
language_selector = "".html_safe
|
73
|
+
language_selector = create_language_selector(locales, tabs_id, name) if options[:label] != false
|
77
74
|
|
78
|
-
safe_join [field_label,
|
75
|
+
safe_join [field_label, language_selector]
|
79
76
|
end
|
80
77
|
|
81
78
|
hashtaggable = options.delete(:hashtaggable)
|
@@ -284,14 +281,18 @@ module Decidim
|
|
284
281
|
# options - An optional Hash with options:
|
285
282
|
# - multiple - Multiple mode, to allow multiple scopes selection.
|
286
283
|
# - label - Show label?
|
287
|
-
# - checkboxes_on_top - Show checked picker values on top (default) or below the picker prompt
|
284
|
+
# - checkboxes_on_top - Show checked picker values on top (default) or below the picker prompt (only for multiple pickers)
|
285
|
+
# - namespace - prepend a custom name to the html element's DOM id.
|
288
286
|
#
|
289
287
|
# Also it should receive a block that returns a Hash with :url and :text for each selected scope (and for null scope for prompt)
|
290
288
|
#
|
291
289
|
# Returns a String.
|
292
290
|
def scopes_picker(attribute, options = {})
|
293
|
-
id =
|
294
|
-
|
291
|
+
id = if self.options.has_key?(:namespace)
|
292
|
+
"#{self.options[:namespace]}_#{sanitize_for_dom_selector(@object_name)}"
|
293
|
+
else
|
294
|
+
"#{sanitize_for_dom_selector(@object_name)}_#{attribute}"
|
295
|
+
end
|
295
296
|
|
296
297
|
picker_options = {
|
297
298
|
id: id,
|
@@ -309,7 +310,7 @@ module Decidim
|
|
309
310
|
picker_options: picker_options,
|
310
311
|
prompt_params: prompt_params,
|
311
312
|
scopes: scopes,
|
312
|
-
|
313
|
+
values_on_top: !options[:multiple] || options[:checkboxes_on_top])
|
313
314
|
template += error_and_help_text(attribute, options)
|
314
315
|
template.html_safe
|
315
316
|
end
|
@@ -404,11 +405,12 @@ module Decidim
|
|
404
405
|
def upload(attribute, options = {})
|
405
406
|
self.multipart = true
|
406
407
|
options[:optional] = options[:optional].nil? ? true : options[:optional]
|
407
|
-
|
408
|
+
label_text = options[:label] || label_for(attribute)
|
409
|
+
alt_text = label_text
|
408
410
|
|
409
411
|
file = object.send attribute
|
410
412
|
template = ""
|
411
|
-
template += label(attribute,
|
413
|
+
template += label(attribute, label_text + required_for_attribute(attribute))
|
412
414
|
template += upload_help(attribute, options)
|
413
415
|
template += @template.file_field @object_name, attribute
|
414
416
|
|
@@ -450,47 +452,23 @@ module Decidim
|
|
450
452
|
# rubocop:enable Metrics/PerceivedComplexity
|
451
453
|
|
452
454
|
def upload_help(attribute, _options = {})
|
453
|
-
|
455
|
+
humanizer = FileValidatorHumanizer.new(object, attribute)
|
454
456
|
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
lte = file_size_validator.options[:less_than_or_equal_to]
|
461
|
-
max_file_size = lte.call(nil) if lte && lte.lambda?
|
457
|
+
help_scope = begin
|
458
|
+
if humanizer.uploader.is_a?(Decidim::ImageUploader)
|
459
|
+
"decidim.forms.file_help.image"
|
460
|
+
else
|
461
|
+
"decidim.forms.file_help.file"
|
462
462
|
end
|
463
|
+
end
|
463
464
|
|
464
|
-
|
465
|
-
if file.is_a?(Decidim::ImageUploader)
|
466
|
-
"decidim.forms.file_help.image"
|
467
|
-
else
|
468
|
-
"decidim.forms.file_help.file"
|
469
|
-
end
|
470
|
-
end
|
465
|
+
content_tag(:div, class: "help-text") do
|
471
466
|
help_messages = %w(message_1 message_2)
|
472
467
|
|
473
468
|
inner = "<p>#{I18n.t("explanation", scope: help_scope)}</p>".html_safe
|
474
469
|
inner + content_tag(:ul) do
|
475
470
|
messages = help_messages.each.map { |msg| I18n.t(msg, scope: help_scope) }
|
476
|
-
|
477
|
-
if max_file_size
|
478
|
-
file_size_mb = (((max_file_size / 1024 / 1024) * 100) / 100).round
|
479
|
-
messages << I18n.t(
|
480
|
-
"max_file_size",
|
481
|
-
megabytes: file_size_mb,
|
482
|
-
scope: "decidim.forms.file_validation"
|
483
|
-
)
|
484
|
-
end
|
485
|
-
|
486
|
-
if file.respond_to?(:extension_whitelist, true)
|
487
|
-
allowed_extensions = file.send(:extension_whitelist)
|
488
|
-
messages << I18n.t(
|
489
|
-
"allowed_file_extensions",
|
490
|
-
extensions: allowed_extensions.join(" "),
|
491
|
-
scope: "decidim.forms.file_validation"
|
492
|
-
)
|
493
|
-
end
|
471
|
+
messages += humanizer.messages
|
494
472
|
|
495
473
|
messages.map { |msg| content_tag(:li, msg) }.join("\n").html_safe
|
496
474
|
end.html_safe
|
@@ -653,7 +631,7 @@ module Decidim
|
|
653
631
|
def find_validator(attribute, klass)
|
654
632
|
return unless object.respond_to?(:_validators)
|
655
633
|
|
656
|
-
object._validators[attribute].find { |validator| validator.class == klass }
|
634
|
+
object._validators[attribute.to_sym].find { |validator| validator.class == klass }
|
657
635
|
end
|
658
636
|
|
659
637
|
# Private: Override method from FoundationRailsHelper to render the text of the
|
@@ -818,6 +796,10 @@ module Decidim
|
|
818
796
|
id.tr("[", "-").tr("]", "-")
|
819
797
|
end
|
820
798
|
|
799
|
+
def sanitize_for_dom_selector(name)
|
800
|
+
name.to_s.parameterize.underscore
|
801
|
+
end
|
802
|
+
|
821
803
|
def extension_whitelist_help(extension_whitelist)
|
822
804
|
content_tag :p, class: "extensions-help help-text" do
|
823
805
|
safe_join([
|
@@ -872,5 +854,35 @@ module Decidim
|
|
872
854
|
|
873
855
|
content_tag(:span, prefix + input + postfix, class: "row collapse")
|
874
856
|
end
|
857
|
+
|
858
|
+
def language_selector_select(locales, tabs_id, name)
|
859
|
+
content_tag(:div) do
|
860
|
+
content_tag(:select, id: tabs_id, class: "language-change") do
|
861
|
+
locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
|
862
|
+
title = if error?(name_with_locale(name, locale))
|
863
|
+
I18n.with_locale(locale) { I18n.t("name_with_error", scope: "locale") }
|
864
|
+
else
|
865
|
+
I18n.with_locale(locale) { I18n.t("name", scope: "locale") }
|
866
|
+
end
|
867
|
+
tab_content_id = sanitize_tabs_selector "#{tabs_id}-#{name}-panel-#{index}"
|
868
|
+
string + content_tag(:option, title, value: "##{tab_content_id}")
|
869
|
+
end
|
870
|
+
end
|
871
|
+
end
|
872
|
+
end
|
873
|
+
|
874
|
+
def language_tabs(locales, tabs_id, name)
|
875
|
+
content_tag(:ul, class: "tabs tabs--lang", id: tabs_id, data: { tabs: true }) do
|
876
|
+
locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
|
877
|
+
string + content_tag(:li, class: tab_element_class_for("title", index)) do
|
878
|
+
title = I18n.with_locale(locale) { I18n.t("name", scope: "locale") }
|
879
|
+
element_class = nil
|
880
|
+
element_class = "is-tab-error" if error?(name_with_locale(name, locale))
|
881
|
+
tab_content_id = sanitize_tabs_selector "#{tabs_id}-#{name}-panel-#{index}"
|
882
|
+
content_tag(:a, title, href: "##{tab_content_id}", class: element_class)
|
883
|
+
end
|
884
|
+
end
|
885
|
+
end
|
886
|
+
end
|
875
887
|
end
|
876
888
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "geocoder/stores/active_record"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
# This concern overrides some of the Active Record functionality injected by
|
7
|
+
# the Geocoder gem in order to pass the geocoding searches through Decidim's
|
8
|
+
# own API which configures the geocoder correctly for each search. This is
|
9
|
+
# used when the `model.geocode` and `model.reverse_geocode` methods are called
|
10
|
+
# for the Active Record models.
|
11
|
+
#
|
12
|
+
# NOTE: This module is automatically loaded for all active record models in
|
13
|
+
# the "decidim.geocoding_extensions" initializer. It does not need to be
|
14
|
+
# included separately into any models.
|
15
|
+
module Geocodable
|
16
|
+
extend ActiveSupport::Concern
|
17
|
+
|
18
|
+
class_methods do
|
19
|
+
# Avoid double loading Geocoder::Store::ActiveRecord since it's already
|
20
|
+
# loaded by this concern (below in the included block).
|
21
|
+
def geocoder_init(options)
|
22
|
+
@geocoder_options = {} unless defined?(@geocoder_options)
|
23
|
+
@geocoder_options.merge! options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
included do
|
28
|
+
include Geocoder::Store::ActiveRecord
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def do_lookup(_reverse = false)
|
33
|
+
RecordGeocoder.with_record(self) do
|
34
|
+
super
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
module RecordGeocoder
|
40
|
+
def self.with_record(record)
|
41
|
+
@record = record
|
42
|
+
yield
|
43
|
+
ensure
|
44
|
+
@record = nil
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.utility
|
48
|
+
return if @record.blank?
|
49
|
+
return unless Decidim::Map.available?(:geocoding)
|
50
|
+
return unless @record.respond_to?(:organization)
|
51
|
+
|
52
|
+
Decidim::Map.geocoding(organization: @record.organization)
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.search(query, options = {})
|
56
|
+
if (util = utility)
|
57
|
+
util.search(query, options.compact)
|
58
|
+
else
|
59
|
+
Geocoder.search(query, options)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
# Make the calculation functions work within the geocoded record, e.g.
|
64
|
+
# `distance_to`.
|
65
|
+
module Calculations
|
66
|
+
extend Geocoder::Calculations
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
# Change the `Geocoder` module reference under the Geocoder::Store::Base
|
71
|
+
# module which initiates the geocoding searches. This allows passing the
|
72
|
+
# geocoding queries through Decidim's own API that configures the geocoder
|
73
|
+
# correctly for each query.
|
74
|
+
#
|
75
|
+
# Overrides this call with the method defined above:
|
76
|
+
# https://git.io/JJEpq
|
77
|
+
::Geocoder::Store::Base.const_set(:Geocoder, RecordGeocoder)
|
78
|
+
end
|
79
|
+
end
|
@@ -43,5 +43,15 @@ module Decidim
|
|
43
43
|
documents.reject(&:attachment_collection_id?)
|
44
44
|
end
|
45
45
|
end
|
46
|
+
|
47
|
+
# Attachment context for the file uploaders checks (e.g. which kind of files
|
48
|
+
# the user is allowed to upload in this context).
|
49
|
+
#
|
50
|
+
# Override this in the model class if it is for a different context.
|
51
|
+
#
|
52
|
+
# Returns a Symbol.
|
53
|
+
def attachment_context
|
54
|
+
:participant
|
55
|
+
end
|
46
56
|
end
|
47
57
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "active_support/concern"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module HasUploadValidations
|
7
|
+
extend ActiveSupport::Concern
|
8
|
+
|
9
|
+
class_methods do
|
10
|
+
def validates_upload(attribute, options = {})
|
11
|
+
max_size = options[:max_size] || ->(record) { record.maximum_upload_size }
|
12
|
+
|
13
|
+
validates(
|
14
|
+
attribute,
|
15
|
+
file_size: { less_than_or_equal_to: max_size },
|
16
|
+
uploader_content_type: true
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
def validates_avatar(attribute = :avatar)
|
21
|
+
validates_upload(
|
22
|
+
attribute,
|
23
|
+
max_size: ->(record) { record.maximum_avatar_size }
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def maximum_upload_size
|
29
|
+
Decidim.organization_settings(organization).upload_maximum_file_size
|
30
|
+
end
|
31
|
+
|
32
|
+
def maximum_avatar_size
|
33
|
+
Decidim.organization_settings(organization).upload_maximum_file_size_avatar
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/lib/decidim/map.rb
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Decidim configuration.
|
4
|
+
module Decidim
|
5
|
+
# A module containing the map functionality for Decidim.
|
6
|
+
module Map
|
7
|
+
autoload :Autocomplete, "decidim/map/autocomplete"
|
8
|
+
autoload :DynamicMap, "decidim/map/dynamic_map"
|
9
|
+
autoload :Geocoding, "decidim/map/geocoding"
|
10
|
+
autoload :Provider, "decidim/map/provider"
|
11
|
+
autoload :StaticMap, "decidim/map/static_map"
|
12
|
+
autoload :Utility, "decidim/map/utility"
|
13
|
+
autoload :Frontend, "decidim/map/frontend"
|
14
|
+
|
15
|
+
# Public: Returns a boolean indicating whether the mapping functionality has
|
16
|
+
# been configured.
|
17
|
+
#
|
18
|
+
# @return [Boolean] A boolean indicating whether the mapping functionality
|
19
|
+
# has been configured.
|
20
|
+
def self.configured?
|
21
|
+
configuration.present?
|
22
|
+
end
|
23
|
+
|
24
|
+
# Public: Returns a boolean indicating if the category of mapping services
|
25
|
+
# is available for this instance that the provided key represents.
|
26
|
+
#
|
27
|
+
# @param *categories [Symbol] The utility category key to check the
|
28
|
+
# availability for.
|
29
|
+
# @return [Boolean] A boolean indicating if the category of mapping services
|
30
|
+
# is available.
|
31
|
+
def self.available?(*categories)
|
32
|
+
categories.all? { |category| utility_class(category).present? }
|
33
|
+
end
|
34
|
+
|
35
|
+
# Public: Returns the full maps configuration hash.
|
36
|
+
#
|
37
|
+
# @return [Hash] The full map functionality configuration hash.
|
38
|
+
def self.configuration
|
39
|
+
Decidim.maps
|
40
|
+
end
|
41
|
+
|
42
|
+
# Public: Creates a new instance of the correct mapping utility class for
|
43
|
+
# the category specified by the key argument.
|
44
|
+
#
|
45
|
+
# @param category [Symbol] The utility category key for the utility to be
|
46
|
+
# created.
|
47
|
+
# @param options [Hash] The options for the utility constructor method.
|
48
|
+
# @return [Decidim::Map::Utility] A new instance of the mapping utility.
|
49
|
+
def self.utility(category, options)
|
50
|
+
return unless (klass = utility_class(category))
|
51
|
+
|
52
|
+
config = utility_configuration(category)
|
53
|
+
options[:config] = config.except(:provider)
|
54
|
+
klass.new(options)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Public: Returns the utility class module namespace for each category of
|
58
|
+
# map utilities. The configured utility class (through Decidim.maps) is
|
59
|
+
# should be under these namespaces.
|
60
|
+
#
|
61
|
+
# @return [Hash<Symbol, Module>] The modules within which the utility
|
62
|
+
# classes should be defined in.
|
63
|
+
def self.utility_modules
|
64
|
+
@utility_modules ||= {}
|
65
|
+
end
|
66
|
+
|
67
|
+
# Public: Registers a new category of map modules.
|
68
|
+
#
|
69
|
+
# @param category [Symbol] The key for the category.
|
70
|
+
# @param mod [Module] The module to be assigned for the category.
|
71
|
+
# @return [Module] The module which was assigned for the category.
|
72
|
+
def self.register_category(category, mod)
|
73
|
+
@utility_modules ||= {}
|
74
|
+
@utility_modules[category] = mod
|
75
|
+
|
76
|
+
# Dynamically define the category method.
|
77
|
+
module_eval %{
|
78
|
+
def self.#{category}(options)
|
79
|
+
utility(:#{category}, options)
|
80
|
+
end
|
81
|
+
}, __FILE__, __LINE__ - 4
|
82
|
+
|
83
|
+
mod
|
84
|
+
end
|
85
|
+
|
86
|
+
# Public: Unregisters the given category of map modules. Mostly used for
|
87
|
+
# testing but there can be also actual use cases for this.
|
88
|
+
#
|
89
|
+
# @param category [Symbol] The key for the category.
|
90
|
+
# @return [Module, nil] The module which was previously assigned for the
|
91
|
+
# category or nil if no module was previously assigned for it.
|
92
|
+
def self.unregister_category(category)
|
93
|
+
return unless @utility_modules
|
94
|
+
|
95
|
+
mod = @utility_modules.delete(category)
|
96
|
+
@utility_configuration.delete(category) if @utility_configuration
|
97
|
+
singleton_class.instance_eval do
|
98
|
+
undef_method(category) if method_defined?(category)
|
99
|
+
end
|
100
|
+
mod
|
101
|
+
end
|
102
|
+
|
103
|
+
# Public: Sets and returns the utility specific configuration hash which
|
104
|
+
# contains the prepared configuration objects for each category of
|
105
|
+
# utilities.
|
106
|
+
#
|
107
|
+
# For example, given the following configuration:
|
108
|
+
# Decidim.configure do |config|
|
109
|
+
# config.maps = {
|
110
|
+
# provider: :osm,
|
111
|
+
# api_key: "apikey",
|
112
|
+
# global_conf: "value",
|
113
|
+
# dynamic: {
|
114
|
+
# tile_layer: {
|
115
|
+
# url: "https://tiles.example.org/{z}/{x}/{y}.png?{foo}",
|
116
|
+
# foo: "bar"
|
117
|
+
# }
|
118
|
+
# },
|
119
|
+
# static: {
|
120
|
+
# url: "https://staticmap.example.org/"
|
121
|
+
# },
|
122
|
+
# geocoding: {
|
123
|
+
# provider: :alternative,
|
124
|
+
# api_key: "gc_apikey",
|
125
|
+
# host: "https://nominatim.example.org/"
|
126
|
+
# }
|
127
|
+
# }
|
128
|
+
# end
|
129
|
+
#
|
130
|
+
# This would result in the following kind of configuration hash returned
|
131
|
+
# by this method:
|
132
|
+
# {
|
133
|
+
# dynamic: {
|
134
|
+
# provider: :osm,
|
135
|
+
# api_key: "apikey",
|
136
|
+
# global_conf: "value",
|
137
|
+
# tile_layer: {
|
138
|
+
# url: "https://tiles.example.org/{z}/{x}/{y}.png?{foo}",
|
139
|
+
# foo: "bar"
|
140
|
+
# }
|
141
|
+
# }
|
142
|
+
# static: {
|
143
|
+
# provider: :osm,
|
144
|
+
# api_key: "apikey",
|
145
|
+
# global_conf: "value",
|
146
|
+
# url: "https://staticmap.example.org/"
|
147
|
+
# }
|
148
|
+
# geocoding: {
|
149
|
+
# provider: :alternative,
|
150
|
+
# api_key: "gc_apikey",
|
151
|
+
# global_conf: "value",
|
152
|
+
# host: "https://nominatim.example.org/"
|
153
|
+
# }
|
154
|
+
# }
|
155
|
+
#
|
156
|
+
# @param category [Symbol, nil] The key of the utility category for which to
|
157
|
+
# fetch the configuration for. When nil, returns the whole configuration
|
158
|
+
# hash.
|
159
|
+
# @return [Hash] The configuration hash.
|
160
|
+
def self.utility_configuration(category = nil)
|
161
|
+
@utility_configuration ||= {}.tap do |config|
|
162
|
+
break {} unless configuration
|
163
|
+
|
164
|
+
global_config = configuration.except(*utility_modules.keys)
|
165
|
+
utility_modules.keys.each do |key|
|
166
|
+
utility_config = configuration.fetch(key, {})
|
167
|
+
next if utility_config == false
|
168
|
+
|
169
|
+
unless utility_config.is_a?(Hash)
|
170
|
+
config[key] = global_config
|
171
|
+
next
|
172
|
+
end
|
173
|
+
|
174
|
+
config[key] = global_config.merge(utility_config)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
return @utility_configuration[category] if category
|
178
|
+
|
179
|
+
@utility_configuration
|
180
|
+
end
|
181
|
+
|
182
|
+
# Public: Resets the utility configuration to its initial state so that it
|
183
|
+
# is reloaded when utility_configuration is called the next time. It should
|
184
|
+
# not be necessary to call this ever but it is useful for the tests as the
|
185
|
+
# configurations can change.
|
186
|
+
#
|
187
|
+
# @return [nil]
|
188
|
+
def self.reset_utility_configuration!
|
189
|
+
@utility_configuration = nil
|
190
|
+
end
|
191
|
+
|
192
|
+
# Public: Returns the full utility class name in the correct module
|
193
|
+
# namespace for the given utility category. For example, if the provider
|
194
|
+
# :osm is configured for the :dynamic utilities, the utility class returned
|
195
|
+
# by this method is `Decidim::Map::Provider::DynamicMap::Osm`.
|
196
|
+
#
|
197
|
+
# @param category [Symbol] The category of utilities. E.g. `:dynamic`.
|
198
|
+
# @return [Class] The configured mapping service provider key.
|
199
|
+
def self.utility_class(category)
|
200
|
+
return unless (ns = utility_modules[category])
|
201
|
+
|
202
|
+
config = utility_configuration(category)
|
203
|
+
return if config.blank?
|
204
|
+
return unless (key = config[:provider])
|
205
|
+
|
206
|
+
# Define the last part of the class name from the category provider's key,
|
207
|
+
# e.g. by turning `:osm` to "Osm" or `:some_service` to "SomeService".
|
208
|
+
subclass_name = key.to_s.camelize
|
209
|
+
return unless ns.const_defined?(subclass_name)
|
210
|
+
|
211
|
+
ns.const_get(subclass_name)
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|