decidim-core 0.20.0 → 0.23.1.rc1
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 +8 -0
- data/app/assets/fonts/decidim/Roboto-Regular.eot +0 -0
- data/app/assets/fonts/decidim/Roboto-Regular.svg +1 -0
- data/app/assets/fonts/decidim/Roboto-Regular.ttf +0 -0
- data/app/assets/fonts/decidim/Roboto-Regular.woff +0 -0
- data/app/assets/fonts/decidim/Roboto-Regular.woff2 +0 -0
- data/app/assets/fonts/decidim/Source_Sans_Pro_400.svg +1 -345
- data/app/assets/fonts/decidim/Source_Sans_Pro_600.svg +1 -339
- data/app/assets/fonts/decidim/Source_Sans_Pro_900.svg +1 -342
- data/app/assets/images/decidim/avatar-multiuser.png +0 -0
- data/app/assets/images/decidim/brands/google.svg +1 -0
- data/app/assets/images/decidim/decidim-logo.svg +1 -71
- data/app/assets/images/decidim/default-avatar.svg +1 -14
- data/app/assets/images/decidim/gamification/badges/followers.svg +1 -115
- data/app/assets/images/decidim/gamification/badges/invitations.svg +1 -117
- data/app/assets/images/decidim/icons.svg +1 -259
- data/app/assets/images/decidim/placeholder.jpg +0 -0
- data/app/assets/javascripts/decidim.js.es6 +30 -1
- data/app/assets/javascripts/decidim/ajax_modals.js.es6 +6 -3
- data/app/assets/javascripts/decidim/assets.js.erb +5 -0
- data/app/assets/javascripts/decidim/callout.js.es6 +18 -0
- data/app/assets/javascripts/decidim/check_boxes_tree.js.es6 +190 -0
- data/app/assets/javascripts/decidim/configuration.js.es6 +23 -0
- data/app/assets/javascripts/decidim/confirm.js.es6 +179 -0
- data/app/assets/javascripts/decidim/conversations.js.es6 +17 -0
- 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/core/extrapoly.js +6 -0
- data/app/assets/javascripts/decidim/data_picker.js.es6 +128 -50
- data/app/assets/javascripts/decidim/delayed.js.es6 +26 -0
- data/app/assets/javascripts/decidim/diff_mode_dropdown.js.es6 +39 -6
- data/app/assets/javascripts/decidim/dropdowns_menus.js.es6 +32 -0
- data/app/assets/javascripts/decidim/editor.js.es6 +3 -3
- data/app/assets/javascripts/decidim/external_link.js.es6 +69 -0
- data/app/assets/javascripts/decidim/floating_help.js.es6 +7 -0
- data/app/assets/javascripts/decidim/form_filter.component.js.es6 +87 -39
- data/app/assets/javascripts/decidim/form_filter.component.test.js +43 -9
- data/app/assets/javascripts/decidim/form_validator.es6 +61 -0
- data/app/assets/javascripts/decidim/foundation.js.es6 +28 -28
- 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/history.js.es6 +16 -1
- data/app/assets/javascripts/decidim/icon.js.es6 +42 -0
- data/app/assets/javascripts/decidim/identity_selector_dialog.js.es6 +61 -0
- data/app/assets/javascripts/decidim/input_character_counter.js.es6 +115 -0
- data/app/assets/javascripts/decidim/input_mentions.js.es6 +34 -9
- data/app/assets/javascripts/decidim/input_multiple_mentions.js.es6 +195 -0
- data/app/assets/javascripts/decidim/map.js.es6 +35 -84
- 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/orders.js.es6 +9 -28
- data/app/assets/javascripts/decidim/responsive_horizontal_tabs.js.es6 +12 -0
- data/app/assets/javascripts/decidim/results_listing.js.es6 +44 -0
- data/app/assets/javascripts/decidim/security/selfxss_warning.js.es6 +19 -0
- data/app/assets/javascripts/decidim/start_conversation_dialog.js +13 -0
- data/app/assets/javascripts/decidim/vizzs.js.es6 +1 -0
- data/app/assets/stylesheets/decidim/_decidim-settings.scss +5 -0
- data/app/assets/stylesheets/decidim/_decidim.scss +15 -11
- data/app/assets/stylesheets/decidim/_properties.scss +25 -0
- data/app/assets/stylesheets/decidim/_variables.scss +7 -25
- data/app/assets/stylesheets/decidim/application.scss.erb +2 -2
- data/app/assets/stylesheets/decidim/editor.scss +2 -2
- data/app/assets/stylesheets/decidim/email.scss +1771 -0
- data/app/assets/stylesheets/decidim/extras/_external-links.scss +29 -0
- data/app/assets/stylesheets/decidim/extras/_extras.scss +17 -0
- data/app/assets/stylesheets/decidim/extras/_label-required.scss +9 -0
- data/app/assets/stylesheets/decidim/extras/_process_stats.scss +1 -1
- data/app/assets/stylesheets/decidim/extras/_quill.scss +5 -0
- data/app/assets/stylesheets/decidim/extras/_results-per-page.scss +8 -1
- data/app/assets/stylesheets/decidim/layouts/_home.scss +31 -7
- data/app/assets/stylesheets/decidim/layouts/_layouts.scss +5 -0
- data/app/assets/stylesheets/decidim/layouts/_logo.scss +26 -0
- data/app/assets/stylesheets/decidim/layouts/_user.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_author-avatar.scss +9 -13
- data/app/assets/stylesheets/decidim/modules/_buttons.scss +273 -28
- data/app/assets/stylesheets/decidim/modules/_cards.scss +189 -23
- data/app/assets/stylesheets/decidim/modules/_collapsible-list.scss +21 -0
- data/app/assets/stylesheets/decidim/modules/_comments.scss +102 -2
- data/app/assets/stylesheets/decidim/modules/_conference-programme.scss +0 -1
- data/app/assets/stylesheets/decidim/modules/_confirm.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_conversation.scss +50 -0
- data/app/assets/stylesheets/decidim/modules/_data-picker.scss +9 -11
- data/app/assets/stylesheets/decidim/modules/_definition-data.scss +6 -1
- data/app/assets/stylesheets/decidim/modules/_docs-manager.scss +0 -1
- data/app/assets/stylesheets/decidim/modules/_extra.scss +0 -2
- data/app/assets/stylesheets/decidim/modules/_filters.scss +61 -3
- data/app/assets/stylesheets/decidim/modules/_floating-helper.scss +20 -8
- data/app/assets/stylesheets/decidim/modules/_footer.scss +8 -4
- data/app/assets/stylesheets/decidim/modules/_forms.scss +77 -4
- data/app/assets/stylesheets/decidim/modules/_horizontal-tabs.scss +64 -1
- data/app/assets/stylesheets/decidim/modules/_inline-filters.scss +6 -3
- data/app/assets/stylesheets/decidim/modules/_input-gallery.scss +10 -0
- data/app/assets/stylesheets/decidim/modules/_input-mentions.scss +25 -7
- data/app/assets/stylesheets/decidim/modules/_input-multiple-mentions.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_layout.scss +21 -0
- data/app/assets/stylesheets/decidim/modules/_map.scss +46 -0
- data/app/assets/stylesheets/decidim/modules/_margins.scss +8 -7
- data/app/assets/stylesheets/decidim/modules/_messages.scss +18 -18
- data/app/assets/stylesheets/decidim/modules/_modules.scss +75 -71
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +187 -31
- data/app/assets/stylesheets/decidim/modules/_notification.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_order-by.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_process-nav.scss +5 -2
- data/app/assets/stylesheets/decidim/modules/_process-phase.scss +2 -4
- data/app/assets/stylesheets/decidim/modules/_process-stats.scss +53 -0
- data/app/assets/stylesheets/decidim/modules/_progress-bar.scss +5 -1
- data/app/assets/stylesheets/decidim/modules/_reveal.scss +11 -0
- data/app/assets/stylesheets/decidim/modules/_signup.scss +6 -5
- data/app/assets/stylesheets/decidim/modules/_static-pages.scss +0 -1
- data/app/assets/stylesheets/decidim/modules/_status-labels.scss +7 -1
- data/app/assets/stylesheets/decidim/modules/_sticky.scss +5 -0
- data/app/assets/stylesheets/decidim/modules/_tags.scss +11 -1
- data/app/assets/stylesheets/decidim/modules/_timeline.scss +1 -2
- data/app/assets/stylesheets/decidim/modules/_typography.scss +94 -10
- data/app/assets/stylesheets/decidim/modules/_versions.scss +0 -1
- data/app/assets/stylesheets/decidim/utils/_fontface.scss +10 -0
- data/app/assets/stylesheets/decidim/utils/_helpers.scss +8 -0
- data/app/assets/stylesheets/decidim/utils/_mixins.scss +86 -7
- data/app/assets/stylesheets/decidim/utils/_settings.scss +81 -69
- data/app/assets/stylesheets/decidim/utils/_toggle-expand.scss +14 -0
- data/app/assets/stylesheets/decidim/vizzs.scss +8 -0
- data/app/assets/stylesheets/decidim/vizzs/_areachart.scss +0 -1
- data/app/assets/stylesheets/decidim/vizzs/_linechart.scss +0 -1
- data/app/assets/stylesheets/decidim/vizzs/_rowchart.scss +0 -1
- data/app/assets/stylesheets/decidim/vizzs/_vizzs.scss +5 -0
- data/app/assets/stylesheets/foundation-overrides/components/_button-group.scss +319 -0
- data/app/cells/decidim/activity/show.erb +24 -21
- data/app/cells/decidim/activity_cell.rb +2 -0
- data/app/cells/decidim/address_cell.rb +1 -1
- data/app/cells/decidim/amendable/amend_button_card_cell.rb +1 -5
- data/app/cells/decidim/amendable/promote_button_card_cell.rb +1 -1
- data/app/cells/decidim/announcement/show.erb +1 -1
- data/app/cells/decidim/author/comments.erb +1 -1
- data/app/cells/decidim/author/endorsements.erb +6 -0
- data/app/cells/decidim/author/flag.erb +6 -3
- data/app/cells/decidim/author/profile_inline.erb +3 -4
- data/app/cells/decidim/author/show.erb +2 -0
- data/app/cells/decidim/author/withdraw.erb +2 -2
- data/app/cells/decidim/author_cell.rb +12 -13
- data/app/cells/decidim/badge/show.erb +6 -6
- data/app/cells/decidim/badge/small.erb +2 -1
- data/app/cells/decidim/card/show.erb +4 -4
- data/app/cells/decidim/card_cell.rb +21 -7
- data/app/cells/decidim/card_m/comments_counter.erb +1 -1
- data/app/cells/decidim/card_m/header.erb +4 -4
- data/app/cells/decidim/card_m/image.erb +1 -1
- data/app/cells/decidim/card_m/show.erb +3 -3
- data/app/cells/decidim/card_m_cell.rb +9 -6
- data/app/cells/decidim/collapsible_authors_cell.rb +1 -1
- data/app/cells/decidim/collapsible_list/show.erb +3 -3
- data/app/cells/decidim/content_blocks/footer_sub_hero/show.erb +4 -4
- data/app/cells/decidim/content_blocks/hero_settings_form/show.erb +2 -2
- data/app/cells/decidim/content_blocks/how_to_participate/show.erb +8 -8
- data/app/cells/decidim/content_blocks/last_activity_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/stats/show.erb +1 -1
- data/app/cells/decidim/content_blocks/sub_hero/show.erb +3 -3
- data/app/cells/decidim/diff/attribute.erb +15 -5
- data/app/cells/decidim/diff/diff_mode_html.erb +31 -0
- data/app/cells/decidim/diff/diff_split.erb +1 -1
- data/app/cells/decidim/diff/diff_unified.erb +1 -1
- data/app/cells/decidim/diff/show.erb +1 -0
- data/app/cells/decidim/diff_cell.rb +32 -9
- data/app/cells/decidim/endorsement_buttons/select_identity_button.erb +10 -0
- data/app/cells/decidim/endorsement_buttons/show.erb +4 -0
- data/app/cells/decidim/endorsement_buttons_cell.rb +208 -0
- data/app/cells/decidim/endorsers_list/show.erb +16 -0
- data/app/cells/decidim/endorsers_list_cell.rb +29 -0
- data/app/cells/decidim/fingerprint_cell.rb +1 -0
- data/app/cells/decidim/follow_button/show.erb +29 -8
- data/app/cells/decidim/follow_button_cell.rb +37 -5
- data/app/cells/decidim/navbar_admin_link/show.erb +6 -0
- data/app/cells/decidim/navbar_admin_link_cell.rb +49 -0
- data/app/cells/decidim/newsletter_templates/base_cell.rb +30 -0
- data/app/cells/decidim/newsletter_templates/base_settings_form_cell.rb +13 -0
- data/app/cells/decidim/newsletter_templates/basic_only_text/show.erb +86 -0
- data/app/cells/decidim/newsletter_templates/basic_only_text_cell.rb +21 -0
- data/app/cells/decidim/newsletter_templates/basic_only_text_settings_form/show.erb +7 -0
- data/app/cells/decidim/newsletter_templates/basic_only_text_settings_form_cell.rb +8 -0
- data/app/cells/decidim/newsletter_templates/image_text_cta/show.erb +125 -0
- data/app/cells/decidim/newsletter_templates/image_text_cta_cell.rb +61 -0
- data/app/cells/decidim/newsletter_templates/image_text_cta_settings_form/show.erb +17 -0
- data/app/cells/decidim/newsletter_templates/image_text_cta_settings_form_cell.rb +8 -0
- data/app/cells/decidim/notifications/show.erb +1 -1
- data/app/cells/decidim/profile/show.erb +2 -2
- data/app/cells/decidim/profile/user_group_tabs.erb +10 -5
- data/app/cells/decidim/profile/user_tabs.erb +16 -14
- data/app/cells/decidim/profile_cell.rb +18 -0
- data/app/cells/decidim/profile_sidebar/show.erb +16 -16
- data/app/cells/decidim/profile_sidebar_cell.rb +1 -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/search_results_section/show.erb +1 -1
- data/app/cells/decidim/tags_cell.rb +34 -4
- data/app/cells/decidim/translation_bar/show.erb +6 -0
- data/app/cells/decidim/translation_bar_cell.rb +52 -0
- data/app/cells/decidim/user_activity/show.erb +19 -1
- data/app/cells/decidim/user_activity_cell.rb +6 -0
- data/app/cells/decidim/user_conversation/conversation_header.erb +14 -0
- data/app/cells/decidim/user_conversation/messages.erb +15 -0
- data/app/cells/decidim/user_conversation/new.erb +15 -0
- data/app/cells/decidim/user_conversation/reply.erb +17 -0
- data/app/cells/decidim/user_conversation/show.erb +20 -0
- data/app/cells/decidim/user_conversation_cell.rb +75 -0
- data/app/cells/decidim/user_conversations/add_conversation_users.erb +25 -0
- data/app/cells/decidim/user_conversations/conversation_item.erb +38 -0
- data/app/cells/decidim/user_conversations/show.erb +58 -0
- data/app/cells/decidim/user_conversations_cell.rb +40 -0
- data/app/cells/decidim/user_group_admin_membership_profile/footer.erb +3 -3
- data/app/cells/decidim/user_profile/footer.erb +1 -1
- data/app/cells/decidim/user_profile/unlinked_user_data.erb +16 -0
- data/app/cells/decidim/user_profile/user_data.erb +1 -1
- data/app/cells/decidim/user_profile_cell.rb +7 -1
- data/app/cells/decidim/user_timeline_cell.rb +4 -0
- data/app/cells/decidim/version/show.erb +31 -0
- data/app/{views/decidim/shared/_version_author.html.erb → cells/decidim/version_author/show.erb} +1 -1
- data/app/cells/decidim/version_author_cell.rb +9 -0
- data/app/cells/decidim/version_cell.rb +83 -0
- data/app/cells/decidim/versions_list/show.erb +32 -0
- data/app/cells/decidim/versions_list_cell.rb +64 -0
- data/app/cells/decidim/versions_list_item/show.erb +20 -0
- data/app/cells/decidim/versions_list_item_cell.rb +51 -0
- data/app/cells/decidim/wizard_step_form/wizard_aside.erb +1 -1
- data/app/cells/decidim/wizard_step_form/wizard_header.erb +2 -2
- data/app/cells/decidim/wizard_step_form_cell.rb +4 -1
- data/app/commands/decidim/amendable/accept.rb +18 -7
- data/app/commands/decidim/amendable/create_draft.rb +2 -0
- data/app/commands/decidim/amendable/publish_draft.rb +5 -0
- data/app/commands/decidim/amendable/reject.rb +5 -0
- data/app/commands/decidim/amendable/update_draft.rb +2 -0
- data/app/commands/decidim/amendable/withdraw.rb +3 -12
- data/app/commands/decidim/attachment_methods.rb +47 -0
- data/app/commands/decidim/create_registration.rb +7 -7
- data/app/commands/decidim/create_user_group.rb +12 -0
- data/app/commands/decidim/destroy_account.rb +13 -0
- data/app/commands/decidim/endorse_resource.rb +64 -0
- data/app/commands/decidim/gallery_methods.rb +71 -0
- data/app/commands/decidim/invite_user_again.rb +2 -4
- data/app/commands/decidim/messaging/reply_to_conversation.rb +35 -4
- data/app/commands/decidim/messaging/start_conversation.rb +36 -5
- data/app/commands/decidim/multiple_attachments_methods.rb +56 -0
- data/app/commands/decidim/unendorse_resource.rb +38 -0
- data/app/commands/decidim/update_notifications_settings.rb +1 -0
- data/app/commands/decidim/update_user_group.rb +14 -1
- 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 +14 -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/resource_versions_concern.rb +28 -0
- data/app/controllers/concerns/decidim/use_organization_time_zone.rb +32 -0
- data/app/controllers/concerns/decidim/withdrawable.rb +20 -0
- data/app/controllers/decidim/application_controller.rb +19 -0
- data/app/controllers/decidim/components/base_controller.rb +7 -1
- data/app/controllers/decidim/cookie_policy_controller.rb +6 -3
- data/app/controllers/decidim/data_portability_controller.rb +12 -19
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +1 -1
- data/app/controllers/decidim/devise/registrations_controller.rb +3 -4
- data/app/controllers/decidim/devise/sessions_controller.rb +5 -0
- data/app/controllers/decidim/endorsements_controller.rb +71 -0
- data/app/controllers/decidim/messaging/conversations_controller.rb +57 -14
- data/app/controllers/decidim/newsletters_controller.rb +2 -2
- data/app/controllers/decidim/profiles_controller.rb +6 -0
- data/app/controllers/decidim/scopes_controller.rb +42 -7
- data/app/controllers/decidim/user_activities_controller.rb +19 -2
- data/app/controllers/decidim/user_conversations_controller.rb +142 -0
- data/app/controllers/decidim/user_timeline_controller.rb +19 -2
- data/app/events/decidim/resource_endorsed_event.rb +35 -0
- data/app/events/decidim/user_group_admin_event.rb +37 -0
- data/app/events/decidim/user_group_created_event.rb +6 -0
- data/app/events/decidim/user_group_updated_event.rb +6 -0
- 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 +5 -0
- data/app/forms/decidim/messaging/conversation_form.rb +10 -4
- data/app/forms/decidim/notifications_settings_form.rb +6 -0
- data/app/forms/decidim/registration_form.rb +6 -0
- data/app/forms/decidim/user_group_form.rb +5 -1
- data/app/functions/decidim/core/component_finder_base.rb +40 -0
- data/app/functions/decidim/core/component_list.rb +38 -0
- data/app/functions/decidim/core/component_list_base.rb +67 -0
- data/app/functions/decidim/core/needs_api_filter_and_order.rb +52 -0
- data/app/functions/decidim/core/participatory_space_finder.rb +11 -0
- data/app/functions/decidim/core/participatory_space_finder_base.rb +29 -0
- data/app/functions/decidim/core/participatory_space_list.rb +11 -0
- data/app/functions/decidim/core/participatory_space_list_base.rb +34 -0
- data/app/functions/decidim/core/user_entity_finder.rb +33 -0
- data/app/functions/decidim/core/user_entity_list.rb +31 -0
- data/app/helpers/concerns/decidim/flash_helper_extensions.rb +47 -0
- data/app/helpers/decidim/action_authorization_helper.rb +24 -2
- data/app/helpers/decidim/amendments_helper.rb +29 -1
- data/app/helpers/decidim/application_helper.rb +38 -4
- data/app/helpers/decidim/categories_helper.rb +26 -0
- data/app/helpers/decidim/cells_helper.rb +3 -15
- data/app/helpers/decidim/check_boxes_tree_helper.rb +123 -0
- data/app/helpers/decidim/cookies_helper.rb +1 -1
- data/app/helpers/decidim/cta_button_helper.rb +1 -1
- data/app/helpers/decidim/decidim_form_helper.rb +24 -1
- data/app/helpers/decidim/endorsable_helper.rb +93 -0
- data/app/helpers/decidim/filter_params_helper.rb +30 -0
- data/app/helpers/decidim/filters_helper.rb +15 -5
- data/app/helpers/decidim/followable_helper.rb +11 -0
- data/app/helpers/decidim/layout_helper.rb +23 -5
- data/app/helpers/decidim/map_helper.rb +100 -17
- data/app/helpers/decidim/markup_helper.rb +9 -0
- data/app/helpers/decidim/messaging/conversation_helper.rb +61 -7
- data/app/helpers/decidim/omniauth_helper.rb +6 -13
- data/app/helpers/decidim/orders_helper.rb +15 -1
- data/app/helpers/decidim/paginate_helper.rb +3 -1
- data/app/helpers/decidim/participatory_space_helpers.rb +1 -1
- data/app/helpers/decidim/resource_versions_helper.rb +46 -0
- data/app/helpers/decidim/rich_text_editor_helper.rb +23 -0
- data/app/helpers/decidim/sanitize_helper.rb +13 -3
- data/app/helpers/decidim/scopes_helper.rb +7 -6
- data/app/helpers/decidim/tooltip_helper.rb +1 -1
- data/app/helpers/decidim/traceability_helper.rb +2 -8
- data/app/helpers/decidim/translations_helper.rb +7 -1
- data/app/helpers/decidim/user_profile_helper.rb +1 -1
- data/app/helpers/decidim/widget_urls_helper.rb +4 -2
- data/app/jobs/decidim/data_portability_export_job.rb +18 -10
- data/app/jobs/decidim/event_publisher_job.rb +1 -1
- data/app/jobs/decidim/export_job.rb +1 -1
- 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/mailers/concerns/decidim/multitenant_asset_host.rb +33 -0
- data/app/mailers/decidim/application_mailer.rb +1 -0
- data/app/mailers/decidim/export_mailer.rb +9 -5
- data/app/mailers/decidim/messaging/conversation_mailer.rb +53 -4
- data/app/mailers/decidim/newsletter_mailer.rb +22 -4
- data/app/mailers/decidim/reported_mailer.rb +8 -1
- data/app/middleware/decidim/strip_x_forwarded_host.rb +14 -0
- data/app/models/decidim/action_log.rb +2 -2
- data/app/models/decidim/amendment.rb +0 -18
- 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 +27 -0
- data/app/models/decidim/category.rb +4 -0
- data/app/models/decidim/component.rb +14 -0
- data/app/models/decidim/content_block.rb +16 -4
- data/app/models/decidim/contextual_help_section.rb +4 -0
- data/app/models/decidim/endorsement.rb +30 -0
- data/app/models/decidim/follow.rb +3 -1
- data/app/models/decidim/messaging/conversation.rb +39 -11
- data/app/models/decidim/messaging/message.rb +32 -6
- data/app/models/decidim/messaging/participation.rb +1 -1
- data/app/models/decidim/messaging/receipt.rb +8 -0
- data/app/models/decidim/moderation.rb +1 -1
- data/app/models/decidim/newsletter.rb +10 -1
- data/app/models/decidim/oauth_application.rb +2 -0
- data/app/models/decidim/omniauth_provider.rb +28 -0
- data/app/models/decidim/organization.rb +94 -0
- data/app/models/decidim/participatory_space_role_config/admin.rb +8 -0
- data/app/models/decidim/participatory_space_role_config/base.rb +31 -0
- data/app/models/decidim/participatory_space_role_config/collaborator.rb +8 -0
- data/app/models/decidim/participatory_space_role_config/moderator.rb +11 -0
- data/app/models/decidim/participatory_space_role_config/null_object.rb +11 -0
- data/app/models/decidim/participatory_space_role_config/participatory_space_admin.rb +8 -0
- data/app/models/decidim/participatory_space_role_config/valuator.rb +11 -0
- data/app/models/decidim/scope.rb +8 -3
- 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 +51 -3
- data/app/models/decidim/user_base_entity.rb +6 -2
- data/app/models/decidim/user_group.rb +23 -0
- data/app/permissions/decidim/permissions.rb +28 -6
- data/app/presenters/decidim/admin_log/user_presenter.rb +1 -1
- data/app/presenters/decidim/home_stats_presenter.rb +5 -2
- data/app/presenters/decidim/log/base_presenter.rb +1 -1
- data/app/presenters/decidim/log/value_types/default_presenter.rb +1 -1
- data/app/presenters/decidim/metric_charts_presenter.rb +33 -13
- data/app/presenters/decidim/nil_presenter.rb +29 -0
- data/app/presenters/decidim/official_author_presenter.rb +36 -0
- data/app/presenters/decidim/resource_locator_presenter.rb +71 -10
- data/app/presenters/decidim/user_group_presenter.rb +1 -1
- data/app/presenters/decidim/user_presenter.rb +6 -0
- data/app/queries/decidim/metric_manage.rb +5 -0
- data/app/queries/decidim/metrics/followers_metric_manage.rb +1 -6
- data/app/queries/decidim/similar_emendations.rb +4 -4
- data/app/queries/decidim/user_groups/admin_memberships.rb +3 -3
- data/app/scrubbers/decidim/user_input_scrubber.rb +1 -1
- data/app/serializers/decidim/exporters/participatory_space_components_serializer.rb +1 -1
- data/app/serializers/decidim/importers/participatory_space_components_importer.rb +14 -5
- data/app/services/decidim/activity_search.rb +1 -0
- data/app/services/decidim/base_diff_renderer.rb +42 -3
- data/app/services/decidim/data_portability_exporter.rb +72 -0
- data/app/services/decidim/events_manager.rb +4 -1
- data/app/services/decidim/open_data_exporter.rb +2 -0
- data/app/services/decidim/resource_search.rb +122 -17
- data/app/services/decidim/static_map_generator.rb +10 -21
- data/app/services/decidim/zip_stream/zip_stream_writer.rb +56 -0
- data/app/types/decidim/core/amendment_type.rb +26 -0
- data/app/types/decidim/core/area_api_type.rb +16 -0
- data/app/types/decidim/core/area_type_type.rb +14 -0
- data/app/types/decidim/core/base_input_filter.rb +8 -0
- data/app/types/decidim/core/base_input_sort.rb +22 -0
- data/app/types/decidim/core/component_input_filter.rb +50 -0
- data/app/types/decidim/core/component_input_sort.rb +32 -0
- data/app/types/decidim/core/decidim_type.rb +0 -4
- data/app/types/decidim/core/fingerprint_type.rb +15 -0
- data/app/types/decidim/core/has_endorsable_input_sort.rb +17 -0
- data/app/types/decidim/core/has_hastaggable_input_filter.rb +15 -0
- data/app/types/decidim/core/has_localized_input_filter.rb +21 -0
- data/app/types/decidim/core/has_localized_input_sort.rb +21 -0
- data/app/types/decidim/core/has_publishable_input_filter.rb +34 -0
- data/app/types/decidim/core/has_publishable_input_sort.rb +13 -0
- data/app/types/decidim/core/has_timestamp_input_filter.rb +52 -0
- data/app/types/decidim/core/has_timestamp_input_sort.rb +12 -0
- data/app/types/decidim/core/participatory_space_input_filter.rb +26 -0
- data/app/types/decidim/core/participatory_space_input_sort.rb +14 -0
- data/app/types/decidim/core/participatory_space_link_type.rb +24 -0
- data/app/types/decidim/core/trace_version_type.rb +29 -0
- data/app/types/decidim/core/user_entity_input_filter.rb +81 -0
- data/app/types/decidim/core/user_entity_input_sort.rb +24 -0
- data/app/types/decidim/core/user_group_type.rb +17 -5
- data/app/types/decidim/core/user_type.rb +17 -6
- data/app/uploaders/decidim/application_uploader.rb +15 -1
- data/app/uploaders/decidim/attachment_uploader.rb +23 -17
- data/app/uploaders/decidim/avatar_uploader.rb +4 -0
- data/app/uploaders/decidim/banner_image_uploader.rb +1 -1
- data/app/uploaders/decidim/data_portability_uploader.rb +2 -7
- 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 +34 -6
- data/app/uploaders/decidim/newsletter_template_image_uploader.rb +36 -0
- 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/time_zone_validator.rb +10 -0
- data/app/validators/uploader_content_type_validator.rb +44 -0
- data/app/views/decidim/account/delete.html.erb +6 -3
- data/app/views/decidim/account/show.html.erb +17 -10
- data/app/views/decidim/amendments/_edit_form_fields.html.erb +7 -13
- data/app/views/decidim/amendments/_similar_emendation.html.erb +4 -4
- data/app/views/decidim/amendments/compare_draft.html.erb +2 -2
- data/app/views/decidim/amendments/edit_draft.html.erb +2 -2
- data/app/views/decidim/amendments/new.html.erb +2 -2
- data/app/views/decidim/amendments/preview_draft.html.erb +3 -3
- data/app/views/decidim/amendments/review.html.erb +3 -3
- data/app/views/decidim/application/_collection.html.erb +2 -2
- data/app/views/decidim/application/_document.html.erb +4 -4
- data/app/views/decidim/application/_documents.html.erb +1 -1
- data/app/views/decidim/application/_photos.html.erb +1 -1
- data/app/views/decidim/authorization_modals/_content.html.erb +2 -2
- data/app/views/decidim/authorization_modals/show.html.erb +1 -1
- data/app/views/decidim/data_portability/show.html.erb +3 -0
- data/app/views/decidim/devise/confirmations/new.html.erb +3 -3
- data/app/views/decidim/devise/invitations/edit.html.erb +13 -13
- data/app/views/decidim/devise/omniauth_registrations/new.html.erb +5 -3
- data/app/views/decidim/devise/passwords/edit.html.erb +5 -3
- data/app/views/decidim/devise/passwords/new.html.erb +3 -3
- data/app/views/decidim/devise/registrations/edit.html.erb +2 -1
- data/app/views/decidim/devise/registrations/new.html.erb +10 -9
- data/app/views/decidim/devise/sessions/new.html.erb +7 -7
- data/app/views/decidim/devise/shared/_newsletter_modal.html.erb +3 -3
- data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +11 -11
- data/app/views/decidim/devise/shared/_omniauth_buttons_mini.html.erb +9 -8
- data/app/views/decidim/devise/unlocks/new.html.erb +3 -3
- data/app/views/decidim/doorkeeper/authorizations/new.html.erb +2 -2
- data/app/views/decidim/endorsements/_identity.html.erb +9 -0
- data/app/views/decidim/endorsements/identities.html.erb +12 -0
- data/app/views/decidim/endorsements/update_buttons_and_counters.js.erb +20 -0
- data/app/views/decidim/errors/internal_server_error.html.erb +2 -2
- data/app/views/decidim/errors/not_found.html.erb +2 -2
- data/app/views/decidim/export_mailer/data_portability_export.html.erb +2 -2
- data/app/views/decidim/gamification/badges/index.html.erb +4 -4
- data/app/views/decidim/group_admins/index.html.erb +6 -4
- data/app/views/decidim/group_invites/index.html.erb +5 -2
- data/app/views/decidim/group_members/index.html.erb +6 -4
- data/app/views/decidim/groups/_form.html.erb +2 -0
- data/app/views/decidim/groups/edit.html.erb +4 -2
- data/app/views/decidim/groups/new.html.erb +2 -2
- data/app/views/decidim/last_activities/index.html.erb +2 -0
- data/app/views/decidim/messaging/conversation_mailer/comanagers_new_conversation.html.erb +17 -0
- data/app/views/decidim/messaging/conversation_mailer/comanagers_new_message.html.erb +17 -0
- data/app/views/decidim/messaging/conversation_mailer/new_conversation.html.erb +2 -2
- data/app/views/decidim/messaging/conversation_mailer/new_group_conversation.html.erb +17 -0
- data/app/views/decidim/messaging/conversation_mailer/new_group_message.html.erb +17 -0
- data/app/views/decidim/messaging/conversation_mailer/new_message.html.erb +2 -2
- data/app/views/decidim/messaging/conversations/_add_conversation_users.html.erb +24 -0
- data/app/views/decidim/messaging/conversations/_conversation.html.erb +54 -0
- data/app/views/decidim/messaging/conversations/_error_modal.html.erb +21 -0
- data/app/views/decidim/messaging/conversations/_messages.html.erb +15 -0
- data/app/views/decidim/messaging/conversations/_new_conversation_button.html.erb +33 -0
- data/app/views/decidim/messaging/conversations/_reply.html.erb +3 -3
- data/app/views/decidim/messaging/conversations/_show.html.erb +34 -15
- data/app/views/decidim/messaging/conversations/_start.html.erb +7 -1
- data/app/views/decidim/messaging/conversations/create.js.erb +1 -1
- data/app/views/decidim/messaging/conversations/error.js.erb +10 -0
- data/app/views/decidim/messaging/conversations/index.html.erb +34 -29
- data/app/views/decidim/messaging/conversations/new.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/show.html.erb +8 -4
- data/app/views/decidim/messaging/conversations/update.js.erb +1 -1
- data/app/views/decidim/newsletter_mailer/newsletter.html.erb +2 -2
- data/app/views/decidim/newsletters/show.html.erb +8 -1
- data/app/views/decidim/notification_mailer/event_received.html.erb +2 -2
- data/app/views/decidim/notifications/index.html.erb +4 -2
- data/app/views/decidim/notifications_settings/show.html.erb +14 -1
- data/app/views/decidim/own_user_groups/index.html.erb +4 -0
- data/app/views/decidim/pages/_standalone.html.erb +1 -1
- data/app/views/decidim/pages/_tabbed.html.erb +5 -5
- data/app/views/decidim/pages/index.html.erb +22 -13
- data/app/views/decidim/profiles/_user_follow.erb +3 -3
- data/app/views/decidim/profiles/show.html.erb +2 -0
- data/app/views/decidim/reported_mailer/report.html.erb +49 -3
- data/app/views/decidim/scopes/_scopes_picker_input.html.erb +15 -7
- data/app/views/decidim/scopes/picker.html.erb +31 -17
- data/app/views/decidim/searches/_count.html.erb +14 -11
- data/app/views/decidim/searches/_filters.html.erb +3 -2
- data/app/views/decidim/searches/index.html.erb +5 -3
- data/app/views/decidim/shared/_check_boxes_tree.html.erb +56 -0
- data/app/views/decidim/shared/_confirm_modal.html.erb +18 -0
- data/app/views/decidim/shared/_embed_modal.html.erb +4 -1
- data/app/views/decidim/shared/_extended_navigation_bar.html.erb +3 -3
- data/app/views/decidim/shared/_filter_form_help.erb +8 -0
- data/app/views/decidim/shared/_floating_help.html.erb +7 -7
- data/app/views/decidim/shared/_login_modal.html.erb +17 -6
- data/app/views/decidim/shared/_orders.html.erb +16 -5
- data/app/views/decidim/shared/_results_per_page.html.erb +16 -6
- data/app/views/decidim/shared/_share_modal.html.erb +8 -4
- data/app/views/decidim/shared/_static_map.html.erb +2 -2
- data/app/views/decidim/shared/participatory_space_filters/_filters.html.erb +1 -1
- data/app/views/decidim/user_activities/index.html.erb +4 -0
- data/app/views/decidim/user_activities/index.js.erb +14 -0
- data/app/views/decidim/user_conversations/index.html.erb +4 -0
- data/app/views/decidim/user_conversations/show.html.erb +4 -0
- data/app/views/decidim/user_conversations/update.js.erb +8 -0
- data/app/views/decidim/user_interests/_scopes.html.erb +12 -10
- data/app/views/decidim/user_interests/show.html.erb +4 -1
- data/app/views/decidim/user_timeline/index.html.erb +5 -1
- data/app/views/decidim/user_timeline/index.js.erb +14 -0
- data/app/views/decidim/widgets/show.html.erb +4 -0
- data/app/views/kaminari/decidim/_first_page.html.erb +5 -1
- data/app/views/kaminari/decidim/_last_page.html.erb +5 -1
- data/app/views/kaminari/decidim/_next_page.html.erb +6 -1
- data/app/views/kaminari/decidim/_page.html.erb +2 -2
- data/app/views/kaminari/decidim/_paginator.html.erb +16 -14
- data/app/views/kaminari/decidim/_prev_page.html.erb +6 -1
- data/app/views/layouts/decidim/_admin_links.html.erb +2 -0
- data/app/views/layouts/decidim/_application.html.erb +4 -2
- data/app/views/layouts/decidim/_cookie_warning.html.erb +1 -1
- data/app/views/layouts/decidim/_edit_link.html.erb +0 -8
- data/app/views/layouts/decidim/_head.html.erb +4 -0
- data/app/views/layouts/decidim/_js_configuration.html.erb +34 -0
- data/app/views/layouts/decidim/_language_chooser.html.erb +10 -5
- data/app/views/layouts/decidim/_logo.html.erb +2 -22
- data/app/views/layouts/decidim/_mailer_logo.html.erb +2 -22
- data/app/views/layouts/decidim/_main_footer.html.erb +3 -1
- data/app/views/layouts/decidim/_mini_footer.html.erb +7 -7
- data/app/views/layouts/decidim/_omnipresent_banner.html.erb +1 -1
- data/app/views/layouts/decidim/_organization_colors.html.erb +4 -3
- data/app/views/layouts/decidim/_social_media_links.html.erb +15 -10
- data/app/views/layouts/decidim/_topbar_search.html.erb +12 -2
- data/app/views/layouts/decidim/_user_menu.html.erb +6 -6
- data/app/views/layouts/decidim/_wrapper.html.erb +21 -15
- data/app/views/layouts/decidim/newsletter_base.html.erb +46 -0
- data/app/views/layouts/decidim/user_profile.html.erb +8 -3
- data/app/views/layouts/decidim/widget.html.erb +2 -43
- data/config/initializers/browser.rb +5 -0
- data/config/initializers/devise.rb +11 -25
- data/config/initializers/invisible_captcha.rb +1 -0
- data/config/initializers/omniauth.rb +56 -0
- data/config/initializers/rack_attack.rb +25 -16
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +44 -22
- data/config/locales/bg-BG.yml +1512 -0
- data/config/locales/bg.yml +1508 -0
- data/config/locales/ca.yml +302 -24
- data/config/locales/cs.yml +346 -55
- data/config/locales/da-DK.yml +9 -0
- data/config/locales/da.yml +1 -0
- data/config/locales/de.yml +311 -26
- data/config/locales/el-GR.yml +151 -0
- data/config/locales/el.yml +1587 -0
- data/config/locales/en.yml +308 -20
- data/config/locales/eo-UY.yml +2 -6
- data/config/locales/eo.yml +92 -0
- data/config/locales/es-MX.yml +297 -19
- data/config/locales/es-PY.yml +297 -19
- data/config/locales/es.yml +301 -23
- data/config/locales/et-EE.yml +9 -0
- data/config/locales/et.yml +1 -0
- data/config/locales/eu.yml +14 -19
- data/config/locales/fi-plain.yml +297 -19
- data/config/locales/fi.yml +361 -83
- data/config/locales/fr-CA.yml +1613 -0
- data/config/locales/fr.yml +304 -26
- data/config/locales/ga-IE.yml +1 -0
- data/config/locales/gl.yml +14 -19
- data/config/locales/hr-HR.yml +9 -0
- data/config/locales/hr.yml +1 -0
- data/config/locales/hu.yml +123 -39
- data/config/locales/id-ID.yml +14 -19
- data/config/locales/is-IS.yml +457 -0
- data/config/locales/is.yml +463 -0
- data/config/locales/it.yml +332 -54
- data/config/locales/ja-JP.yml +1587 -0
- 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-LT.yml +9 -0
- data/config/locales/lt.yml +1 -0
- data/config/locales/lv.yml +1481 -0
- data/config/locales/mt-MT.yml +9 -0
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +292 -20
- data/config/locales/no.yml +951 -41
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +801 -444
- data/config/locales/pt-BR.yml +15 -21
- data/config/locales/pt.yml +887 -551
- data/config/locales/ro-RO.yml +1609 -0
- data/config/locales/ru.yml +14 -14
- data/config/locales/sk-SK.yml +1426 -0
- data/config/locales/sk.yml +1440 -0
- data/config/locales/sl.yml +72 -0
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +122 -0
- data/config/locales/sv.yml +342 -40
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +14 -19
- data/config/locales/uk.yml +10 -15
- 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/config/routes.rb +5 -0
- data/db/migrate/20180810092428_move_organization_fields_to_hero_content_block.rb +2 -2
- data/db/migrate/20191113092826_add_omniauth_settings_to_decidim_organization.rb +7 -0
- data/db/migrate/20191113144432_add_rich_text_editor_in_public_views_to_organizations.rb +10 -0
- data/db/migrate/20191118123154_add_admin_terms_of_use_body_field_to_organization.rb +9 -0
- data/db/migrate/20191130151925_create_decidim_endorsements.rb +13 -0
- data/db/migrate/20191204075509_add_session_token_to_users.rb +7 -0
- data/db/migrate/20200107142226_add_organization_timezone.rb +7 -0
- data/db/migrate/20200211173227_add_direct_message_types_to_users.rb +12 -0
- data/db/migrate/20200320105904_index_foreign_keys_in_decidim_action_logs.rb +9 -0
- data/db/migrate/20200320105905_index_foreign_keys_in_decidim_amendments.rb +7 -0
- data/db/migrate/20200320105909_index_foreign_keys_in_decidim_authorizations.rb +7 -0
- data/db/migrate/20200320105917_index_foreign_keys_in_decidim_contextual_help_sections.rb +7 -0
- data/db/migrate/20200320105919_index_foreign_keys_in_decidim_endorsements.rb +7 -0
- data/db/migrate/20200320105923_index_foreign_keys_in_decidim_notifications.rb +7 -0
- data/db/migrate/20200320105927_index_foreign_keys_in_oauth_access_grants.rb +7 -0
- data/db/migrate/20200323094443_add_id_to_content_blocks_scope.rb +7 -0
- data/db/migrate/20200326102407_rename_scope_column.rb +7 -0
- data/db/migrate/20200327082257_migrate_newsletters_to_templates.rb +33 -0
- data/db/migrate/20200327082954_remove_newsletter_body.rb +7 -0
- data/db/migrate/20200401073419_add_index_on_content_block_scope_id.rb +11 -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 +8 -6
- data/{app/controllers/concerns → lib}/decidim/action_authorization.rb +0 -0
- data/lib/decidim/amendable.rb +7 -4
- data/lib/decidim/api/amendable_entity_interface.rb +18 -0
- data/lib/decidim/api/amendable_interface.rb +18 -0
- data/lib/decidim/api/attachable_interface.rb +1 -1
- data/lib/decidim/api/author_interface.rb +4 -0
- data/lib/decidim/api/categorizable_interface.rb +1 -1
- data/lib/decidim/api/coauthorable_interface.rb +29 -0
- data/lib/decidim/api/endorsable_interface.rb +22 -0
- data/lib/decidim/api/fingerprint_interface.rb +13 -0
- data/lib/decidim/api/participatory_space_interface.rb +11 -9
- data/lib/decidim/api/participatory_space_resourceable_interface.rb +21 -0
- data/lib/decidim/api/scopable_interface.rb +1 -1
- data/lib/decidim/api/timestamps_interface.rb +21 -0
- data/lib/decidim/api/traceable_interface.rb +14 -0
- data/lib/decidim/authorable.rb +22 -1
- data/lib/decidim/authorization_form_builder.rb +7 -0
- data/lib/decidim/coauthorable.rb +32 -3
- data/lib/decidim/component_manifest.rb +16 -2
- data/lib/decidim/content_parsers.rb +1 -0
- data/lib/decidim/content_parsers/user_group_parser.rb +61 -0
- data/lib/decidim/content_parsers/user_parser.rb +3 -5
- data/lib/decidim/content_processor.rb +54 -29
- data/lib/decidim/content_renderers.rb +1 -0
- 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 +32 -0
- data/lib/decidim/content_renderers/user_renderer.rb +3 -1
- data/lib/decidim/core.rb +133 -34
- data/lib/decidim/core/api.rb +8 -0
- data/lib/decidim/core/engine.rb +149 -23
- data/lib/decidim/core/test.rb +15 -0
- data/lib/decidim/core/test/factories.rb +152 -10
- data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +79 -0
- data/lib/decidim/core/test/shared_examples/amendable/accept_amendment_examples.rb +4 -4
- data/lib/decidim/core/test/shared_examples/amendable_interface_examples.rb +14 -0
- data/lib/decidim/core/test/shared_examples/amendable_proposals_interface_examples.rb +50 -0
- data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +3 -0
- data/lib/decidim/core/test/shared_examples/back_to_list_button_examples.rb +17 -0
- data/lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb +60 -0
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +77 -11
- data/lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb +5 -1
- data/lib/decidim/core/test/shared_examples/embed_resource_examples.rb +49 -0
- data/lib/decidim/core/test/shared_examples/endorsable_interface_examples.rb +22 -0
- data/lib/decidim/core/test/shared_examples/endorsements_controller_shared_context.rb +22 -0
- data/lib/decidim/core/test/shared_examples/fingerprintable_interface_examples.rb +17 -0
- data/lib/decidim/core/test/shared_examples/follows_examples.rb +18 -2
- data/lib/decidim/core/test/shared_examples/input_filter_examples.rb +118 -0
- data/lib/decidim/core/test/shared_examples/input_sort_examples.rb +126 -0
- data/lib/decidim/core/test/shared_examples/logo_email.rb +20 -0
- 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/metric_manage_shared_context.rb +9 -0
- data/lib/decidim/core/test/shared_examples/participatory_space_resourcable_interface_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/permissions.rb +143 -0
- data/lib/decidim/core/test/shared_examples/preview_component_with_share_token_examples.rb +55 -0
- data/lib/decidim/core/test/shared_examples/reports_examples.rb +4 -4
- data/lib/decidim/core/test/shared_examples/resource_search_examples.rb +200 -0
- data/lib/decidim/core/test/shared_examples/rich_text_editor_examples.rb +59 -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 -3
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +15 -2
- data/lib/decidim/core/test/shared_examples/simple_event.rb +8 -0
- data/lib/decidim/core/test/shared_examples/system_endorse_resource_examples.rb +166 -0
- data/lib/decidim/core/test/shared_examples/timestamps_interface_examples.rb +21 -0
- data/lib/decidim/core/test/shared_examples/traceable_interface_examples.rb +47 -0
- data/lib/decidim/core/test/shared_examples/uncommentable_component_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/with_endorsable_permissions_examples.rb +89 -0
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/deprecations.rb +19 -0
- data/lib/decidim/diffy_extension.rb +47 -0
- data/lib/decidim/endorsable.rb +25 -0
- data/lib/decidim/events.rb +1 -0
- data/lib/decidim/events/base_event.rb +11 -9
- data/lib/decidim/events/user_group_event.rb +45 -0
- data/lib/decidim/exporters.rb +7 -0
- data/lib/decidim/exporters/csv.rb +16 -2
- data/lib/decidim/exporters/excel.rb +1 -1
- data/lib/decidim/exporters/export_manifest.rb +35 -2
- data/lib/decidim/exporters/pdf.rb +56 -0
- data/lib/decidim/file_validator_humanizer.rb +98 -0
- data/lib/decidim/filter_form_builder.rb +38 -11
- data/lib/decidim/form_builder.rb +239 -42
- data/lib/decidim/geocodable.rb +79 -0
- data/lib/decidim/has_attachments.rb +11 -1
- data/lib/decidim/has_settings.rb +10 -4
- 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/organization_settings.rb +267 -0
- data/lib/decidim/participable.rb +6 -0
- data/lib/decidim/participatory_space_manifest.rb +35 -0
- data/lib/decidim/participatory_space_resourceable.rb +35 -1
- data/lib/decidim/query_extensions.rb +17 -37
- data/lib/decidim/resource_manifest.rb +1 -1
- data/lib/decidim/scopable.rb +19 -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 +15 -2
- data/lib/decidim/searchable.rb +4 -0
- data/lib/decidim/settings_manifest.rb +16 -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 +5 -0
- data/lib/tasks/decidim_data_portability_tasks.rake +66 -5
- data/lib/tasks/decidim_locales_tasks.rake +35 -0
- data/lib/tasks/decidim_metrics_tasks.rake +18 -7
- data/lib/tasks/decidim_tasks.rake +2 -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.el.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.ro.js +15 -0
- data/vendor/assets/javascripts/datepicker-locales/foundation-datepicker.sk.js +14 -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
- data/vendor/assets/javascripts/leaflet-tilelayer-here.js +200 -155
- data/vendor/assets/javascripts/svg4everybody.min.js +1 -2
- data/vendor/assets/javascripts/tribute.js +11 -4
- metadata +438 -42
- data/app/assets/javascripts/decidim/vizzs/orgchart.js.es6 +0 -699
- data/app/assets/stylesheets/decidim/email.css +0 -1403
- data/app/assets/stylesheets/decidim/modules/_input-hashtags.scss +0 -124
- data/app/helpers/decidim/multi_translation_helper.rb +0 -0
- data/app/models/decidim/participatory_process_user_role.rb +0 -32
- data/app/resolvers/decidim/core/user_resolver.rb +0 -61
- data/app/views/decidim/messaging/conversations/_message.html.erb +0 -14
- data/lib/decidim/data_portability_file_reader.rb +0 -56
- data/lib/decidim/data_portability_file_zipper.rb +0 -67
- data/lib/decidim/hashtaggable.rb +0 -24
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "wicked_pdf"
|
4
|
+
|
5
|
+
module Decidim
|
6
|
+
module Exporters
|
7
|
+
# Exports a PDF using the provided hash, given a collection and a
|
8
|
+
# Serializer. This is an abstract class that should be inherited
|
9
|
+
# to create PDF exporters, with each PDF exporter class setting
|
10
|
+
# the desired template, layout and orientation.
|
11
|
+
#
|
12
|
+
class PDF < Exporter
|
13
|
+
# Public: Exports a PDF version of the collection by rendering
|
14
|
+
# the template into html and then converting it to PDF.
|
15
|
+
#
|
16
|
+
# Returns an ExportData instance.
|
17
|
+
def export
|
18
|
+
html = controller.render_to_string(
|
19
|
+
template: template,
|
20
|
+
layout: layout,
|
21
|
+
locals: locals
|
22
|
+
)
|
23
|
+
|
24
|
+
document = WickedPdf.new.pdf_from_string(html, orientation: orientation)
|
25
|
+
|
26
|
+
ExportData.new(document, "pdf")
|
27
|
+
end
|
28
|
+
|
29
|
+
# may be overwritten if needed
|
30
|
+
def orientation
|
31
|
+
"Portrait"
|
32
|
+
end
|
33
|
+
|
34
|
+
# implementing classes should return a valid ERB path here
|
35
|
+
def template
|
36
|
+
raise NotImplementedError
|
37
|
+
end
|
38
|
+
|
39
|
+
# implementing classes should return a valid ERB path here
|
40
|
+
def layout
|
41
|
+
raise NotImplementedError
|
42
|
+
end
|
43
|
+
|
44
|
+
# This method may be overwritten if the template needs more local variables
|
45
|
+
def locals
|
46
|
+
{ collection: collection }
|
47
|
+
end
|
48
|
+
|
49
|
+
protected
|
50
|
+
|
51
|
+
def controller
|
52
|
+
raise NotImplementedError
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# This class fetches the file validation conditions from the active record
|
5
|
+
# model objects which have specific validators and uploaders attached to them.
|
6
|
+
# This class is used to convert these validation conditions to a human
|
7
|
+
# readable format in the front-end and to simplify the code where these are
|
8
|
+
# needed from.
|
9
|
+
#
|
10
|
+
# This considers if the validation conditions and the uploader have been set
|
11
|
+
# directly to the record being validated or if they should be read from
|
12
|
+
# another object in case the PassthruValidator is in charge of the
|
13
|
+
# validations.
|
14
|
+
class FileValidatorHumanizer
|
15
|
+
def initialize(record, attribute)
|
16
|
+
@record = record
|
17
|
+
@attribute = attribute
|
18
|
+
@passthru_validator ||= record.singleton_class.validators_on(
|
19
|
+
attribute
|
20
|
+
).find { |validator| validator.is_a?(PassthruValidator) }
|
21
|
+
end
|
22
|
+
|
23
|
+
def uploader
|
24
|
+
@uploader ||= passthru_uploader || record.send(attribute)
|
25
|
+
end
|
26
|
+
|
27
|
+
def messages
|
28
|
+
messages = []
|
29
|
+
|
30
|
+
if (file_size = max_file_size)
|
31
|
+
file_size_mb = (((file_size / 1024 / 1024) * 100) / 100).round
|
32
|
+
messages << I18n.t(
|
33
|
+
"max_file_size",
|
34
|
+
megabytes: file_size_mb,
|
35
|
+
scope: "decidim.forms.file_validation"
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
if (extensions = extension_whitelist)
|
40
|
+
messages << I18n.t(
|
41
|
+
"allowed_file_extensions",
|
42
|
+
extensions: extensions.join(" "),
|
43
|
+
scope: "decidim.forms.file_validation"
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
messages
|
48
|
+
end
|
49
|
+
|
50
|
+
def max_file_size
|
51
|
+
# First try if the record itself has a file size validator defined.
|
52
|
+
validator = record.singleton_class.validators_on(attribute).find do |v|
|
53
|
+
v.is_a?(::ActiveModel::Validations::FileSizeValidator)
|
54
|
+
end
|
55
|
+
if validator
|
56
|
+
lte = validator.options[:less_than_or_equal_to]
|
57
|
+
return lte if lte.is_a?(Numeric)
|
58
|
+
return lte.call(record) if lte.respond_to?(:call)
|
59
|
+
end
|
60
|
+
return unless passthru_validator
|
61
|
+
|
62
|
+
# If not, check for the same validator from the pass through record.
|
63
|
+
validator = passthru_validator.target_validators(attribute).find do |v|
|
64
|
+
v.is_a?(::ActiveModel::Validations::FileSizeValidator)
|
65
|
+
end
|
66
|
+
return unless validator
|
67
|
+
|
68
|
+
lte = validator.options[:less_than_or_equal_to]
|
69
|
+
return lte if lte.is_a?(Numeric)
|
70
|
+
|
71
|
+
lte.call(passthru_record) if lte.respond_to?(:call)
|
72
|
+
end
|
73
|
+
|
74
|
+
def extension_whitelist
|
75
|
+
return unless uploader.respond_to?(:extension_whitelist, true)
|
76
|
+
|
77
|
+
# It may be a private method in some uploaders which is why we need to use
|
78
|
+
# `#send`.
|
79
|
+
uploader.send(:extension_whitelist)
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
attr_reader :record, :attribute, :passthru_validator
|
85
|
+
|
86
|
+
def passthru_record
|
87
|
+
return unless passthru_validator
|
88
|
+
|
89
|
+
@passthru_record ||= passthru_validator.validation_record(record)
|
90
|
+
end
|
91
|
+
|
92
|
+
def passthru_uploader
|
93
|
+
return unless passthru_record
|
94
|
+
|
95
|
+
passthru_record.send(passthru_validator.target_attribute(attribute))
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
# Wrap the radio buttons collection in a custom fieldset.
|
9
9
|
# It also renders the inputs inside its labels.
|
10
10
|
def collection_radio_buttons(method, collection, value_method, label_method, options = {}, html_options = {})
|
11
|
-
fieldset_wrapper
|
11
|
+
fieldset_wrapper(options[:legend_title], "#{method}_collection_radio_buttons_filter") do
|
12
12
|
super(method, collection, value_method, label_method, options, html_options) do |builder|
|
13
13
|
if block_given?
|
14
14
|
yield builder
|
@@ -22,7 +22,7 @@ module Decidim
|
|
22
22
|
# Wrap the check_boxes collection in a custom fieldset.
|
23
23
|
# It also renders the inputs inside its labels.
|
24
24
|
def collection_check_boxes(method, collection, value_method, label_method, options = {}, html_options = {})
|
25
|
-
fieldset_wrapper
|
25
|
+
fieldset_wrapper(options[:legend_title], "#{method}_collection_check_boxes_filter") do
|
26
26
|
super(method, collection, value_method, label_method, options, html_options) do |builder|
|
27
27
|
if block_given?
|
28
28
|
yield builder
|
@@ -33,23 +33,46 @@ module Decidim
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
# Wrap the dependant check_boxes in a custom fieldset.
|
37
|
+
# checked parent checks its children
|
38
|
+
def check_boxes_tree(method, collection, options = {})
|
39
|
+
fieldset_wrapper(options.delete(:legend_title), "#{method}_check_boxes_tree_filter") do
|
40
|
+
@template.render("decidim/shared/check_boxes_tree",
|
41
|
+
form: self,
|
42
|
+
attribute: method,
|
43
|
+
collection: collection,
|
44
|
+
check_boxes_tree_id: check_boxes_tree_id(method),
|
45
|
+
hide_node: "false",
|
46
|
+
options: options).html_safe
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
36
50
|
# Wrap the category select in a custom fieldset.
|
37
|
-
def categories_select(method, collection, options = {})
|
38
|
-
fieldset_wrapper
|
39
|
-
super(method, collection, options)
|
51
|
+
def categories_select(method, collection, options = {}, html_options = {})
|
52
|
+
fieldset_wrapper(options.delete(:legend_title), "#{method}_categories_select_filter") do
|
53
|
+
super(method, collection, options, html_options)
|
40
54
|
end
|
41
55
|
end
|
42
56
|
|
43
57
|
# Wrap the areas select in a custom fieldset.
|
44
58
|
def areas_select(method, collection, options = {})
|
45
|
-
fieldset_wrapper
|
59
|
+
fieldset_wrapper(options[:legend_title], "#{method}_areas_select_filter") do
|
46
60
|
super(method, collection, options)
|
47
61
|
end
|
48
62
|
end
|
49
63
|
|
64
|
+
# Wrap the custom select in a custom fieldset.
|
65
|
+
# Any *_select can be used as a custom_select; what changes is the superclass method,
|
66
|
+
# and this one knows which one has to be called, depending on the `name` provided.
|
67
|
+
def custom_select(name, method, collection, options = {})
|
68
|
+
fieldset_wrapper(options[:legend_title], "#{method}_#{name}_select_filter") do
|
69
|
+
send(:"#{name}_select", method, collection, options)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
50
73
|
# Wrap the scopes picker in a custom fieldset.
|
51
74
|
def scopes_picker(method, options = { checkboxes_on_top: true })
|
52
|
-
fieldset_wrapper
|
75
|
+
fieldset_wrapper(options[:legend_title], "#{method}_scopes_picker_filter") do
|
53
76
|
super(method, options)
|
54
77
|
end
|
55
78
|
end
|
@@ -57,14 +80,18 @@ module Decidim
|
|
57
80
|
private
|
58
81
|
|
59
82
|
# Private: Renders a custom fieldset and execute the given block.
|
60
|
-
def fieldset_wrapper(legend_title)
|
61
|
-
@template.content_tag(:div, "", class: "filters__section") do
|
83
|
+
def fieldset_wrapper(legend_title, extra_class)
|
84
|
+
@template.content_tag(:div, "", class: "filters__section #{extra_class}") do
|
62
85
|
@template.content_tag(:fieldset) do
|
63
|
-
@template.content_tag(:legend) do
|
64
|
-
|
86
|
+
@template.content_tag(:legend, class: "mini-title") do
|
87
|
+
legend_title
|
65
88
|
end + yield
|
66
89
|
end
|
67
90
|
end
|
68
91
|
end
|
92
|
+
|
93
|
+
def check_boxes_tree_id(attribute)
|
94
|
+
"#{attribute}-#{object_id}"
|
95
|
+
end
|
69
96
|
end
|
70
97
|
end
|
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,30 +69,21 @@ 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
|
|
78
|
+
hashtaggable = options.delete(:hashtaggable)
|
81
79
|
tabs_content = content_tag(:div, class: "tabs-content", data: { tabs_content: tabs_id }) do
|
82
80
|
locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
|
83
81
|
tab_content_id = "#{tabs_id}-#{name}-panel-#{index}"
|
84
82
|
string + content_tag(:div, class: tab_element_class_for("panel", index), id: tab_content_id) do
|
85
|
-
if
|
83
|
+
if hashtaggable
|
86
84
|
hashtaggable_text_field(type, name, locale, options.merge(label: false))
|
85
|
+
elsif type.to_sym == :editor
|
86
|
+
send(type, name_with_locale(name, locale), options.merge(label: false, hashtaggable: hashtaggable))
|
87
87
|
else
|
88
88
|
send(type, name_with_locale(name, locale), options.merge(label: false))
|
89
89
|
end
|
@@ -95,7 +95,7 @@ module Decidim
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def translated_one_locale(type, name, locale, options = {})
|
98
|
-
return hashtaggable_text_field(type, name, locale, options
|
98
|
+
return hashtaggable_text_field(type, name, locale, options) if options.delete(:hashtaggable)
|
99
99
|
|
100
100
|
send(
|
101
101
|
type,
|
@@ -112,6 +112,8 @@ module Decidim
|
|
112
112
|
#
|
113
113
|
# Renders form fields for each locale.
|
114
114
|
def hashtaggable_text_field(type, name, locale, options = {})
|
115
|
+
options[:hashtaggable] = true if type.to_sym == :editor
|
116
|
+
|
115
117
|
content_tag(:div, class: "hashtags__container") do
|
116
118
|
if options[:value]
|
117
119
|
send(type, name_with_locale(name, locale), options.merge(label: options[:label], value: options[:value][locale]))
|
@@ -175,18 +177,23 @@ module Decidim
|
|
175
177
|
#
|
176
178
|
# Renders a container with both hidden field and editor container
|
177
179
|
def editor(name, options = {})
|
178
|
-
options[:toolbar] ||= "basic"
|
179
|
-
options[:lines] ||= 10
|
180
180
|
options[:disabled] ||= false
|
181
|
-
|
182
|
-
|
181
|
+
toolbar = options.delete(:toolbar) || "basic"
|
182
|
+
lines = options.delete(:lines) || 10
|
183
|
+
label_text = options[:label].to_s
|
184
|
+
label_text = label_for(name) if label_text.blank?
|
185
|
+
options.delete(:required)
|
186
|
+
hashtaggable = options.delete(:hashtaggable)
|
187
|
+
hidden_options = extract_validations(name, options).merge(options)
|
188
|
+
|
189
|
+
content_tag(:div, class: "editor #{"hashtags__container" if hashtaggable}") do
|
183
190
|
template = ""
|
184
|
-
template += label(name,
|
185
|
-
template += hidden_field(name,
|
186
|
-
template += content_tag(:div, nil, class: "editor-container #{"js-hashtags" if
|
187
|
-
toolbar:
|
191
|
+
template += label(name, label_text + required_for_attribute(name)) if options.fetch(:label, true)
|
192
|
+
template += hidden_field(name, hidden_options)
|
193
|
+
template += content_tag(:div, nil, class: "editor-container #{"js-hashtags" if hashtaggable}", data: {
|
194
|
+
toolbar: toolbar,
|
188
195
|
disabled: options[:disabled]
|
189
|
-
}, style: "height: #{
|
196
|
+
}, style: "height: #{lines}rem")
|
190
197
|
template += error_for(name, options) if error?(name)
|
191
198
|
template.html_safe
|
192
199
|
end
|
@@ -199,9 +206,10 @@ module Decidim
|
|
199
206
|
# options - An optional Hash with options:
|
200
207
|
# - prompt - An optional String with the text to display as prompt.
|
201
208
|
# - disable_parents - A Boolean to disable parent categories. Defaults to `true`.
|
209
|
+
# html_options - HTML options for the select
|
202
210
|
#
|
203
211
|
# Returns a String.
|
204
|
-
def categories_select(name, collection, options = {})
|
212
|
+
def categories_select(name, collection, options = {}, html_options = {})
|
205
213
|
options = {
|
206
214
|
disable_parents: true
|
207
215
|
}.merge(options)
|
@@ -209,13 +217,14 @@ module Decidim
|
|
209
217
|
disable_parents = options[:disable_parents]
|
210
218
|
|
211
219
|
selected = object.send(name)
|
220
|
+
selected = selected.first if selected.is_a?(Array) && selected.length > 1
|
212
221
|
categories = categories_for_select(collection)
|
213
222
|
disabled = if disable_parents
|
214
223
|
disabled_categories_for(collection)
|
215
224
|
else
|
216
225
|
[]
|
217
226
|
end
|
218
|
-
|
227
|
+
|
219
228
|
select(name, @template.options_for_select(categories, selected: selected, disabled: disabled), options, html_options)
|
220
229
|
end
|
221
230
|
|
@@ -226,7 +235,7 @@ module Decidim
|
|
226
235
|
# If it's areas, we sort the selectable options alphabetically.
|
227
236
|
#
|
228
237
|
# Returns a String.
|
229
|
-
def areas_select(name, collection, options = {})
|
238
|
+
def areas_select(name, collection, options = {}, html_options = {})
|
230
239
|
selectables = if collection.first.is_a?(Decidim::Area)
|
231
240
|
assemblies = collection
|
232
241
|
.map { |a| [a.name[I18n.locale.to_s], a.id] }
|
@@ -247,7 +256,23 @@ module Decidim
|
|
247
256
|
)
|
248
257
|
end
|
249
258
|
|
250
|
-
select(name, selectables, options)
|
259
|
+
select(name, selectables, options, html_options)
|
260
|
+
end
|
261
|
+
|
262
|
+
# Public: Generates a select field for resource types.
|
263
|
+
#
|
264
|
+
# name - The name of the field (usually resource_type)
|
265
|
+
# collection - A collection of resource types.
|
266
|
+
# The options are sorted alphabetically.
|
267
|
+
#
|
268
|
+
# Returns a String.
|
269
|
+
def resources_select(name, collection, options = {})
|
270
|
+
resources =
|
271
|
+
collection
|
272
|
+
.map { |r| [I18n.t(r.split("::").last.underscore, scope: "decidim.components.component_order_selector.order"), r] }
|
273
|
+
.sort
|
274
|
+
|
275
|
+
select(name, @template.options_for_select(resources, selected: options[:selected]), options)
|
251
276
|
end
|
252
277
|
|
253
278
|
# Public: Generates a picker field for scope selection.
|
@@ -256,14 +281,21 @@ module Decidim
|
|
256
281
|
# options - An optional Hash with options:
|
257
282
|
# - multiple - Multiple mode, to allow multiple scopes selection.
|
258
283
|
# - label - Show label?
|
259
|
-
# - 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.
|
260
286
|
#
|
261
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)
|
262
288
|
#
|
263
289
|
# Returns a String.
|
264
290
|
def scopes_picker(attribute, options = {})
|
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
|
296
|
+
|
265
297
|
picker_options = {
|
266
|
-
id:
|
298
|
+
id: id,
|
267
299
|
class: "picker-#{options[:multiple] ? "multiple" : "single"}",
|
268
300
|
name: "#{@object_name}[#{attribute}]"
|
269
301
|
}
|
@@ -273,12 +305,12 @@ module Decidim
|
|
273
305
|
prompt_params = yield(nil)
|
274
306
|
scopes = selected_scopes(attribute).map { |scope| [scope, yield(scope)] }
|
275
307
|
template = ""
|
276
|
-
template += label
|
308
|
+
template += "<label>#{label_for(attribute) + required_for_attribute(attribute)}</label>" unless options[:label] == false
|
277
309
|
template += @template.render("decidim/scopes/scopes_picker_input",
|
278
310
|
picker_options: picker_options,
|
279
311
|
prompt_params: prompt_params,
|
280
312
|
scopes: scopes,
|
281
|
-
|
313
|
+
values_on_top: !options[:multiple] || options[:checkboxes_on_top])
|
282
314
|
template += error_and_help_text(attribute, options)
|
283
315
|
template.html_safe
|
284
316
|
end
|
@@ -304,6 +336,7 @@ module Decidim
|
|
304
336
|
name: options[:name] || "#{@object_name}[#{attribute}]"
|
305
337
|
}
|
306
338
|
picker_options[:class] += " is-invalid-input" if error?(attribute)
|
339
|
+
picker_options[:class] += " picker-autosort" if options[:autosort]
|
307
340
|
|
308
341
|
items = object.send(attribute).collect { |item| [item, yield(item)] }
|
309
342
|
|
@@ -367,22 +400,29 @@ module Decidim
|
|
367
400
|
# attribute - The String name of the attribute to buidl the field.
|
368
401
|
# options - A Hash with options to build the field.
|
369
402
|
# * optional: Whether the file can be optional or not.
|
403
|
+
# rubocop:disable Metrics/CyclomaticComplexity
|
404
|
+
# rubocop:disable Metrics/PerceivedComplexity
|
370
405
|
def upload(attribute, options = {})
|
371
406
|
self.multipart = true
|
372
407
|
options[:optional] = options[:optional].nil? ? true : options[:optional]
|
408
|
+
alt_text = label_for(attribute)
|
373
409
|
|
374
410
|
file = object.send attribute
|
375
411
|
template = ""
|
376
412
|
template += label(attribute, label_for(attribute) + required_for_attribute(attribute))
|
413
|
+
template += upload_help(attribute, options)
|
377
414
|
template += @template.file_field @object_name, attribute
|
378
415
|
|
416
|
+
template += extension_whitelist_help(options[:extension_whitelist]) if options[:extension_whitelist].present?
|
417
|
+
template += image_dimensions_help(options[:dimensions_info]) if options[:dimensions_info].present?
|
418
|
+
|
379
419
|
if file_is_image?(file)
|
380
420
|
template += if file.present?
|
381
421
|
@template.content_tag :label, I18n.t("current_image", scope: "decidim.forms")
|
382
422
|
else
|
383
423
|
@template.content_tag :label, I18n.t("default_image", scope: "decidim.forms")
|
384
424
|
end
|
385
|
-
template += @template.link_to @template.image_tag(file.url), file.url, target: "_blank", rel: "noopener"
|
425
|
+
template += @template.link_to @template.image_tag(file.url, alt: alt_text), file.url, target: "_blank", rel: "noopener"
|
386
426
|
elsif file_is_present?(file)
|
387
427
|
template += @template.label_tag I18n.t("current_file", scope: "decidim.forms")
|
388
428
|
template += @template.link_to file.file.filename, file.url, target: "_blank", rel: "noopener"
|
@@ -407,6 +447,32 @@ module Decidim
|
|
407
447
|
|
408
448
|
template.html_safe
|
409
449
|
end
|
450
|
+
# rubocop:enable Metrics/CyclomaticComplexity
|
451
|
+
# rubocop:enable Metrics/PerceivedComplexity
|
452
|
+
|
453
|
+
def upload_help(attribute, _options = {})
|
454
|
+
humanizer = FileValidatorHumanizer.new(object, attribute)
|
455
|
+
|
456
|
+
help_scope = begin
|
457
|
+
if humanizer.uploader.is_a?(Decidim::ImageUploader)
|
458
|
+
"decidim.forms.file_help.image"
|
459
|
+
else
|
460
|
+
"decidim.forms.file_help.file"
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
464
|
+
content_tag(:div, class: "help-text") do
|
465
|
+
help_messages = %w(message_1 message_2)
|
466
|
+
|
467
|
+
inner = "<p>#{I18n.t("explanation", scope: help_scope)}</p>".html_safe
|
468
|
+
inner + content_tag(:ul) do
|
469
|
+
messages = help_messages.each.map { |msg| I18n.t(msg, scope: help_scope) }
|
470
|
+
messages += humanizer.messages
|
471
|
+
|
472
|
+
messages.map { |msg| content_tag(:li, msg) }.join("\n").html_safe
|
473
|
+
end.html_safe
|
474
|
+
end
|
475
|
+
end
|
410
476
|
|
411
477
|
# Public: Returns the translated name for the given attribute.
|
412
478
|
#
|
@@ -427,6 +493,19 @@ module Decidim
|
|
427
493
|
end
|
428
494
|
end
|
429
495
|
|
496
|
+
# Discard the pattern attribute which is not allowed for textarea elements.
|
497
|
+
def text_area(attribute, options = {})
|
498
|
+
field(attribute, options) do |opts|
|
499
|
+
opts.delete(:pattern)
|
500
|
+
@template.send(
|
501
|
+
:text_area,
|
502
|
+
@object_name,
|
503
|
+
attribute,
|
504
|
+
objectify_options(opts)
|
505
|
+
)
|
506
|
+
end
|
507
|
+
end
|
508
|
+
|
430
509
|
private
|
431
510
|
|
432
511
|
# Private: Override from FoundationRailsHelper in order to render
|
@@ -490,6 +569,7 @@ module Decidim
|
|
490
569
|
validation_options = {}
|
491
570
|
validation_options[:pattern] = "^(.|[\n\r]){#{min_length},#{max_length}}$" if min_length.to_i.positive? || max_length.to_i.positive?
|
492
571
|
validation_options[:required] = options[:required] || attribute_required?(attribute)
|
572
|
+
validation_options[:minlength] ||= min_length if min_length.to_i.positive?
|
493
573
|
validation_options[:maxlength] ||= max_length if max_length.to_i.positive?
|
494
574
|
validation_options
|
495
575
|
end
|
@@ -528,9 +608,17 @@ module Decidim
|
|
528
608
|
# Returns an Integer or Nil.
|
529
609
|
def length_for_attribute(attribute, type)
|
530
610
|
length_validator = find_validator(attribute, ActiveModel::Validations::LengthValidator)
|
531
|
-
return
|
611
|
+
return length_validator.options[type] if length_validator
|
612
|
+
|
613
|
+
length_validator = find_validator(attribute, ProposalLengthValidator)
|
614
|
+
if length_validator
|
615
|
+
length = length_validator.options[type]
|
616
|
+
return length.call(object) if length.respond_to?(:call)
|
532
617
|
|
533
|
-
|
618
|
+
return length
|
619
|
+
end
|
620
|
+
|
621
|
+
nil
|
534
622
|
end
|
535
623
|
|
536
624
|
# Private: Finds a validator.
|
@@ -542,7 +630,7 @@ module Decidim
|
|
542
630
|
def find_validator(attribute, klass)
|
543
631
|
return unless object.respond_to?(:_validators)
|
544
632
|
|
545
|
-
object._validators[attribute].find { |validator| validator.class == klass }
|
633
|
+
object._validators[attribute.to_sym].find { |validator| validator.class == klass }
|
546
634
|
end
|
547
635
|
|
548
636
|
# Private: Override method from FoundationRailsHelper to render the text of the
|
@@ -663,9 +751,20 @@ module Decidim
|
|
663
751
|
|
664
752
|
def required_for_attribute(attribute)
|
665
753
|
if attribute_required?(attribute)
|
666
|
-
|
667
|
-
|
668
|
-
|
754
|
+
visible_title = content_tag(:span, "*", "aria-hidden": true)
|
755
|
+
screenreader_title = content_tag(
|
756
|
+
:span,
|
757
|
+
I18n.t("required", scope: "forms"),
|
758
|
+
class: "show-for-sr"
|
759
|
+
)
|
760
|
+
return content_tag(
|
761
|
+
:span,
|
762
|
+
visible_title + screenreader_title,
|
763
|
+
title: I18n.t("required", scope: "forms"),
|
764
|
+
data: { tooltip: true, disable_hover: false, keep_on_hover: true },
|
765
|
+
"aria-haspopup": true,
|
766
|
+
class: "label-required"
|
767
|
+
).html_safe
|
669
768
|
end
|
670
769
|
"".html_safe
|
671
770
|
end
|
@@ -679,6 +778,15 @@ module Decidim
|
|
679
778
|
selected
|
680
779
|
end
|
681
780
|
|
781
|
+
# Private: Returns the help text and error tags at the end of the field.
|
782
|
+
# Modified to change the tag to a valid HTML tag inside the <label> element.
|
783
|
+
def error_and_help_text(attribute, options = {})
|
784
|
+
html = ""
|
785
|
+
html += content_tag(:span, options[:help_text], class: "help-text") if options[:help_text]
|
786
|
+
html += error_for(attribute, options) || ""
|
787
|
+
html.html_safe
|
788
|
+
end
|
789
|
+
|
682
790
|
def ruby_format_to_datepicker(ruby_date_format)
|
683
791
|
ruby_date_format.gsub("%d", "dd").gsub("%m", "mm").gsub("%Y", "yyyy").gsub("%H", "hh").gsub("%M", "ii")
|
684
792
|
end
|
@@ -686,5 +794,94 @@ module Decidim
|
|
686
794
|
def sanitize_tabs_selector(id)
|
687
795
|
id.tr("[", "-").tr("]", "-")
|
688
796
|
end
|
797
|
+
|
798
|
+
def sanitize_for_dom_selector(name)
|
799
|
+
name.to_s.parameterize.underscore
|
800
|
+
end
|
801
|
+
|
802
|
+
def extension_whitelist_help(extension_whitelist)
|
803
|
+
content_tag :p, class: "extensions-help help-text" do
|
804
|
+
safe_join([
|
805
|
+
content_tag(:span, I18n.t("extension_whitelist", scope: "decidim.forms.files")),
|
806
|
+
" ",
|
807
|
+
safe_join(extension_whitelist.map { |ext| content_tag(:b, ext) }, ", ")
|
808
|
+
])
|
809
|
+
end
|
810
|
+
end
|
811
|
+
|
812
|
+
def image_dimensions_help(dimensions_info)
|
813
|
+
content_tag :p, class: "image-dimensions-help help-text" do
|
814
|
+
safe_join([
|
815
|
+
content_tag(:span, I18n.t("dimensions_info", scope: "decidim.forms.images")),
|
816
|
+
" ",
|
817
|
+
content_tag(:span) do
|
818
|
+
safe_join(dimensions_info.map do |_version, info|
|
819
|
+
processor = @template.content_tag(:span, I18n.t("processors.#{info[:processor]}", scope: "decidim.forms.images"))
|
820
|
+
dimensions = @template.content_tag(:b, I18n.t("dimensions", scope: "decidim.forms.images", width: info[:dimensions].first, height: info[:dimensions].last))
|
821
|
+
safe_join([processor, " ", dimensions, ". ".html_safe])
|
822
|
+
end)
|
823
|
+
end
|
824
|
+
])
|
825
|
+
end
|
826
|
+
end
|
827
|
+
|
828
|
+
# Private: Creates a tag from the given options for the field prefix and
|
829
|
+
# suffix. Overridden from Foundation Rails helper to make the generated HTML
|
830
|
+
# valid since these elements are printed within <label> elements and <div>'s
|
831
|
+
# are not allowed there.
|
832
|
+
def tag_from_options(name, options)
|
833
|
+
return "".html_safe unless options && options[:value].present?
|
834
|
+
|
835
|
+
content_tag(:span,
|
836
|
+
content_tag(:span, options[:value], class: name),
|
837
|
+
class: column_classes(options).to_s)
|
838
|
+
end
|
839
|
+
|
840
|
+
# Private: Wraps the prefix and postfix for the field. Overridden from
|
841
|
+
# Foundation Rails helper to make the generated HTML valid since these
|
842
|
+
# elements are printed within <label> elements and <div>'s are not allowed
|
843
|
+
# there.
|
844
|
+
def wrap_prefix_and_postfix(block, prefix_options, postfix_options)
|
845
|
+
prefix = tag_from_options("prefix", prefix_options)
|
846
|
+
postfix = tag_from_options("postfix", postfix_options)
|
847
|
+
|
848
|
+
input_size = calculate_input_size(prefix_options, postfix_options)
|
849
|
+
klass = column_classes(input_size.marshal_dump).to_s
|
850
|
+
input = content_tag(:span, block, class: klass)
|
851
|
+
|
852
|
+
return block unless input_size.changed?
|
853
|
+
|
854
|
+
content_tag(:span, prefix + input + postfix, class: "row collapse")
|
855
|
+
end
|
856
|
+
|
857
|
+
def language_selector_select(locales, tabs_id, name)
|
858
|
+
content_tag(:div) do
|
859
|
+
content_tag(:select, id: tabs_id, class: "language-change") do
|
860
|
+
locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
|
861
|
+
title = if error?(name_with_locale(name, locale))
|
862
|
+
I18n.with_locale(locale) { I18n.t("name_with_error", scope: "locale") }
|
863
|
+
else
|
864
|
+
I18n.with_locale(locale) { I18n.t("name", scope: "locale") }
|
865
|
+
end
|
866
|
+
tab_content_id = sanitize_tabs_selector "#{tabs_id}-#{name}-panel-#{index}"
|
867
|
+
string + content_tag(:option, title, value: "##{tab_content_id}")
|
868
|
+
end
|
869
|
+
end
|
870
|
+
end
|
871
|
+
end
|
872
|
+
|
873
|
+
def language_tabs(locales, tabs_id, name)
|
874
|
+
content_tag(:ul, class: "tabs tabs--lang", id: tabs_id, data: { tabs: true }) do
|
875
|
+
locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
|
876
|
+
string + content_tag(:li, class: tab_element_class_for("title", index)) do
|
877
|
+
title = I18n.with_locale(locale) { I18n.t("name", scope: "locale") }
|
878
|
+
element_class = nil
|
879
|
+
element_class = "is-tab-error" if error?(name_with_locale(name, locale))
|
880
|
+
tab_content_id = sanitize_tabs_selector "#{tabs_id}-#{name}-panel-#{index}"
|
881
|
+
content_tag(:a, title, href: "##{tab_content_id}", class: element_class)
|
882
|
+
end
|
883
|
+
end
|
884
|
+
end
|
885
|
+
end
|
689
886
|
end
|
690
887
|
end
|