decidim-core 0.29.1 → 0.30.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/activity_cell.rb +0 -3
- data/app/cells/decidim/amendable/amend_button_card/show.erb +6 -4
- data/app/cells/decidim/amendable/amend_button_card_cell.rb +8 -0
- data/app/cells/decidim/amendable/amendments/show.erb +1 -1
- data/app/cells/decidim/amendable/promote_button_card/show.erb +2 -0
- data/app/cells/decidim/author/show.erb +5 -4
- data/app/cells/decidim/author_cell.rb +27 -1
- data/app/cells/decidim/card_l/extra_data.erb +1 -0
- data/app/cells/decidim/card_metadata_cell.rb +9 -16
- data/app/cells/decidim/card_s/show.erb +5 -3
- data/app/cells/decidim/comments_button_cell.rb +14 -2
- data/app/cells/decidim/content_blocks/highlighted_elements_cell.rb +2 -0
- data/app/cells/decidim/content_blocks/highlighted_elements_with_cell_for_list_cell.rb +1 -1
- data/app/cells/decidim/diff_cell.rb +4 -0
- data/app/cells/decidim/endorsement_block/show.erb +0 -1
- data/app/cells/decidim/endorsement_block_cell.rb +6 -0
- data/app/cells/decidim/endorsement_buttons/button_content.erb +1 -1
- data/app/cells/decidim/endorsement_buttons/select_identity_button.erb +1 -1
- data/app/cells/decidim/endorsement_buttons/show.erb +7 -7
- data/app/cells/decidim/endorsement_buttons/verification_modal.erb +4 -2
- data/app/cells/decidim/endorsers_list/empty.erb +3 -0
- data/app/cells/decidim/endorsers_list/full.erb +17 -5
- data/app/cells/decidim/endorsers_list/show.erb +19 -10
- data/app/cells/decidim/endorsers_list_cell.rb +19 -6
- data/app/cells/decidim/follow_button/show.erb +1 -2
- data/app/cells/decidim/follow_button_cell.rb +5 -0
- data/app/cells/decidim/map/show.erb +3 -0
- data/app/cells/decidim/map/template.erb +14 -0
- data/app/cells/decidim/map_cell.rb +39 -0
- data/app/cells/decidim/newsletter_templates/image_text_cta_cell.rb +1 -1
- data/app/cells/decidim/notification_actions/buttons_cell.rb +1 -1
- data/app/cells/decidim/onboarding_action_message/show.erb +15 -0
- data/app/cells/decidim/onboarding_action_message_cell.rb +81 -0
- data/app/cells/decidim/participatory_space_private_user/show.erb +23 -0
- data/app/cells/decidim/participatory_space_private_user_cell.rb +21 -0
- data/app/cells/decidim/progress_bar/show.erb +2 -2
- data/app/cells/decidim/report_button_cell.rb +1 -0
- data/app/cells/decidim/resource_history/show.erb +20 -0
- data/app/cells/decidim/resource_history_cell.rb +66 -0
- data/app/cells/decidim/share_button_cell.rb +0 -4
- data/app/cells/decidim/share_widget/modal.erb +26 -0
- data/app/cells/decidim/share_widget/show.erb +2 -0
- data/app/cells/decidim/share_widget_cell.rb +20 -0
- data/app/cells/decidim/tags/show.erb +7 -4
- data/app/cells/decidim/tags_cell.rb +11 -72
- data/app/cells/decidim/translation_bar/show.erb +2 -2
- data/app/cells/decidim/translation_bar_cell.rb +1 -1
- data/app/commands/decidim/amendable/create_draft.rb +2 -2
- data/app/commands/decidim/create_ephemeral_user.rb +52 -0
- data/app/commands/decidim/create_omniauth_registration.rb +13 -3
- data/app/commands/decidim/create_report.rb +1 -5
- data/app/commands/decidim/create_user_group.rb +6 -2
- data/app/commands/decidim/destroy_account.rb +3 -0
- data/app/commands/decidim/destroy_ephemeral_user.rb +47 -0
- data/app/commands/decidim/update_account.rb +11 -3
- data/app/commands/decidim/update_notifications_settings.rb +1 -0
- data/app/commands/decidim/update_resources_taxonomies.rb +67 -0
- data/app/commands/decidim/update_user_group.rb +7 -1
- data/app/constraints/decidim/current_component.rb +1 -1
- data/app/controllers/concerns/decidim/ajax_permission_handler.rb +21 -0
- data/app/controllers/concerns/decidim/devise_authentication_methods.rb +3 -6
- data/app/controllers/concerns/decidim/devise_controllers.rb +2 -0
- data/app/controllers/concerns/decidim/disable_redirection_to_external_host.rb +1 -1
- data/app/controllers/concerns/decidim/ephemeral_session_checker.rb +87 -0
- data/app/controllers/concerns/decidim/filter_resource.rb +4 -2
- data/app/controllers/concerns/decidim/has_members_page.rb +25 -0
- data/app/controllers/concerns/decidim/headers/browser_feature_permissions.rb +50 -0
- data/app/controllers/concerns/decidim/locale_switcher.rb +2 -2
- data/app/controllers/concerns/decidim/needs_password_change.rb +0 -1
- data/app/controllers/concerns/decidim/needs_permission.rb +2 -1
- data/app/controllers/concerns/decidim/needs_tos_accepted.rb +4 -5
- data/app/controllers/concerns/decidim/onboarding_action_methods.rb +52 -0
- data/app/controllers/decidim/application_controller.rb +10 -0
- data/app/controllers/decidim/authorization_modals_controller.rb +8 -2
- data/app/controllers/decidim/components/base_controller.rb +3 -7
- data/app/controllers/decidim/devise/confirmations_controller.rb +4 -0
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +8 -1
- data/app/controllers/decidim/devise/registrations_controller.rb +1 -1
- data/app/controllers/decidim/devise/sessions_controller.rb +2 -0
- data/app/controllers/decidim/doorkeeper/credentials_controller.rb +1 -1
- data/app/controllers/decidim/download_your_data_controller.rb +33 -2
- data/app/controllers/decidim/editor_images_controller.rb +1 -11
- data/app/controllers/decidim/follows_controller.rb +1 -1
- data/app/controllers/decidim/geolocation_controller.rb +19 -0
- data/app/controllers/decidim/homepage_controller.rb +0 -1
- data/app/controllers/decidim/links_controller.rb +1 -1
- data/app/controllers/decidim/open_data_controller.rb +33 -8
- data/app/controllers/decidim/profiles_controller.rb +4 -0
- data/app/controllers/decidim/user_conversations_controller.rb +1 -11
- data/app/events/decidim/soft_delete_resource_event.rb +15 -0
- data/app/forms/decidim/amendable/form.rb +4 -2
- data/app/forms/decidim/ephemeral_user_form.rb +22 -0
- data/app/forms/decidim/notifications_settings_form.rb +1 -0
- data/app/forms/decidim/omniauth_registration_form.rb +14 -1
- data/app/helpers/concerns/decidim/flash_helper_extensions.rb +17 -2
- data/app/helpers/concerns/decidim/user_role_checker.rb +46 -0
- data/app/helpers/decidim/action_authorization_helper.rb +75 -14
- data/app/helpers/decidim/amendments_helper.rb +0 -9
- data/app/helpers/decidim/application_helper.rb +6 -2
- data/app/helpers/decidim/breadcrumb_helper.rb +6 -0
- data/app/helpers/decidim/cache_helper.rb +1 -1
- data/app/helpers/decidim/check_boxes_tree_helper.rb +25 -53
- data/app/helpers/decidim/cta_button_helper.rb +1 -1
- data/app/helpers/decidim/decidim_form_helper.rb +0 -44
- data/app/helpers/decidim/endorsable_helper.rb +0 -10
- data/app/helpers/decidim/layout_helper.rb +6 -0
- data/app/helpers/decidim/map_helper.rb +6 -1
- data/app/helpers/decidim/messaging/conversation_helper.rb +2 -3
- data/app/helpers/decidim/meta_tags_helper.rb +32 -23
- data/app/helpers/decidim/modal_helper.rb +23 -0
- data/app/helpers/decidim/omniauth_helper.rb +5 -5
- data/app/helpers/decidim/onboarding_action_helper.rb +13 -0
- data/app/helpers/decidim/passwords_helper.rb +2 -2
- data/app/helpers/decidim/sanitize_helper.rb +11 -2
- data/app/helpers/decidim/taxonomies_helper.rb +40 -0
- data/app/jobs/decidim/download_your_data_export_job.rb +2 -19
- data/app/jobs/decidim/event_publisher_job.rb +18 -9
- data/app/jobs/decidim/export_job.rb +5 -1
- data/app/jobs/decidim/export_participatory_space_job.rb +4 -1
- data/app/jobs/decidim/open_data_job.rb +4 -4
- data/app/mailers/decidim/export_mailer.rb +7 -12
- data/app/models/decidim/action_log.rb +11 -0
- data/app/models/decidim/attachment.rb +1 -1
- data/app/models/decidim/category.rb +4 -0
- data/app/models/decidim/component.rb +25 -3
- data/app/models/decidim/metric.rb +2 -1
- data/app/models/decidim/moderation.rb +16 -0
- data/app/models/decidim/newsletter.rb +12 -8
- data/app/models/decidim/organization.rb +7 -3
- data/app/models/decidim/participatory_space_private_user.rb +20 -0
- data/app/models/decidim/private_export.rb +24 -0
- data/app/models/decidim/push_notification_message.rb +1 -1
- data/app/models/decidim/scope.rb +4 -0
- data/app/models/decidim/share_token.rb +36 -10
- data/app/models/decidim/taxonomization.rb +23 -0
- data/app/models/decidim/taxonomy.rb +139 -0
- data/app/models/decidim/taxonomy_filter.rb +130 -0
- data/app/models/decidim/taxonomy_filter_item.rb +33 -0
- data/app/models/decidim/user.rb +9 -23
- data/app/models/decidim/user_base_entity.rb +12 -0
- data/app/models/decidim/user_moderation.rb +9 -0
- data/app/models/decidim/user_report.rb +4 -0
- data/app/packs/entrypoints/decidim_core.js +1 -0
- data/app/packs/entrypoints/decidim_geocoding.js +2 -0
- data/app/packs/images/decidim/brands/facebook.svg +10 -0
- data/app/packs/images/decidim/brands/google.svg +7 -1
- data/app/packs/images/decidim/brands/twitter-x.svg +3 -0
- data/app/packs/src/decidim/append_redirect_url_to_modals.js +14 -6
- data/app/packs/src/decidim/check_boxes_tree.js +0 -1
- data/app/packs/src/decidim/clipboard.js +18 -9
- data/app/packs/src/decidim/confirm.js +79 -59
- data/app/packs/src/decidim/decidim_application.js +1 -0
- data/app/packs/src/decidim/direct_uploads/upload_field.js +21 -8
- data/app/packs/src/decidim/form_remote.js +1 -1
- data/app/packs/src/decidim/geocoding/reverse_geocoding.js +60 -0
- data/app/packs/src/decidim/impersonation.js +1 -1
- data/app/packs/src/decidim/index.js +14 -1
- data/app/packs/src/decidim/onboarding_pending_action.js +24 -0
- data/app/packs/src/decidim/remote_tooltips.js +38 -0
- data/app/packs/src/decidim/session_timeouter.js +1 -1
- data/app/packs/src/decidim/sticky_footer.js +29 -0
- data/app/packs/src/decidim/sticky_header.js +6 -31
- data/app/packs/src/decidim/toggle.js +1 -1
- data/app/packs/src/decidim/tooltips.js +42 -22
- data/app/packs/src/decidim/user_registrations.js +13 -0
- data/app/packs/src/decidim/utilities/dom.js +148 -0
- data/app/packs/stylesheets/decidim/_accordion.scss +30 -0
- data/app/packs/stylesheets/decidim/_buttons.scss +19 -0
- data/app/packs/stylesheets/decidim/_dropdown.scss +1 -1
- data/app/packs/stylesheets/decidim/_endorsers_list.scss +26 -20
- data/app/packs/stylesheets/decidim/_forms.scss +2 -2
- data/app/packs/stylesheets/decidim/_header.scss +5 -3
- data/app/packs/stylesheets/decidim/_labels.scss +1 -1
- data/app/packs/stylesheets/decidim/_layout.scss +32 -2
- data/app/packs/stylesheets/decidim/_login.scss +53 -6
- data/app/packs/stylesheets/decidim/_modal.scss +42 -0
- data/app/packs/stylesheets/decidim/_modal_tos_refuse.scss +4 -0
- data/app/packs/stylesheets/decidim/_participatory_spaces.scss +46 -0
- data/app/packs/stylesheets/decidim/_profile.scss +2 -2
- data/app/packs/stylesheets/decidim/_progress-bar.scss +1 -1
- data/app/packs/stylesheets/decidim/_success_image.scss +64 -0
- data/app/packs/stylesheets/decidim/_tribute.scss +36 -0
- data/app/packs/stylesheets/decidim/application.scss +1 -0
- data/app/packs/stylesheets/decidim/geocoding_addons.scss +5 -0
- data/app/packs/stylesheets/decidim/legacy/conference-diploma.scss +2 -1
- data/app/packs/stylesheets/decidim/map.scss +7 -10
- data/app/packs/stylesheets/decidim/resource_history.scss +31 -0
- data/app/permissions/decidim/permissions.rb +8 -2
- data/app/presenters/decidim/admin_log/base_user_presenter.rb +67 -0
- data/app/presenters/decidim/admin_log/component_presenter.rb +32 -3
- data/app/presenters/decidim/admin_log/moderation_presenter.rb +30 -3
- data/app/presenters/decidim/admin_log/share_token_presenter.rb +39 -0
- data/app/presenters/decidim/admin_log/taxonomy_filter_presenter.rb +57 -0
- data/app/presenters/decidim/admin_log/taxonomy_presenter.rb +48 -0
- data/app/presenters/decidim/admin_log/user_group_presenter.rb +6 -6
- data/app/presenters/decidim/admin_log/user_presenter.rb +4 -18
- data/app/presenters/decidim/attachment_presenter.rb +1 -1
- data/app/presenters/decidim/log/value_types/date_presenter.rb +1 -0
- data/app/presenters/decidim/log/value_types/taxonomy_presenter.rb +29 -0
- data/app/presenters/decidim/participatory_space_private_user_presenter.rb +50 -0
- data/app/presenters/decidim/taxonomy_filter_presenter.rb +19 -0
- data/app/presenters/decidim/taxonomy_presenter.rb +14 -0
- data/app/queries/decidim/metrics/blocked_users_metric_manage.rb +2 -2
- data/app/queries/decidim/metrics/users_metric_manage.rb +2 -2
- data/app/queries/decidim/public_activities.rb +1 -12
- data/app/queries/decidim/stats_users_count.rb +2 -2
- data/app/resolvers/decidim/meta_image_url_resolver.rb +128 -0
- data/app/serializers/decidim/exporters/open_data_blocked_user_serializer.rb +25 -0
- data/app/serializers/decidim/exporters/open_data_metric_serializer.rb +22 -0
- data/app/serializers/decidim/exporters/open_data_moderation_serializer.rb +30 -0
- data/app/serializers/decidim/exporters/open_data_taxonomy_serializer.rb +30 -0
- data/app/serializers/decidim/exporters/open_data_user_group_serializer.rb +38 -0
- data/app/serializers/decidim/exporters/open_data_user_serializer.rb +39 -0
- data/app/serializers/decidim/exporters/participatory_space_serializer.rb +104 -0
- data/app/serializers/decidim/exporters/serializer.rb +25 -0
- data/app/serializers/decidim/schema_org_breadcrumb_list_serializer.rb +52 -0
- data/app/services/decidim/action_authorizer.rb +32 -3
- data/app/services/decidim/base_diff_renderer.rb +27 -3
- data/app/services/decidim/download_your_data_exporter.rb +58 -24
- data/app/services/decidim/email_notification_generator.rb +14 -5
- data/app/services/decidim/onboarding_manager.rb +272 -0
- data/app/services/decidim/open_data_exporter.rb +139 -13
- data/app/services/decidim/traceability.rb +13 -0
- data/app/uploaders/decidim/application_uploader.rb +1 -1
- data/app/validators/etiquette_validator.rb +9 -2
- data/app/validators/passthru_validator.rb +1 -1
- data/app/validators/translated_etiquette_validator.rb +32 -0
- data/app/views/decidim/account/_password_fields.html.erb +2 -2
- data/app/views/decidim/application/_accordion_section.html.erb +14 -0
- data/app/views/decidim/application/_collection.html.erb +30 -18
- data/app/views/decidim/devise/omniauth_registrations/new.html.erb +5 -1
- data/app/views/decidim/devise/omniauth_registrations/new_tos_fields.html.erb +29 -0
- data/app/views/decidim/devise/registrations/new.html.erb +10 -22
- data/app/views/decidim/devise/sessions/new.html.erb +24 -29
- data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +2 -4
- data/app/views/decidim/devise/shared/_tos_fields.html.erb +16 -0
- data/app/views/decidim/download_your_data/_export.html.erb +15 -0
- data/app/views/decidim/download_your_data/show.html.erb +51 -5
- data/app/views/decidim/endorsements/update_buttons_and_counters.js.erb +16 -19
- data/app/views/decidim/export_mailer/download_your_data_export.html.erb +2 -2
- data/app/views/decidim/export_mailer/export.html.erb +5 -1
- data/app/views/decidim/notifications_settings/show.html.erb +22 -0
- data/app/views/decidim/open_data/_how_to_open_accordion_section.html.erb +15 -0
- data/app/views/decidim/open_data/index.html.erb +108 -0
- data/app/views/decidim/pages/_tabbed.html.erb +2 -2
- data/app/views/decidim/pages/show.html.erb +2 -1
- data/app/views/decidim/participatory_space_private_users/_participatory_space_private_user.html.erb +1 -0
- data/app/views/decidim/shared/_login_modal.html.erb +26 -20
- data/app/views/decidim/shared/_resource_actions.html.erb +21 -0
- data/app/views/decidim/shared/filters/_check_boxes_tree.html.erb +1 -2
- data/app/views/decidim/shared/filters/_collection.html.erb +1 -1
- data/app/views/decidim/shared/filters/_dropdown_label.html.erb +7 -4
- data/app/views/layouts/decidim/_application.html.erb +0 -1
- data/app/views/layouts/decidim/_js_configuration.html.erb +1 -0
- data/app/views/layouts/decidim/_logo.html.erb +1 -1
- data/app/views/layouts/decidim/_logo_mobile.html.erb +1 -1
- data/app/views/layouts/decidim/_meta_tags_config.html.erb +6 -11
- data/app/views/layouts/decidim/_schema_org_breadcrumb_list.html.erb +3 -0
- data/app/views/layouts/decidim/_wrapper.html.erb +15 -9
- data/app/views/layouts/decidim/footer/_main_links.html.erb +1 -1
- data/app/views/layouts/decidim/header/_close_ephemeral_session.html.erb +25 -0
- data/app/views/layouts/decidim/header/_main.html.erb +14 -10
- data/app/views/layouts/decidim/header/_menu_breadcrumb_items.html.erb +2 -0
- data/app/views/layouts/decidim/header/_menu_breadcrumb_mobile_tablet.html.erb +1 -1
- data/app/views/layouts/decidim/shared/_layout_item.html.erb +1 -1
- data/config/assets.rb +2 -1
- data/config/locales/ar.yml +38 -54
- data/config/locales/bg.yml +3 -64
- data/config/locales/bn-BD.yml +1 -0
- data/config/locales/bs-BA.yml +98 -0
- data/config/locales/ca.yml +380 -69
- data/config/locales/cs.yml +369 -55
- data/config/locales/de.yml +371 -67
- data/config/locales/el.yml +5 -45
- data/config/locales/en.yml +365 -54
- data/config/locales/eo.yml +0 -2
- data/config/locales/es-MX.yml +366 -58
- data/config/locales/es-PY.yml +366 -58
- data/config/locales/es.yml +375 -64
- data/config/locales/eu.yml +547 -223
- data/config/locales/fi-plain.yml +361 -57
- data/config/locales/fi.yml +400 -93
- data/config/locales/fr-CA.yml +181 -55
- data/config/locales/fr.yml +182 -53
- data/config/locales/ga-IE.yml +4 -16
- data/config/locales/gl.yml +5 -30
- data/config/locales/hu.yml +3 -55
- data/config/locales/id-ID.yml +5 -30
- data/config/locales/is-IS.yml +4 -13
- data/config/locales/it.yml +10 -46
- data/config/locales/ja.yml +230 -69
- data/config/locales/lb.yml +5 -47
- data/config/locales/lt.yml +5 -59
- data/config/locales/lv.yml +5 -36
- data/config/locales/nl.yml +5 -48
- data/config/locales/no.yml +6 -47
- data/config/locales/pl.yml +4 -66
- data/config/locales/pt-BR.yml +12 -52
- data/config/locales/pt.yml +11 -47
- data/config/locales/ro-RO.yml +448 -247
- data/config/locales/ru.yml +4 -16
- data/config/locales/sk.yml +5 -37
- data/config/locales/sv.yml +108 -64
- data/config/locales/tr-TR.yml +5 -45
- data/config/locales/uk.yml +4 -15
- data/config/locales/zh-CN.yml +5 -45
- data/config/locales/zh-TW.yml +5 -50
- data/config/routes.rb +5 -10
- data/db/migrate/20181025082245_add_timestamps_to_components.rb +2 -0
- data/db/migrate/20240628111905_add_visible_to_components.rb +7 -0
- data/db/migrate/20240704115429_create_decidim_taxonomies.rb +23 -0
- data/db/migrate/20240717093514_add_registered_only_to_decidim_share_tokens.rb +7 -0
- data/db/migrate/20240722215500_change_object_changes_on_versions.rb +39 -0
- data/db/migrate/20240806065417_create_decidim_taxonomy_filters.rb +23 -0
- data/db/migrate/20240822161348_add_deleted_at_to_decidim_components.rb +8 -0
- data/db/migrate/20240906162524_add_part_of_to_taxonomies.rb +26 -0
- data/db/migrate/20241001135825_add_role_to_participatory_space_private_users.rb +7 -0
- data/db/migrate/20241001140408_add_published_to_participatory_space_private_users.rb +7 -0
- data/db/migrate/20241022002600_create_private_exports.rb +18 -0
- data/db/migrate/20241028114430_add_component_counter_to_taxonomy_filters.rb +7 -0
- data/db/migrate/20241111104357_add_names_and_space_boolean_to_taxonomy_filters.rb +9 -0
- data/db/migrate/20241127093708_add_taxonomy_to_metrics.rb +7 -0
- data/db/migrate/20241204121445_add_participatory_space_manifests_from_taxonomy_filters.rb +9 -0
- data/decidim-core.gemspec +18 -18
- data/lib/decidim/action_authorization.rb +3 -2
- data/lib/decidim/amendable.rb +1 -1
- data/lib/decidim/api/functions/component_list.rb +1 -1
- data/lib/decidim/api/functions/participatory_space_finder_base.rb +11 -1
- data/lib/decidim/api/input_filters/category_input_filter.rb +5 -3
- data/lib/decidim/api/input_filters/component_input_filter.rb +33 -20
- data/lib/decidim/api/input_filters/user_entity_input_filter.rb +53 -44
- data/lib/decidim/api/input_sorts/component_input_sort.rb +15 -13
- data/lib/decidim/api/input_sorts/user_entity_input_sort.rb +4 -4
- data/lib/decidim/api/interfaces/author_interface.rb +3 -2
- data/lib/decidim/api/interfaces/coauthorable_interface.rb +5 -5
- data/lib/decidim/api/interfaces/endorsable_interface.rb +2 -2
- data/lib/decidim/api/interfaces/participatory_space_interface.rb +5 -10
- data/lib/decidim/api/interfaces/taxonomizable_interface.rb +13 -0
- data/lib/decidim/api/types/amendment_type.rb +5 -7
- data/lib/decidim/api/types/area_api_type.rb +3 -3
- data/lib/decidim/api/types/attachment_type.rb +3 -3
- data/lib/decidim/api/types/category_type.rb +2 -2
- data/lib/decidim/api/types/component_type.rb +7 -0
- data/lib/decidim/api/types/decidim_type.rb +5 -1
- data/lib/decidim/api/types/fingerprint_type.rb +1 -1
- data/lib/decidim/api/types/localized_string_type.rb +1 -1
- data/lib/decidim/api/types/metric_history_type.rb +2 -0
- data/lib/decidim/api/types/metric_type.rb +1 -1
- data/lib/decidim/api/types/organization_type.rb +5 -0
- data/lib/decidim/api/types/participatory_space_link_type.rb +2 -2
- data/lib/decidim/api/types/participatory_space_manifest_type.rb +1 -1
- data/lib/decidim/api/types/quantifiable_translated_field_type.rb +1 -1
- data/lib/decidim/api/types/scope_api_type.rb +2 -3
- data/lib/decidim/api/types/session_type.rb +1 -2
- data/lib/decidim/api/types/taxonomy_type.rb +15 -0
- data/lib/decidim/api/types/trace_version_type.rb +2 -2
- data/lib/decidim/api/types/translated_field_type.rb +3 -5
- data/lib/decidim/api/types/user_group_type.rb +11 -20
- data/lib/decidim/api/types/user_type.rb +9 -18
- data/lib/decidim/asset_router/storage.rb +4 -4
- data/lib/decidim/assets/tailwind/tailwind.config.js.erb +2 -1
- data/lib/decidim/attachment_attributes.rb +1 -1
- data/lib/decidim/attribute_encryptor.rb +1 -1
- data/lib/decidim/attribute_object/nested_validator.rb +1 -1
- data/lib/decidim/attributes/integer_with_units.rb +27 -0
- data/lib/decidim/attributes/rich_text.rb +38 -0
- data/lib/decidim/attributes/time_with_zone.rb +11 -1
- data/lib/decidim/attributes.rb +4 -0
- data/lib/decidim/authorization_form_builder.rb +0 -7
- data/lib/decidim/coauthorable.rb +1 -1
- data/lib/decidim/command.rb +3 -3
- data/lib/decidim/commands/destroy_resource.rb +5 -1
- data/lib/decidim/commands/resource_handler.rb +2 -2
- data/lib/decidim/commands/restore_resource.rb +45 -0
- data/lib/decidim/commands/soft_delete_resource.rb +63 -0
- data/lib/decidim/component_manifest.rb +7 -0
- data/lib/decidim/content_parsers/blob_parser.rb +93 -0
- data/lib/decidim/content_parsers.rb +1 -0
- data/lib/decidim/content_renderers/blob_renderer.rb +90 -0
- data/lib/decidim/content_renderers.rb +1 -0
- data/lib/decidim/core/api.rb +2 -0
- data/lib/decidim/core/engine.rb +50 -8
- data/lib/decidim/core/menu.rb +0 -5
- data/lib/decidim/core/seeds.rb +42 -2
- data/lib/decidim/core/test/factories.rb +133 -2
- data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +85 -0
- data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +408 -40
- data/lib/decidim/core/test/shared_examples/components_controller_hide_shared_examples.rb +11 -0
- data/lib/decidim/core/test/shared_examples/components_controller_reorder_shared_examples.rb +21 -0
- data/lib/decidim/core/test/shared_examples/download_open_data_shared_context.rb +36 -0
- data/lib/decidim/core/test/shared_examples/download_open_data_shared_examples.rb +45 -0
- data/lib/decidim/core/test/shared_examples/download_your_data_shared_examples.rb +17 -0
- data/lib/decidim/core/test/shared_examples/etiquette_validator_examples.rb +25 -0
- data/lib/decidim/core/test/shared_examples/follows_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/has_taxonomies.rb +94 -0
- data/lib/decidim/core/test/shared_examples/manage_share_tokens_examples.rb +237 -0
- data/lib/decidim/core/test/shared_examples/map_examples.rb +2 -0
- data/lib/decidim/core/test/shared_examples/open_data_exporter_examples.rb +102 -0
- data/lib/decidim/core/test/shared_examples/participatory_space_members_page_examples.rb +46 -0
- data/lib/decidim/core/test/shared_examples/participatory_space_search_examples.rb +98 -0
- data/lib/decidim/core/test/shared_examples/permissions.rb +7 -7
- data/lib/decidim/core/test/shared_examples/preview_with_share_token_examples.rb +94 -0
- data/lib/decidim/core/test/shared_examples/reports_examples.rb +9 -5
- data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/resource_search_examples.rb +75 -69
- data/lib/decidim/core/test/shared_examples/searchable_resources_shared_context.rb +1 -1
- data/lib/decidim/core/test/shared_examples/simple_event.rb +33 -19
- data/lib/decidim/core/test/shared_examples/social_share_examples.rb +25 -0
- data/lib/decidim/core/test/shared_examples/softdeleteable_components_examples.rb +173 -0
- data/lib/decidim/core/test/shared_examples/system_endorse_resource_examples.rb +54 -8
- data/lib/decidim/core/test/shared_examples/taxonomizable_interface_examples.rb +20 -0
- data/lib/decidim/core/test/shared_examples/taxonomizable_resource_examples.rb +37 -0
- data/lib/decidim/core/test/shared_examples/taxonomy_settings.rb +49 -0
- data/lib/decidim/core/test/shared_examples/translated_event_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/versions_controller_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/with_endorsable_permissions_examples.rb +1 -1
- data/lib/decidim/core/test.rb +9 -5
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +58 -0
- data/lib/decidim/diffy_extension.rb +18 -0
- data/lib/decidim/download_your_data_serializers/download_your_data_identity_serializer.rb +0 -4
- data/lib/decidim/download_your_data_serializers/download_your_data_participatory_space_private_user_serializer.rb +3 -1
- data/lib/decidim/download_your_data_serializers/download_your_data_report_serializer.rb +2 -1
- data/lib/decidim/download_your_data_serializers/download_your_data_user_serializer.rb +6 -7
- data/lib/decidim/download_your_data_serializers.rb +19 -0
- data/lib/decidim/exporters/csv.rb +6 -0
- data/lib/decidim/exporters/export_manifest.rb +14 -0
- data/lib/decidim/exporters/pdf.rb +26 -22
- data/lib/decidim/filter_form_builder.rb +12 -15
- data/lib/decidim/form_builder.rb +7 -130
- data/lib/decidim/has_category.rb +5 -1
- data/lib/decidim/has_private_users.rb +4 -0
- data/lib/decidim/has_taxonomy_settings.rb +47 -0
- data/lib/decidim/has_upload_validations.rb +1 -1
- data/lib/decidim/legacy_form_builder.rb +118 -0
- data/lib/decidim/maintenance/import_models/application_record.rb +93 -0
- data/lib/decidim/maintenance/import_models/area.rb +82 -0
- data/lib/decidim/maintenance/import_models/area_type.rb +12 -0
- data/lib/decidim/maintenance/import_models/assembly_type.rb +49 -0
- data/lib/decidim/maintenance/import_models/categorization.rb +14 -0
- data/lib/decidim/maintenance/import_models/category.rb +107 -0
- data/lib/decidim/maintenance/import_models/participatory_process_type.rb +21 -0
- data/lib/decidim/maintenance/import_models/scope.rb +163 -0
- data/lib/decidim/maintenance/import_models.rb +19 -0
- data/lib/decidim/maintenance/taxonomy_importer.rb +132 -0
- data/lib/decidim/maintenance/taxonomy_plan.rb +78 -0
- data/lib/decidim/maintenance.rb +12 -0
- data/lib/decidim/map/autocomplete.rb +53 -8
- data/lib/decidim/map/dynamic_map.rb +1 -1
- data/lib/decidim/map/provider/geocoding/here.rb +9 -3
- data/lib/decidim/map.rb +3 -6
- data/lib/decidim/moderation_tools.rb +14 -3
- data/lib/decidim/newsletter_encryptor.rb +1 -1
- data/lib/decidim/paddable.rb +1 -1
- data/lib/decidim/participable.rb +10 -10
- data/lib/decidim/participatory_space_user.rb +14 -0
- data/lib/decidim/private_download_helper.rb +15 -0
- data/lib/decidim/query_extensions.rb +0 -26
- data/lib/decidim/record_encryptor.rb +51 -46
- data/lib/decidim/resourceable.rb +16 -0
- data/lib/decidim/seeds.rb +18 -20
- data/lib/decidim/settings_manifest.rb +36 -1
- data/lib/decidim/soft_deletable.rb +17 -0
- data/lib/decidim/taxonomizable.rb +72 -0
- data/lib/decidim/translatable_attributes.rb +6 -1
- data/lib/decidim/view_model.rb +0 -1
- data/lib/tasks/decidim_download_your_data_tasks.rake +2 -4
- data/lib/tasks/decidim_procfile.rake +6 -0
- data/lib/tasks/decidim_tasks.rake +1 -0
- data/lib/tasks/decidim_taxonomies.rake +155 -0
- data/lib/tasks/upgrade/{decidim_fix_categorization.rake → clean.rake} +52 -19
- data/lib/tasks/upgrade/decidim_active_storage_migration_tasks.rake +1 -1
- data/lib/tasks/upgrade/migrations.rake +91 -0
- metadata +217 -103
- data/app/cells/decidim/amendable/amenders_list/show.erb +0 -0
- data/app/cells/decidim/content_blocks/base/content.erb +0 -0
- data/app/cells/decidim/endorsers_list/full_endorsers_list.erb +0 -3
- data/app/cells/decidim/endorsers_list_button/content.erb +0 -1
- data/app/cells/decidim/endorsers_list_button_cell.rb +0 -15
- data/app/cells/decidim/scopes_picker/scope_picker_prompt.erb +0 -3
- data/app/cells/decidim/scopes_picker/scope_picker_values.erb +0 -5
- data/app/cells/decidim/scopes_picker/show.erb +0 -14
- data/app/cells/decidim/scopes_picker_cell.rb +0 -92
- data/app/commands/decidim/update_user_interests.rb +0 -41
- data/app/controllers/decidim/scopes_controller.rb +0 -84
- data/app/controllers/decidim/user_interests_controller.rb +0 -30
- data/app/forms/decidim/user_interest_scope_form.rb +0 -25
- data/app/forms/decidim/user_interests_form.rb +0 -17
- data/app/helpers/decidim/categories_helper.rb +0 -26
- data/app/helpers/decidim/scopes_helper.rb +0 -105
- data/app/packs/images/decidim/vendor/leaflet/layers-2x.png +0 -0
- data/app/packs/images/decidim/vendor/leaflet/layers.png +0 -0
- data/app/packs/images/decidim/vendor/leaflet/marker-icon-2x.png +0 -0
- data/app/packs/images/decidim/vendor/leaflet/marker-icon.png +0 -0
- data/app/packs/images/decidim/vendor/leaflet/marker-shadow.png +0 -0
- data/app/packs/stylesheets/decidim/legacy/MarkerCluster.Default.scss +0 -67
- data/app/packs/stylesheets/decidim/legacy/MarkerCluster.scss +0 -18
- data/app/packs/stylesheets/decidim/legacy/leaflet.scss +0 -705
- data/app/validators/scope_belongs_to_component_validator.rb +0 -16
- data/app/views/decidim/account/_user_groups.html.erb +0 -0
- data/app/views/decidim/scopes/_scopes_picker_input.html.erb +0 -19
- data/app/views/decidim/scopes/picker.html.erb +0 -53
- data/app/views/decidim/shared/_comments.html.erb +0 -0
- data/app/views/decidim/shared/_share_modal.html.erb +0 -26
- data/app/views/decidim/shared/_tags.html.erb +0 -1
- data/app/views/decidim/user_interests/_areas.html.erb +0 -14
- data/app/views/decidim/user_interests/_scopes.html.erb +0 -22
- data/app/views/decidim/user_interests/show.html.erb +0 -22
- data/config/initializers/foundation_rails_helper.rb +0 -4
- data/lib/decidim/core/test/shared_examples/has_category.rb +0 -38
- data/lib/decidim/core/test/shared_examples/has_scope.rb +0 -11
- data/lib/decidim/core/test/shared_examples/manage_component_share_tokens.rb +0 -83
- data/lib/decidim/core/test/shared_examples/preview_component_with_share_token_examples.rb +0 -49
- data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +0 -93
- data/lib/decidim/seven_zip_wrapper.rb +0 -29
@@ -9,6 +9,7 @@ module Decidim
|
|
9
9
|
# used in filters that uses checkboxes trees
|
10
10
|
def check_boxes_tree_options(value, label, **options)
|
11
11
|
parent_id = options.delete(:parent_id) || ""
|
12
|
+
object = options.delete(:object)
|
12
13
|
checkbox_options = {
|
13
14
|
value:,
|
14
15
|
label:,
|
@@ -16,10 +17,16 @@ module Decidim
|
|
16
17
|
include_hidden: false,
|
17
18
|
label_options: {
|
18
19
|
"data-children-checkbox": parent_id,
|
19
|
-
value
|
20
|
+
value:,
|
21
|
+
for: "#{options[:namespace]}_#{options[:id]}"
|
20
22
|
}
|
21
23
|
}
|
22
24
|
options.merge!(checkbox_options)
|
25
|
+
# as taxonomies work with a nested array of values, we need to manually check if the value is checked
|
26
|
+
matches = options[:id]&.match(/^with_any_taxonomies_([0-9]+)__taxonomy-([0-9_]+)/)
|
27
|
+
if matches.present? && object.respond_to?(:with_any_taxonomies) && object.with_any_taxonomies&.dig(matches[1]).is_a?(Array)
|
28
|
+
options[:checked] = object.with_any_taxonomies[matches[1]].include?(value.to_s)
|
29
|
+
end
|
23
30
|
|
24
31
|
if options.delete(:is_root_check_box) == true
|
25
32
|
options[:label_options].merge!("data-global-checkbox": "")
|
@@ -37,10 +44,14 @@ module Decidim
|
|
37
44
|
end
|
38
45
|
|
39
46
|
# struct for leafs of checkboxes trees
|
40
|
-
TreePoint = Struct.new(:value, :label) do
|
47
|
+
TreePoint = Struct.new(:value, :label, :root) do
|
41
48
|
def tree_node?
|
42
49
|
is_a?(TreeNode)
|
43
50
|
end
|
51
|
+
|
52
|
+
def root?
|
53
|
+
root.present? || value.blank?
|
54
|
+
end
|
44
55
|
end
|
45
56
|
|
46
57
|
# Overwrite this method in your component helper to define
|
@@ -49,52 +60,29 @@ module Decidim
|
|
49
60
|
raise StandardError, "Not implemented"
|
50
61
|
end
|
51
62
|
|
52
|
-
def
|
53
|
-
|
54
|
-
[category.weight, decidim_escape_translated(category.name)]
|
55
|
-
end
|
56
|
-
|
57
|
-
categories_values = sorted_main_categories.flat_map do |category|
|
58
|
-
sorted_descendant_categories = category.descendants.includes(:subcategories).sort_by do |subcategory|
|
59
|
-
[subcategory.weight, decidim_escape_translated(subcategory.name)]
|
60
|
-
end
|
61
|
-
|
62
|
-
subcategories = sorted_descendant_categories.flat_map do |subcategory|
|
63
|
-
TreePoint.new(subcategory.id.to_s, decidim_escape_translated(subcategory.name))
|
64
|
-
end
|
65
|
-
|
66
|
-
TreeNode.new(
|
67
|
-
TreePoint.new(category.id.to_s, decidim_escape_translated(category.name)),
|
68
|
-
subcategories
|
69
|
-
)
|
70
|
-
end
|
71
|
-
|
63
|
+
def filter_taxonomy_values_for(taxonomy_filter)
|
64
|
+
taxonomies = filter_taxonomy_values_children(taxonomy_filter.taxonomies)
|
72
65
|
TreeNode.new(
|
73
|
-
TreePoint.new(
|
74
|
-
|
66
|
+
TreePoint.new(taxonomy_filter.root_taxonomy_id, t("decidim.core.application_helper.filter_taxonomy_values.all"), true),
|
67
|
+
taxonomies
|
75
68
|
)
|
76
69
|
end
|
77
70
|
|
78
|
-
def
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
71
|
+
def filter_taxonomy_values_children(children)
|
72
|
+
children.map do |id, hash|
|
73
|
+
TreeNode.new(
|
74
|
+
TreePoint.new(id, decidim_escape_translated(hash[:taxonomy].name).html_safe),
|
75
|
+
filter_taxonomy_values_children(hash[:children])
|
76
|
+
)
|
83
77
|
end
|
84
78
|
end
|
85
79
|
|
86
|
-
|
87
|
-
return filter_scopes_values_from_parent(current_component.scope) if current_component.scope.present?
|
88
|
-
|
89
|
-
main_scopes = current_participatory_space.scopes.top_level
|
90
|
-
.includes(:scope_type, :children)
|
91
|
-
filter_scopes_values_from(main_scopes, current_participatory_space)
|
92
|
-
end
|
93
|
-
|
80
|
+
# pending initiatives removal
|
94
81
|
def filter_global_scopes_values
|
95
82
|
filter_scopes_values_from(current_organization.scopes.top_level)
|
96
83
|
end
|
97
84
|
|
85
|
+
# pending initiatives removal
|
98
86
|
def filter_areas_values
|
99
87
|
areas_or_types = areas_for_select(current_organization)
|
100
88
|
|
@@ -135,22 +123,6 @@ module Decidim
|
|
135
123
|
|
136
124
|
private
|
137
125
|
|
138
|
-
def filter_scopes_values_from_parent(scope)
|
139
|
-
scopes_values = []
|
140
|
-
scope.children.each do |child|
|
141
|
-
unless child.children
|
142
|
-
scopes_values << TreePoint.new(child.id.to_s, translated_attribute(child.name, current_participatory_space.organization))
|
143
|
-
next
|
144
|
-
end
|
145
|
-
scopes_values << TreeNode.new(
|
146
|
-
TreePoint.new(child.id.to_s, translated_attribute(child.name, current_participatory_space.organization)),
|
147
|
-
scope_children_to_tree(child, current_participatory_space)
|
148
|
-
)
|
149
|
-
end
|
150
|
-
|
151
|
-
filter_tree_from(scopes_values)
|
152
|
-
end
|
153
|
-
|
154
126
|
def filter_scopes_values_from(scopes, participatory_space = nil)
|
155
127
|
scopes_values = scopes.compact.flat_map do |scope|
|
156
128
|
TreeNode.new(
|
@@ -16,7 +16,7 @@ module Decidim
|
|
16
16
|
# Finds the CTA button path to reuse it in other places.
|
17
17
|
def cta_button_path
|
18
18
|
if current_organization.cta_button_path.present?
|
19
|
-
current_organization.cta_button_path
|
19
|
+
"/#{current_organization.cta_button_path}"
|
20
20
|
elsif Decidim::ParticipatoryProcess.where(organization: current_organization).published.any?
|
21
21
|
decidim_participatory_processes.participatory_processes_path
|
22
22
|
elsif current_user
|
@@ -62,35 +62,6 @@ module Decidim
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
# A custom helper to include a scope picker field without requiring a form
|
66
|
-
# object
|
67
|
-
#
|
68
|
-
# name - The input name
|
69
|
-
# value - The input value as a scope id
|
70
|
-
# options - The set of options to send to the field
|
71
|
-
# :id - The id to generate for the element (optional)
|
72
|
-
#
|
73
|
-
# Returns a scopes picker tag to be included in an html template.
|
74
|
-
def scopes_picker_field_tag(name, value, id: nil)
|
75
|
-
picker_options = {
|
76
|
-
id: id || sanitize_to_id(name),
|
77
|
-
class: "picker-single",
|
78
|
-
name:
|
79
|
-
}
|
80
|
-
|
81
|
-
prompt_params = yield(nil)
|
82
|
-
selected_scopes = value ? Decidim::Scope.where(id: value) : []
|
83
|
-
scopes = selected_scopes.map { |scope| [scope, yield(scope)] }
|
84
|
-
|
85
|
-
template = ""
|
86
|
-
template += render("decidim/scopes/scopes_picker_input",
|
87
|
-
picker_options:,
|
88
|
-
prompt_params:,
|
89
|
-
scopes:,
|
90
|
-
values_on_top: true)
|
91
|
-
template.html_safe
|
92
|
-
end
|
93
|
-
|
94
65
|
# A custom helper to include a translated field without requiring a form object.
|
95
66
|
#
|
96
67
|
# type - The type of the translated input field.
|
@@ -220,20 +191,5 @@ module Decidim
|
|
220
191
|
|
221
192
|
organization.area_types
|
222
193
|
end
|
223
|
-
|
224
|
-
def ordered_scopes_descendants(root = nil)
|
225
|
-
root = try(:current_participatory_space)&.scope if root == false
|
226
|
-
if root.present?
|
227
|
-
root.descendants
|
228
|
-
else
|
229
|
-
current_organization.scopes
|
230
|
-
end.sort { |a, b| a.part_of.reverse <=> b.part_of.reverse }
|
231
|
-
end
|
232
|
-
|
233
|
-
def ordered_scopes_descendants_for_select(root = nil)
|
234
|
-
ordered_scopes_descendants(root).map do |scope|
|
235
|
-
[" #{" " * 4 * (scope.part_of.count - 1)} #{translated_attribute(scope.name)}".html_safe, scope&.id]
|
236
|
-
end
|
237
|
-
end
|
238
194
|
end
|
239
195
|
end
|
@@ -3,16 +3,6 @@
|
|
3
3
|
module Decidim
|
4
4
|
# A Helper for views with Endorsable resources.
|
5
5
|
module EndorsableHelper
|
6
|
-
# Invokes the decidim/endorsement_buttons cell.
|
7
|
-
def endorsement_buttons_cell(resource)
|
8
|
-
cell("decidim/endorsement_block", resource)
|
9
|
-
end
|
10
|
-
|
11
|
-
# Invokes the decidim/endorsers_list cell.
|
12
|
-
def endorsers_list_cell(resource)
|
13
|
-
cell("decidim/endorsers_list", resource)
|
14
|
-
end
|
15
|
-
|
16
6
|
#
|
17
7
|
# Public: Checks if the given resource has been endorsed by all identities of the user.
|
18
8
|
#
|
@@ -154,6 +154,12 @@ module Decidim
|
|
154
154
|
"#{request.base_url}#{"?#{params.to_query}" unless params.empty?}"
|
155
155
|
end
|
156
156
|
|
157
|
+
def root_url
|
158
|
+
return onboarding_manager.root_path if current_user&.ephemeral?
|
159
|
+
|
160
|
+
decidim.root_url(host: current_organization.host)
|
161
|
+
end
|
162
|
+
|
157
163
|
private
|
158
164
|
|
159
165
|
def each_decidim_engine
|
@@ -35,7 +35,12 @@ module Decidim
|
|
35
35
|
data: { "external-link": "text-only" }
|
36
36
|
}.merge(map_html_options)
|
37
37
|
return link_to(map_url, html_options) do
|
38
|
-
|
38
|
+
# We also add the latitude and the longitude to prevent the Workbox cache to be overly aggressive when updating a map
|
39
|
+
image_tag decidim.static_map_path(
|
40
|
+
sgid: resource.to_sgid.to_s,
|
41
|
+
latitude: resource.latitude,
|
42
|
+
longitude: resource.longitude
|
43
|
+
), alt: "#{map_service_brand} - #{address_text}"
|
39
44
|
end
|
40
45
|
end
|
41
46
|
end
|
@@ -29,10 +29,9 @@ module Decidim
|
|
29
29
|
# Generates a visualization of users for listing conversations threads
|
30
30
|
#
|
31
31
|
def username_list(users, shorten: false)
|
32
|
-
content_tags = []
|
33
32
|
first_users = shorten ? users.first(3) : users
|
34
|
-
first_users.
|
35
|
-
|
33
|
+
content_tags = first_users.map do |u|
|
34
|
+
u.deleted? ? t("decidim.profile.deleted") : u.name
|
36
35
|
end
|
37
36
|
|
38
37
|
return content_tags.join(", ") unless shorten
|
@@ -8,6 +8,7 @@ module Decidim
|
|
8
8
|
# the other methods to see how they work.
|
9
9
|
#
|
10
10
|
# @param [Hash] tags - A Hash containing the meta tag name as keys and its content as values.
|
11
|
+
# @param [Object, nil] resource - The resource object that may contain the image.
|
11
12
|
#
|
12
13
|
# @return [nil]
|
13
14
|
def add_decidim_meta_tags(tags)
|
@@ -15,33 +16,31 @@ module Decidim
|
|
15
16
|
add_decidim_meta_description(tags[:description])
|
16
17
|
add_decidim_meta_url(tags[:url])
|
17
18
|
add_decidim_meta_twitter_handler(tags[:twitter_handler])
|
18
|
-
|
19
|
+
image_url = tags[:image_url].presence || resolve_meta_image_url(tags[:resource])
|
20
|
+
add_decidim_meta_image_url(add_base_url_to(image_url)) if image_url.present?
|
19
21
|
end
|
20
22
|
|
21
|
-
#
|
23
|
+
# Adds base URL to the given path if it does not include a host.
|
22
24
|
#
|
23
|
-
# @
|
25
|
+
# @param [String] path - A String containing the path (e.g. "/proposals/1").
|
24
26
|
#
|
25
|
-
# @return [String] -
|
27
|
+
# @return [String] - A String with the base URL and path, or the original path if it already includes a host.
|
26
28
|
def add_base_url_to(path)
|
27
|
-
return path if path.blank?
|
28
|
-
return path if URI.parse(path).host.present?
|
29
|
+
return path if path.blank? || URI.parse(path).host.present?
|
29
30
|
|
30
31
|
"#{resolve_base_url}#{path}"
|
31
32
|
end
|
32
33
|
|
33
|
-
#
|
34
|
+
# Resolves the base URL (example: https://www.decidim.org) without URL parameters.
|
34
35
|
#
|
35
|
-
# @return [String] -
|
36
|
+
# @return [String] - A String of the base URL.
|
36
37
|
def resolve_base_url
|
37
38
|
return request.base_url if respond_to?(:request) && request&.base_url.present?
|
38
39
|
|
39
40
|
uri = URI.parse(decidim.root_url(host: current_organization.host))
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
"#{uri.scheme}://#{uri.host}:#{uri.port}"
|
44
|
-
end
|
41
|
+
port = uri.port.present? && [80, 443].exclude?(uri.port) ? ":#{uri.port}" : ""
|
42
|
+
|
43
|
+
"#{uri.scheme}://#{uri.host}#{port}"
|
45
44
|
end
|
46
45
|
|
47
46
|
# Accumulates the given `title` so that they can be chained. Since Rails views
|
@@ -60,22 +59,20 @@ module Decidim
|
|
60
59
|
# @return [Array<String>]
|
61
60
|
def add_decidim_page_title(title)
|
62
61
|
@decidim_page_title ||= []
|
63
|
-
|
64
|
-
|
65
|
-
@decidim_page_title << title
|
62
|
+
@decidim_page_title << title if title.present?
|
63
|
+
@decidim_page_title
|
66
64
|
end
|
67
65
|
|
68
66
|
# Renders the title for a page. Use the `add_decidim_page_title` method to
|
69
67
|
# accumulate elements for the title. Basically, it joins the elements of the title
|
70
68
|
# array with `" - "`.
|
71
69
|
#
|
72
|
-
# @return [String]
|
70
|
+
# @return [String] - The concatenated title.
|
73
71
|
def decidim_page_title
|
74
72
|
(@decidim_page_title || []).join(" - ")
|
75
73
|
end
|
76
74
|
|
77
|
-
attr_reader :decidim_meta_description, :decidim_meta_url, :decidim_meta_image_url,
|
78
|
-
:decidim_meta_twitter_handler
|
75
|
+
attr_reader :decidim_meta_description, :decidim_meta_url, :decidim_meta_image_url, :decidim_meta_twitter_handler
|
79
76
|
|
80
77
|
# Sets the meta description for the current page. We want to keep the most specific
|
81
78
|
# one, so you cannot replace the description if it is set by a view that has already
|
@@ -83,7 +80,7 @@ module Decidim
|
|
83
80
|
# is the last one to be rendered. You can put there a basic content and override it
|
84
81
|
# in other layers.
|
85
82
|
#
|
86
|
-
# @param [String] description - The String to be set as description
|
83
|
+
# @param [String] description - The String to be set as description.
|
87
84
|
#
|
88
85
|
# @return [nil]
|
89
86
|
def add_decidim_meta_description(description)
|
@@ -96,7 +93,7 @@ module Decidim
|
|
96
93
|
# is the last one to be rendered. You can put there a basic content and override it
|
97
94
|
# in other layers.
|
98
95
|
#
|
99
|
-
# @param [String] twitter_handler - The String to be set as Twitter handler
|
96
|
+
# @param [String] twitter_handler - The String to be set as Twitter handler.
|
100
97
|
#
|
101
98
|
# @return [nil]
|
102
99
|
def add_decidim_meta_twitter_handler(twitter_handler)
|
@@ -109,7 +106,7 @@ module Decidim
|
|
109
106
|
# is the last one to be rendered. You can put there a basic content and override it
|
110
107
|
# in other layers.
|
111
108
|
#
|
112
|
-
# @param [String] url - The String to be set as URL
|
109
|
+
# @param [String] url - The String to be set as URL.
|
113
110
|
#
|
114
111
|
# @return [nil]
|
115
112
|
def add_decidim_meta_url(url)
|
@@ -122,11 +119,23 @@ module Decidim
|
|
122
119
|
# is the last one to be rendered. You can put there a basic content and override it
|
123
120
|
# in other layers.
|
124
121
|
#
|
125
|
-
# @param [String] image_url - The String to be set as image URL
|
122
|
+
# @param [String] image_url - The String to be set as image URL.
|
126
123
|
#
|
127
124
|
# @return [nil]
|
128
125
|
def add_decidim_meta_image_url(image_url)
|
129
126
|
@decidim_meta_image_url ||= image_url
|
130
127
|
end
|
128
|
+
|
129
|
+
# Resolves the image URL to be used for meta tags.
|
130
|
+
# This method creates a new instance of MetaImageUrlResolver,
|
131
|
+
# which handles the logic for determining the most appropriate image URL.
|
132
|
+
#
|
133
|
+
# @param [Object, nil] resource - The resource object that may contain the image.
|
134
|
+
#
|
135
|
+
# @return [String, nil] - The resolved image URL, or nil if no appropriate image URL is found.
|
136
|
+
def resolve_meta_image_url(resource)
|
137
|
+
url = MetaImageUrlResolver.new(resource, current_organization).resolve
|
138
|
+
add_base_url_to(url) if url.present?
|
139
|
+
end
|
131
140
|
end
|
132
141
|
end
|
@@ -34,5 +34,28 @@ module Decidim
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
def decidim_drawer(opts = {}, &)
|
39
|
+
opts[:closable] = true unless opts.has_key?(:closable)
|
40
|
+
|
41
|
+
button = if opts[:closable] == false
|
42
|
+
""
|
43
|
+
else
|
44
|
+
content_tag(
|
45
|
+
:button,
|
46
|
+
"×".html_safe,
|
47
|
+
type: :button,
|
48
|
+
data: { dialog_close: opts[:id] || "", dialog_closable: "" },
|
49
|
+
"aria-label": t("close_modal", scope: "decidim.shared.confirm_modal")
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
content = opts[:remote].nil? ? button + capture(&).html_safe : button + icon("loader-3-line")
|
54
|
+
content_tag(:div, id: opts[:id], data: { dialog: opts[:id] || "", drawer: true }.merge(opts[:data] || {})) do
|
55
|
+
content_tag(:div, id: "#{opts[:id]}-content", class: opts[:class]) do
|
56
|
+
content
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
37
60
|
end
|
38
61
|
end
|
@@ -13,17 +13,17 @@ module Decidim
|
|
13
13
|
|
14
14
|
# Public: icon for omniauth buttons
|
15
15
|
def oauth_icon(provider)
|
16
|
-
|
16
|
+
provider_info = current_organization.enabled_omniauth_providers[provider.to_sym]
|
17
17
|
|
18
18
|
name = normalize_provider_name(provider)
|
19
19
|
name = "twitter-x" if provider == :twitter
|
20
20
|
name = "#{name}-fill"
|
21
21
|
|
22
|
-
if
|
23
|
-
icon_path =
|
24
|
-
return external_icon(icon_path) if icon_path
|
22
|
+
if provider_info
|
23
|
+
icon_path = provider_info[:icon_path] || Rails.application.secrets.omniauth[provider][:icon_path].presence
|
24
|
+
return external_icon(icon_path) if icon_path.present?
|
25
25
|
|
26
|
-
name =
|
26
|
+
name = provider_info[:icon] if provider_info[:icon]
|
27
27
|
end
|
28
28
|
|
29
29
|
icon(name)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# A helper to display onboarding action message
|
5
|
+
module OnboardingActionHelper
|
6
|
+
def display_onboarding_action_message(user)
|
7
|
+
return if user.blank?
|
8
|
+
return unless pending_onboarding_action?(user)
|
9
|
+
|
10
|
+
cell("decidim/onboarding_action_message", user)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -30,7 +30,7 @@ module Decidim
|
|
30
30
|
value: @account&.password,
|
31
31
|
minlength: min_length,
|
32
32
|
maxlength: ::PasswordValidator::MAX_LENGTH,
|
33
|
-
placeholder: "
|
33
|
+
placeholder: "**********"
|
34
34
|
}
|
35
35
|
end
|
36
36
|
|
@@ -42,7 +42,7 @@ module Decidim
|
|
42
42
|
required: true,
|
43
43
|
label: false,
|
44
44
|
help_text:,
|
45
|
-
placeholder: "
|
45
|
+
placeholder: "**********"
|
46
46
|
}
|
47
47
|
end
|
48
48
|
|
@@ -37,13 +37,22 @@ module Decidim
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
# Converts the blob and blob variant references to blob URLs.
|
41
|
+
def decidim_rich_text(html, **)
|
42
|
+
renderer = Decidim::ContentProcessor.renderer_klass(:blob).constantize.new(html)
|
43
|
+
renderer.render(**)
|
44
|
+
end
|
45
|
+
|
40
46
|
def decidim_sanitize_editor(html, options = {})
|
41
47
|
content_tag(:div, decidim_sanitize(html, options), class: %w(rich-text-display))
|
42
48
|
end
|
43
49
|
|
44
50
|
def decidim_sanitize_editor_admin(html, options = {})
|
45
51
|
html = Decidim::IframeDisabler.new(html, options).perform
|
46
|
-
decidim_sanitize_editor(
|
52
|
+
decidim_sanitize_editor(
|
53
|
+
decidim_rich_text(html),
|
54
|
+
{ scrubber: Decidim::AdminInputScrubber.new }.merge(options)
|
55
|
+
)
|
47
56
|
end
|
48
57
|
|
49
58
|
def decidim_html_escape(text)
|
@@ -51,7 +60,7 @@ module Decidim
|
|
51
60
|
end
|
52
61
|
|
53
62
|
def decidim_url_escape(text)
|
54
|
-
decidim_html_escape(text).sub(
|
63
|
+
decidim_html_escape(text).sub(/^\s*javascript:/, "")
|
55
64
|
end
|
56
65
|
|
57
66
|
def decidim_sanitize_translated(text)
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# A Helper to render taxonomies for forms.
|
5
|
+
module TaxonomiesHelper
|
6
|
+
include DecidimFormHelper
|
7
|
+
include TranslatableAttributes
|
8
|
+
|
9
|
+
def filter_taxonomy_items_select_field(form, name, filter, options = {})
|
10
|
+
label = decidim_sanitize_translated(filter.name)
|
11
|
+
options = options.merge(include_blank: I18n.t("decidim.taxonomies.prompt")) unless options.has_key?(:include_blank)
|
12
|
+
options = options.merge(label:) unless options.has_key?(:label)
|
13
|
+
form.select(
|
14
|
+
name,
|
15
|
+
taxonomy_items_options_for_filter(filter),
|
16
|
+
options,
|
17
|
+
{ name: "#{form.object_name}[#{name}][]", id: "#{name}-#{filter.id}" }
|
18
|
+
)
|
19
|
+
end
|
20
|
+
|
21
|
+
def taxonomy_items_options_for_filter(filter)
|
22
|
+
@taxonomy_items_options_for_filter ||= {}
|
23
|
+
@taxonomy_items_options_for_filter[filter.id] ||= begin
|
24
|
+
min_parent_count = filter.taxonomies.values.min_by { |item| item[:taxonomy].parent_ids.count }
|
25
|
+
first_parent_level = (min_parent_count && min_parent_count[:taxonomy].parent_ids.count) || 1
|
26
|
+
taxonomy_items_options_for_taxonomies_tree(filter.taxonomies, first_parent_level)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def taxonomy_items_options_for_taxonomies_tree(taxonomies_tree, first_parent_level = 1)
|
31
|
+
options = []
|
32
|
+
taxonomies_tree.each do |id, item|
|
33
|
+
name = " #{" " * 4 * (item[:taxonomy].parent_ids.count - first_parent_level)} #{decidim_sanitize_translated(item[:taxonomy].name)}".html_safe
|
34
|
+
options.append([name, id])
|
35
|
+
options.concat(taxonomy_items_options_for_taxonomies_tree(item[:children], first_parent_level)) if item[:children].any?
|
36
|
+
end
|
37
|
+
options
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -5,25 +5,8 @@ module Decidim
|
|
5
5
|
queue_as :default
|
6
6
|
|
7
7
|
def perform(user, export_format = ::Decidim::DownloadYourDataExporter::DEFAULT_EXPORT_FORMAT)
|
8
|
-
|
9
|
-
|
10
|
-
password = SecureRandom.urlsafe_base64
|
11
|
-
|
12
|
-
generate_zip_file(user, path, password, export_format)
|
13
|
-
save_or_upload_file(user, path)
|
14
|
-
# Deletes temporary file
|
15
|
-
File.delete(path)
|
16
|
-
ExportMailer.download_your_data_export(user, filename, password).deliver_later
|
17
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
def generate_zip_file(user, path, password, export_format)
|
22
|
-
DownloadYourDataExporter.new(user, path, password, export_format).export
|
23
|
-
end
|
24
|
-
|
25
|
-
def save_or_upload_file(user, path)
|
26
|
-
user.download_your_data_file.attach(io: File.open(path, "rb"), filename: File.basename(path))
|
8
|
+
@export = DownloadYourDataExporter.new(user, "download_your_data", export_format).export
|
9
|
+
ExportMailer.download_your_data_export(user, @export).deliver_later
|
27
10
|
end
|
28
11
|
end
|
29
12
|
end
|
@@ -4,21 +4,26 @@ module Decidim
|
|
4
4
|
class EventPublisherJob < ApplicationJob
|
5
5
|
queue_as :events
|
6
6
|
|
7
|
-
attr_reader :resource
|
7
|
+
attr_reader :resource, :data
|
8
8
|
|
9
9
|
def perform(event_name, data)
|
10
10
|
@resource = data[:resource]
|
11
|
+
@data = data
|
11
12
|
|
12
13
|
return unless data[:force_send] || notifiable?
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
if event_type.include?(:email)
|
16
|
+
EmailNotificationGeneratorJob.perform_later(
|
17
|
+
event_name,
|
18
|
+
data[:event_class],
|
19
|
+
data[:resource],
|
20
|
+
data[:followers],
|
21
|
+
data[:affected_users],
|
22
|
+
data[:extra]
|
23
|
+
)
|
24
|
+
end
|
25
|
+
|
26
|
+
return unless event_type.include?(:notification)
|
22
27
|
|
23
28
|
NotificationGeneratorJob.perform_later(
|
24
29
|
event_name,
|
@@ -32,6 +37,10 @@ module Decidim
|
|
32
37
|
|
33
38
|
private
|
34
39
|
|
40
|
+
def event_type
|
41
|
+
(data[:event_class].presence && data[:event_class].safe_constantize&.types) || []
|
42
|
+
end
|
43
|
+
|
35
44
|
# Whether this event should be notified or not. Useful when you want the
|
36
45
|
# event to decide based on the params.
|
37
46
|
#
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
class ExportJob < ApplicationJob
|
5
|
+
include Decidim::PrivateDownloadHelper
|
6
|
+
|
5
7
|
queue_as :exports
|
6
8
|
|
7
9
|
# rubocop:disable Metrics/ParameterLists
|
@@ -16,7 +18,9 @@ module Decidim
|
|
16
18
|
|
17
19
|
export_data = Decidim::Exporters.find_exporter(format).new(collection, serializer).export
|
18
20
|
|
19
|
-
|
21
|
+
private_export = attach_archive(export_data, name, user)
|
22
|
+
|
23
|
+
ExportMailer.export(user, private_export).deliver_later
|
20
24
|
end
|
21
25
|
# rubocop:enable Metrics/ParameterLists
|
22
26
|
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
class ExportParticipatorySpaceJob < ApplicationJob
|
5
|
+
include Decidim::PrivateDownloadHelper
|
6
|
+
|
5
7
|
queue_as :exports
|
6
8
|
|
7
9
|
def perform(user, participatory_space, name, format)
|
@@ -14,7 +16,8 @@ module Decidim
|
|
14
16
|
|
15
17
|
export_data = Decidim::Exporters.find_exporter(format).new(collection, serializer).export
|
16
18
|
|
17
|
-
|
19
|
+
private_export = attach_archive(export_data, name, user)
|
20
|
+
ExportMailer.export(user, private_export).deliver_later
|
18
21
|
end
|
19
22
|
end
|
20
23
|
end
|