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
@@ -6,11 +6,29 @@ module Decidim
|
|
6
6
|
# The controller to handle the user's download_my_data page.
|
7
7
|
class DownloadYourDataController < Decidim::ApplicationController
|
8
8
|
include Decidim::UserProfile
|
9
|
+
include Decidim::Paginable
|
9
10
|
|
11
|
+
helper_method :help_definitions
|
12
|
+
|
13
|
+
# i18n-tasks-use t('decidim.download_your_data.show.answers')
|
14
|
+
# i18n-tasks-use t('decidim.download_your_data.show.assemblies')
|
15
|
+
# i18n-tasks-use t('decidim.download_your_data.show.debate_comments')
|
16
|
+
# i18n-tasks-use t('decidim.download_your_data.show.debates')
|
17
|
+
# i18n-tasks-use t('decidim.download_your_data.show.initiatives')
|
18
|
+
# i18n-tasks-use t('decidim.download_your_data.show.meeting_comments')
|
19
|
+
# i18n-tasks-use t('decidim.download_your_data.show.meetings')
|
20
|
+
# i18n-tasks-use t('decidim.download_your_data.show.participatory_processes')
|
21
|
+
# i18n-tasks-use t('decidim.download_your_data.show.projects')
|
22
|
+
# i18n-tasks-use t('decidim.download_your_data.show.proposal_comments')
|
23
|
+
# i18n-tasks-use t('decidim.download_your_data.show.proposals')
|
24
|
+
# i18n-tasks-use t('decidim.download_your_data.show.result_comments')
|
25
|
+
# i18n-tasks-use t('decidim.download_your_data.show.results')
|
26
|
+
# i18n-tasks-use t('decidim.download_your_data.show.survey_user_answers')
|
10
27
|
def show
|
11
28
|
enforce_permission_to(:show, :user, current_user:)
|
12
29
|
|
13
30
|
@account = form(AccountForm).from_model(current_user)
|
31
|
+
@exports = paginate(current_user.private_exports)
|
14
32
|
end
|
15
33
|
|
16
34
|
def export
|
@@ -25,12 +43,25 @@ module Decidim
|
|
25
43
|
def download_file
|
26
44
|
enforce_permission_to(:download, :user, current_user:)
|
27
45
|
|
28
|
-
if
|
29
|
-
|
46
|
+
if private_export.expired?
|
47
|
+
flash[:error] = t("decidim.account.download_your_data_export.export_expired")
|
48
|
+
redirect_to download_your_data_path
|
49
|
+
elsif private_export.file.attached?
|
50
|
+
redirect_to Rails.application.routes.url_helpers.rails_blob_url(private_export.file.blob, only_path: true)
|
30
51
|
else
|
31
52
|
flash[:error] = t("decidim.account.download_your_data_export.file_no_exists")
|
32
53
|
redirect_to download_your_data_path
|
33
54
|
end
|
34
55
|
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
def private_export
|
60
|
+
@private_export ||= current_user.private_exports.find(params[:uuid])
|
61
|
+
end
|
62
|
+
|
63
|
+
def help_definitions
|
64
|
+
@help_definitions ||= Decidim::DownloadYourDataSerializers.help_definitions_for(current_user)
|
65
|
+
end
|
35
66
|
end
|
36
67
|
end
|
@@ -3,9 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
class EditorImagesController < Decidim::ApplicationController
|
5
5
|
include FormFactory
|
6
|
-
|
7
|
-
# overwrite original rescue_from to ensure we print messages from ajax methods (update)
|
8
|
-
rescue_from Decidim::ActionForbidden, with: :ajax_user_has_no_permission
|
6
|
+
include AjaxPermissionHandler
|
9
7
|
|
10
8
|
def create
|
11
9
|
enforce_permission_to :create, :editor_image
|
@@ -25,14 +23,6 @@ module Decidim
|
|
25
23
|
|
26
24
|
private
|
27
25
|
|
28
|
-
# Rescue ajax calls and print the update.js view which prints the info on the message ajax form
|
29
|
-
# Only if the request is AJAX, otherwise behave as Decidim standards
|
30
|
-
def ajax_user_has_no_permission
|
31
|
-
return user_has_no_permission unless request.xhr?
|
32
|
-
|
33
|
-
render json: { message: I18n.t("actions.unauthorized", scope: "decidim.core") }, status: :unprocessable_entity
|
34
|
-
end
|
35
|
-
|
36
26
|
def form_values
|
37
27
|
{
|
38
28
|
file: params[:image],
|
@@ -47,7 +47,7 @@ module Decidim
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def button_cell_mobile
|
50
|
-
@button_cell_mobile ||= cell("decidim/follow_button", resource, **button_options
|
50
|
+
@button_cell_mobile ||= cell("decidim/follow_button", resource, **button_options, mobile: true)
|
51
51
|
end
|
52
52
|
|
53
53
|
def button_cell
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class GeolocationController < Decidim::ApplicationController
|
5
|
+
include Decidim::AjaxPermissionHandler
|
6
|
+
|
7
|
+
def locate
|
8
|
+
enforce_permission_to :locate, :geolocation
|
9
|
+
|
10
|
+
unless Decidim::Map.configured?
|
11
|
+
return render(json: { message: I18n.t("not_configured", scope: "decidim.application.geocoding"), found: false }, status: :unprocessable_entity)
|
12
|
+
end
|
13
|
+
|
14
|
+
geocoder = Decidim::Map.utility(:geocoding, organization: current_organization)
|
15
|
+
address = geocoder.address([params[:latitude], params[:longitude]])
|
16
|
+
render json: { address:, found: address.present? }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -41,7 +41,7 @@ module Decidim
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def escape_url(external_url)
|
44
|
-
before_fragment, fragment = external_url.split("#", 2)
|
44
|
+
before_fragment, fragment = URI.decode_www_form_component(external_url).split("#", 2)
|
45
45
|
escaped_before_fragment = URI::Parser.new.escape(before_fragment)
|
46
46
|
|
47
47
|
if fragment
|
@@ -2,24 +2,49 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
class OpenDataController < Decidim::ApplicationController
|
5
|
+
helper_method :open_data_component_manifests, :open_data_participatory_space_manifests, :open_data_core_manifests
|
6
|
+
|
7
|
+
def index; end
|
8
|
+
|
5
9
|
def download
|
6
|
-
|
7
|
-
|
10
|
+
resource = params[:resource] || nil
|
11
|
+
|
12
|
+
if open_data_file_for_resource(resource)
|
13
|
+
file = open_data_file_for_resource(resource)
|
14
|
+
send_data file.download, filename: file.blob.filename.to_s, type: file.blob.content_type
|
8
15
|
else
|
9
|
-
schedule_open_data_generation
|
16
|
+
schedule_open_data_generation(resource)
|
10
17
|
flash[:alert] = t("decidim.open_data.not_available_yet")
|
11
|
-
redirect_back fallback_location:
|
18
|
+
redirect_back fallback_location: open_data_path
|
12
19
|
end
|
13
20
|
end
|
14
21
|
|
15
22
|
private
|
16
23
|
|
17
|
-
def
|
18
|
-
@
|
24
|
+
def open_data_core_manifests
|
25
|
+
@open_data_core_manifests ||= Decidim.open_data_manifests.select(&:include_in_open_data)
|
26
|
+
end
|
27
|
+
|
28
|
+
def open_data_component_manifests
|
29
|
+
@open_data_component_manifests ||= Decidim.component_manifests
|
30
|
+
.flat_map(&:export_manifests)
|
31
|
+
.select(&:include_in_open_data?)
|
32
|
+
end
|
33
|
+
|
34
|
+
def open_data_participatory_space_manifests
|
35
|
+
@open_data_participatory_space_manifests ||= Decidim.participatory_space_manifests
|
36
|
+
.flat_map(&:export_manifests)
|
37
|
+
.select(&:include_in_open_data?)
|
38
|
+
end
|
39
|
+
|
40
|
+
def open_data_file_for_resource(resource)
|
41
|
+
current_organization.open_data_files.all.find do |file|
|
42
|
+
file.blob.filename == current_organization.open_data_file_path(resource)
|
43
|
+
end
|
19
44
|
end
|
20
45
|
|
21
|
-
def schedule_open_data_generation
|
22
|
-
OpenDataJob.perform_later(current_organization)
|
46
|
+
def schedule_open_data_generation(resource = nil)
|
47
|
+
OpenDataJob.perform_later(current_organization, resource)
|
23
48
|
end
|
24
49
|
end
|
25
50
|
end
|
@@ -27,6 +27,10 @@ module Decidim
|
|
27
27
|
redirect_to profile_activity_path(nickname: params[:nickname])
|
28
28
|
end
|
29
29
|
|
30
|
+
def tooltip
|
31
|
+
render json: { data: cell("decidim/author", profile_holder.presenter).profile_minicard }
|
32
|
+
end
|
33
|
+
|
30
34
|
def following
|
31
35
|
@content_cell = "decidim/following"
|
32
36
|
@title_key = "following"
|
@@ -11,6 +11,7 @@ module Decidim
|
|
11
11
|
include FormFactory
|
12
12
|
include Messaging::ConversationHelper
|
13
13
|
include HasProfileBreadcrumb
|
14
|
+
include AjaxPermissionHandler
|
14
15
|
|
15
16
|
before_action :authenticate_user!
|
16
17
|
before_action :ensure_profile_manager
|
@@ -18,9 +19,6 @@ module Decidim
|
|
18
19
|
helper Decidim::ResourceHelper
|
19
20
|
helper_method :user, :conversations, :conversation
|
20
21
|
|
21
|
-
# overwrite original rescue_from to ensure we print messages from ajax methods (update)
|
22
|
-
rescue_from Decidim::ActionForbidden, with: :ajax_user_has_no_permission
|
23
|
-
|
24
22
|
def index
|
25
23
|
enforce_permission_to :list, :conversation, interlocutor: user
|
26
24
|
end
|
@@ -94,14 +92,6 @@ module Decidim
|
|
94
92
|
|
95
93
|
private
|
96
94
|
|
97
|
-
# Rescue ajax calls and print the update.js view which prints the info on the message ajax form
|
98
|
-
# Only if the request is AJAX, otherwise behave as Decidim standards
|
99
|
-
def ajax_user_has_no_permission
|
100
|
-
return user_has_no_permission unless request.xhr?
|
101
|
-
|
102
|
-
render_unprocessable_entity I18n.t("actions.unauthorized", scope: "decidim.core")
|
103
|
-
end
|
104
|
-
|
105
95
|
def render_unprocessable_entity(message)
|
106
96
|
render action: :update, locals: { error: message }, status: :unprocessable_entity
|
107
97
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
class SoftDeleteResourceEvent < Decidim::Events::SimpleEvent
|
5
|
+
i18n_attributes :resource_type, :resource_title
|
6
|
+
|
7
|
+
def resource_type
|
8
|
+
resource.model_name.human
|
9
|
+
end
|
10
|
+
|
11
|
+
def resource_title
|
12
|
+
translated_attribute resource.title
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -94,7 +94,8 @@ module Decidim
|
|
94
94
|
.from_model(@i18n_amendable)
|
95
95
|
.with_context(
|
96
96
|
current_component: @i18n_amendable.component,
|
97
|
-
current_participatory_space: @i18n_amendable.participatory_space
|
97
|
+
current_participatory_space: @i18n_amendable.participatory_space,
|
98
|
+
current_organization: @i18n_amendable.organization
|
98
99
|
)
|
99
100
|
end
|
100
101
|
|
@@ -114,7 +115,8 @@ module Decidim
|
|
114
115
|
def form_context
|
115
116
|
context.to_h.merge(
|
116
117
|
current_component: amendable.component,
|
117
|
-
current_participatory_space: amendable.participatory_space
|
118
|
+
current_participatory_space: amendable.participatory_space,
|
119
|
+
current_organization: amendable.organization
|
118
120
|
)
|
119
121
|
end
|
120
122
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# The form object of ephemeral users.
|
5
|
+
class EphemeralUserForm < Form
|
6
|
+
mimic :user
|
7
|
+
|
8
|
+
attribute :locale
|
9
|
+
attribute :name
|
10
|
+
attribute :nickname
|
11
|
+
attribute :organization
|
12
|
+
attribute :verified, Boolean, default: false
|
13
|
+
|
14
|
+
def name
|
15
|
+
super || I18n.t("decidim.ephemeral_user", locale:)
|
16
|
+
end
|
17
|
+
|
18
|
+
def nickname
|
19
|
+
super || User.nicknamize(name)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -7,6 +7,7 @@ module Decidim
|
|
7
7
|
mimic :user
|
8
8
|
|
9
9
|
attribute :email_on_moderations, Boolean
|
10
|
+
attribute :email_on_assigned_proposals, Boolean
|
10
11
|
attribute :newsletter_notifications, Boolean
|
11
12
|
attribute :notifications_from_followed, Boolean
|
12
13
|
attribute :notifications_from_own_activity, Boolean
|
@@ -11,6 +11,7 @@ module Decidim
|
|
11
11
|
attribute :provider, String
|
12
12
|
attribute :uid, String
|
13
13
|
attribute :tos_agreement, Boolean
|
14
|
+
attribute :newsletter, Boolean
|
14
15
|
attribute :oauth_signature, String
|
15
16
|
attribute :avatar_url, String
|
16
17
|
attribute :raw_data, Hash
|
@@ -21,11 +22,23 @@ module Decidim
|
|
21
22
|
validates :uid, presence: true
|
22
23
|
|
23
24
|
def self.create_signature(provider, uid)
|
24
|
-
Digest::MD5.hexdigest("#{provider}-#{uid}-#{Rails.application.
|
25
|
+
Digest::MD5.hexdigest("#{provider}-#{uid}-#{Rails.application.secret_key_base}")
|
25
26
|
end
|
26
27
|
|
27
28
|
def normalized_nickname
|
28
29
|
UserBaseEntity.nicknamize(nickname || name, organization: current_organization)
|
29
30
|
end
|
31
|
+
|
32
|
+
def newsletter_at
|
33
|
+
return nil unless newsletter?
|
34
|
+
|
35
|
+
Time.current
|
36
|
+
end
|
37
|
+
|
38
|
+
def valid_tos?
|
39
|
+
return if tos_agreement.nil?
|
40
|
+
|
41
|
+
errors.add :tos_agreement, :accepted
|
42
|
+
end
|
30
43
|
end
|
31
44
|
end
|
@@ -7,6 +7,17 @@ module Decidim
|
|
7
7
|
extend ActiveSupport::Concern
|
8
8
|
|
9
9
|
included do
|
10
|
+
DEFAULT_KEY_MATCHING = {
|
11
|
+
alert: :alert,
|
12
|
+
notice: :success,
|
13
|
+
info: :info,
|
14
|
+
secondary: :secondary,
|
15
|
+
success: :success,
|
16
|
+
error: :alert,
|
17
|
+
warning: :warning,
|
18
|
+
primary: :primary
|
19
|
+
}.freeze
|
20
|
+
|
10
21
|
# Displays the flash messages found in ActionDispatch's +flash+ hash using
|
11
22
|
# FoundationRailsHelper's +callout+ component.
|
12
23
|
#
|
@@ -20,7 +31,7 @@ module Decidim
|
|
20
31
|
#
|
21
32
|
# @return [String] the HTML with all the flash messages
|
22
33
|
def display_flash_messages(closable: true, key_matching: {})
|
23
|
-
key_matching =
|
34
|
+
key_matching = DEFAULT_KEY_MATCHING.merge(key_matching)
|
24
35
|
key_matching.default = :primary
|
25
36
|
|
26
37
|
capture do
|
@@ -106,13 +117,17 @@ module Decidim
|
|
106
117
|
end
|
107
118
|
|
108
119
|
def message(value)
|
109
|
-
return content_tag(:div, value, class: "flash__message
|
120
|
+
return content_tag(:div, value, class: "flash__message") unless value.is_a?(Hash)
|
110
121
|
|
111
122
|
content_tag(:div, class: "flash__message") do
|
112
123
|
concat value[:title]
|
113
124
|
concat content_tag(:span, value[:body], class: "flash__message-body")
|
114
125
|
end
|
115
126
|
end
|
127
|
+
|
128
|
+
def ignored_key?(key)
|
129
|
+
[:timedout].include?(key)
|
130
|
+
end
|
116
131
|
end
|
117
132
|
end
|
118
133
|
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module UserRoleChecker
|
5
|
+
# Shared behaviour for signed_in admins
|
6
|
+
extend ActiveSupport::Concern
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def user_has_any_role?(user, participatory_space = nil, broad_check: false)
|
11
|
+
return false unless user
|
12
|
+
|
13
|
+
[
|
14
|
+
user.admin,
|
15
|
+
user.roles.any?,
|
16
|
+
participatory_process_user_role?(user, participatory_space, broad_check:),
|
17
|
+
assembly_user_role?(user, participatory_space, broad_check:),
|
18
|
+
conference_user_role?(user, participatory_space, broad_check:)
|
19
|
+
].any?
|
20
|
+
end
|
21
|
+
|
22
|
+
def participatory_process_user_role?(user, participatory_process = nil, broad_check: false)
|
23
|
+
return false unless Decidim.module_installed?(:participatory_processes)
|
24
|
+
return Decidim::ParticipatoryProcessUserRole.exists?(user:) if broad_check
|
25
|
+
return false unless participatory_process.is_a?(Decidim::ParticipatoryProcess)
|
26
|
+
|
27
|
+
Decidim::ParticipatoryProcessUserRole.exists?(user:, participatory_process:)
|
28
|
+
end
|
29
|
+
|
30
|
+
def assembly_user_role?(user, assembly = nil, broad_check: false)
|
31
|
+
return false unless Decidim.module_installed?(:assemblies)
|
32
|
+
return Decidim::AssemblyUserRole.exists?(user:) if broad_check
|
33
|
+
return false unless assembly.is_a?(Decidim::Assembly)
|
34
|
+
|
35
|
+
Decidim::AssemblyUserRole.exists?(user:, assembly:)
|
36
|
+
end
|
37
|
+
|
38
|
+
def conference_user_role?(user, conference = nil, broad_check: false)
|
39
|
+
return false unless Decidim.module_installed?(:conferences)
|
40
|
+
return Decidim::ConferenceUserRole.exists?(user:) if broad_check
|
41
|
+
return false unless conference.is_a?(Decidim::Conference)
|
42
|
+
|
43
|
+
Decidim::ConferenceUserRole.exists?(user:, conference:)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -57,26 +57,35 @@ module Decidim
|
|
57
57
|
url = arguments[0]
|
58
58
|
html_options = arguments[1]
|
59
59
|
else
|
60
|
-
body =
|
60
|
+
body = arguments[0]
|
61
61
|
url = arguments[1]
|
62
62
|
html_options = arguments[2]
|
63
63
|
end
|
64
64
|
|
65
|
-
html_options
|
65
|
+
html_options = (html_options || {}).with_indifferent_access
|
66
66
|
resource = html_options.delete(:resource)
|
67
67
|
permissions_holder = html_options.delete(:permissions_holder)
|
68
|
+
authorization_status = get_authorization_status(action, resource, permissions_holder)
|
69
|
+
redirect_path = valid_redirect(url, tag:, method: html_options[:method])
|
70
|
+
onboarding_options = onboarding_data_attributes(authorization_status, action, resource, permissions_holder, redirect_path)
|
68
71
|
|
69
|
-
if
|
70
|
-
html_options = clean_authorized_to_data_open(html_options)
|
71
|
-
|
72
|
+
if sign_in_required?(authorization_status)
|
73
|
+
html_options = clean_authorized_to_data_open(html_options.merge(onboarding_options))
|
72
74
|
html_options["data-dialog-open"] = "loginModal"
|
73
|
-
url = "#"
|
74
|
-
elsif action && !action_authorized_to(action, resource:, permissions_holder:).ok?
|
75
|
-
html_options = clean_authorized_to_data_open(html_options)
|
76
75
|
|
77
|
-
html_options["data-dialog-open"] = "authorizationModal"
|
78
|
-
html_options["data-dialog-remote-url"] = modal_path(action, resource)
|
79
76
|
url = "#"
|
77
|
+
elsif authorization_status&.ok? == false
|
78
|
+
html_options = clean_authorized_to_data_open(html_options.merge(onboarding_options))
|
79
|
+
if pending_steps?(authorization_status)
|
80
|
+
tag = "link"
|
81
|
+
html_options["method"] = "post"
|
82
|
+
html_options.delete(:remote)
|
83
|
+
url = decidim_verifications.renew_onboarding_data_authorizations_path
|
84
|
+
else
|
85
|
+
html_options["data-dialog-open"] = "authorizationModal"
|
86
|
+
html_options["data-dialog-remote-url"] = modal_path(action, resource, html_options)
|
87
|
+
url = "#"
|
88
|
+
end
|
80
89
|
end
|
81
90
|
|
82
91
|
html_options["onclick"] = "event.preventDefault();" if url == ""
|
@@ -84,25 +93,33 @@ module Decidim
|
|
84
93
|
if block
|
85
94
|
send("#{tag}_to", url, html_options, &body)
|
86
95
|
else
|
87
|
-
send("#{tag}_to", body, url, html_options)
|
96
|
+
send("#{tag}_to", content_tag(:span, body), url, html_options)
|
88
97
|
end
|
89
98
|
end
|
90
99
|
# rubocop: enable Metrics/PerceivedComplexity
|
91
100
|
|
92
|
-
def modal_path(action, resource)
|
101
|
+
def modal_path(action, resource, opts = {})
|
102
|
+
if (default_path = opts.delete(:authorizations_modal_path)).present?
|
103
|
+
return default_path
|
104
|
+
end
|
105
|
+
|
93
106
|
resource_params = if resource
|
94
107
|
{ resource_name: resource.resource_manifest.name, resource_id: resource.id }
|
95
108
|
else
|
96
109
|
{}
|
97
110
|
end
|
98
|
-
|
99
|
-
|
111
|
+
|
112
|
+
component = try(:current_component)
|
113
|
+
if component.present?
|
114
|
+
decidim.authorization_modal_path(authorization_action: action, component_id: component&.id, **resource_params)
|
100
115
|
else
|
101
116
|
decidim.free_resource_authorization_modal_path(authorization_action: action, **resource_params)
|
102
117
|
end
|
103
118
|
end
|
104
119
|
|
105
120
|
def clean_authorized_to_data_open(html_options)
|
121
|
+
return {} if html_options.blank?
|
122
|
+
|
106
123
|
html_options.delete(:"data-dialog-open")
|
107
124
|
html_options.delete(:"data-dialog-remote-url")
|
108
125
|
|
@@ -115,9 +132,53 @@ module Decidim
|
|
115
132
|
html_options[key].delete("open_url")
|
116
133
|
html_options[key].delete(:"open-url")
|
117
134
|
html_options[key].delete("open-url")
|
135
|
+
html_options[key].delete(:"dialog-open")
|
136
|
+
html_options[key].delete(:"dialog-remote-url")
|
118
137
|
end
|
119
138
|
|
120
139
|
html_options
|
121
140
|
end
|
141
|
+
|
142
|
+
def get_authorization_status(action, resource, permissions_holder)
|
143
|
+
return if action.blank?
|
144
|
+
|
145
|
+
permissions_holder ||= resource.blank? ? try(:current_component) : nil
|
146
|
+
return if permissions_holder.blank? && resource.try(:component).blank?
|
147
|
+
|
148
|
+
action_authorized_to(action, resource:, permissions_holder:)
|
149
|
+
end
|
150
|
+
|
151
|
+
def pending_steps?(authorization_status)
|
152
|
+
authorization_status.pending_authorizations_count.positive? && authorization_status.global_code != :unauthorized
|
153
|
+
end
|
154
|
+
|
155
|
+
def onboarding_data_attributes(authorization_status, action, resource, permissions_holder, redirect_path = nil)
|
156
|
+
return {} if action.blank?
|
157
|
+
return {} unless pending_steps?(authorization_status)
|
158
|
+
|
159
|
+
permissions_holder ||= try(:current_component) if resource.blank?
|
160
|
+
return {} if [resource, permissions_holder].all?(&:blank?)
|
161
|
+
|
162
|
+
{
|
163
|
+
"data-onboarding-model" => resource&.to_gid,
|
164
|
+
"data-onboarding-permissions-holder" => permissions_holder&.to_gid,
|
165
|
+
"data-onboarding-action" => action,
|
166
|
+
"data-onboarding-redirect-path" => redirect_path
|
167
|
+
}.compact
|
168
|
+
end
|
169
|
+
|
170
|
+
def valid_redirect(path, opts = {})
|
171
|
+
return if opts[:tag]&.to_sym == :button
|
172
|
+
return if path == "#"
|
173
|
+
return if opts[:method].present? && opts[:method].to_s != "get"
|
174
|
+
|
175
|
+
path
|
176
|
+
end
|
177
|
+
|
178
|
+
def sign_in_required?(authorization_status)
|
179
|
+
return if current_user.present?
|
180
|
+
|
181
|
+
!authorization_status&.ephemeral?
|
182
|
+
end
|
122
183
|
end
|
123
184
|
end
|
@@ -16,15 +16,6 @@ module Decidim
|
|
16
16
|
cell("decidim/amendable/announcement", emendation)
|
17
17
|
end
|
18
18
|
|
19
|
-
# Returns Html action button card to AMEND an amendable resource
|
20
|
-
def amend_button_for(amendable)
|
21
|
-
return unless amendments_enabled? && amendable.amendable?
|
22
|
-
return unless current_component.current_settings.amendment_creation_enabled
|
23
|
-
return unless can_participate_in_private_space?
|
24
|
-
|
25
|
-
cell("decidim/amendable/amend_button_card", amendable)
|
26
|
-
end
|
27
|
-
|
28
19
|
# Checks if the user can participate in a participatory space
|
29
20
|
# based on its settings related with Decidim::HasPrivateUsers.
|
30
21
|
def can_participate_in_private_space?
|
@@ -4,11 +4,15 @@ module Decidim
|
|
4
4
|
# Main module to add application-wide helpers.
|
5
5
|
module ApplicationHelper
|
6
6
|
include Decidim::OmniauthHelper
|
7
|
-
include Decidim::
|
7
|
+
include Decidim::DecidimFormHelper
|
8
8
|
include Decidim::ContextualHelpHelper
|
9
9
|
include Decidim::AmendmentsHelper
|
10
10
|
include Decidim::CacheHelper
|
11
11
|
|
12
|
+
def layout_item_classes
|
13
|
+
"layout-item"
|
14
|
+
end
|
15
|
+
|
12
16
|
# Truncates a given text respecting its HTML tags.
|
13
17
|
#
|
14
18
|
# text - The String text to be truncated.
|
@@ -99,7 +103,7 @@ module Decidim
|
|
99
103
|
# Renders the cell contents.
|
100
104
|
def cell(name, model, options = {}, &)
|
101
105
|
options = { context: { view_context: self, current_user: } }.deep_merge(options)
|
102
|
-
super
|
106
|
+
super
|
103
107
|
end
|
104
108
|
|
105
109
|
def prevent_timeout_seconds
|
@@ -56,5 +56,11 @@ module Decidim
|
|
56
56
|
active: active_item.active?
|
57
57
|
}
|
58
58
|
end
|
59
|
+
|
60
|
+
def render_schema_org_breadcrumb_list(breadcrumb_items)
|
61
|
+
exporter_options = { breadcrumb_items:, base_url: request.base_url, organization_name: current_organization_name }
|
62
|
+
exported_breadcrumb_list = Decidim::Exporters::JSON.new([exporter_options], Decidim::SchemaOrgBreadcrumbListSerializer).export.read
|
63
|
+
JSON.pretty_generate(JSON.parse(exported_breadcrumb_list).first)
|
64
|
+
end
|
59
65
|
end
|
60
66
|
end
|