decidim-core 0.29.2 → 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/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_cell.rb +1 -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/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/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/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/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_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/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/open_data_controller.rb +33 -8
- 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/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/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/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/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/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/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/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 +11 -1
- data/app/packs/src/decidim/onboarding_pending_action.js +24 -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/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/_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 +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/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/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 +1 -1
- data/app/services/decidim/download_your_data_exporter.rb +58 -24
- 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/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/shared/_layout_item.html.erb +1 -1
- data/config/assets.rb +2 -1
- data/config/locales/ar.yml +27 -59
- data/config/locales/bg.yml +3 -64
- data/config/locales/ca.yml +367 -60
- data/config/locales/cs.yml +364 -55
- data/config/locales/de.yml +354 -54
- data/config/locales/el.yml +1 -48
- data/config/locales/en.yml +361 -54
- data/config/locales/eo.yml +0 -2
- data/config/locales/es-MX.yml +361 -57
- data/config/locales/es-PY.yml +361 -57
- data/config/locales/es.yml +364 -57
- data/config/locales/eu.yml +364 -57
- data/config/locales/fi-plain.yml +357 -57
- data/config/locales/fi.yml +361 -58
- data/config/locales/fr-CA.yml +176 -54
- data/config/locales/fr.yml +177 -52
- data/config/locales/ga-IE.yml +0 -21
- data/config/locales/gl.yml +1 -34
- data/config/locales/hu.yml +1 -53
- data/config/locales/id-ID.yml +1 -34
- data/config/locales/is-IS.yml +0 -16
- data/config/locales/it.yml +5 -60
- data/config/locales/ja.yml +215 -56
- data/config/locales/lb.yml +1 -52
- data/config/locales/lt.yml +1 -59
- data/config/locales/lv.yml +1 -40
- data/config/locales/nl.yml +1 -53
- data/config/locales/no.yml +2 -52
- data/config/locales/pl.yml +4 -66
- data/config/locales/pt-BR.yml +11 -52
- data/config/locales/pt.yml +2 -52
- data/config/locales/ro-RO.yml +195 -117
- data/config/locales/ru.yml +0 -20
- data/config/locales/sk.yml +1 -41
- data/config/locales/sv.yml +103 -59
- data/config/locales/tr-TR.yml +1 -50
- data/config/locales/uk.yml +0 -18
- data/config/locales/zh-CN.yml +1 -50
- data/config/locales/zh-TW.yml +1 -54
- data/config/routes.rb +4 -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 +14 -17
- data/lib/decidim/action_authorization.rb +3 -2
- data/lib/decidim/amendable.rb +1 -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/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 +7 -20
- data/lib/decidim/api/types/user_type.rb +7 -20
- 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.rb +2 -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/core/api.rb +2 -0
- data/lib/decidim/core/engine.rb +21 -7
- data/lib/decidim/core/menu.rb +0 -5
- data/lib/decidim/core/seeds.rb +42 -2
- data/lib/decidim/core/test/factories.rb +105 -2
- data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +85 -0
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +393 -38
- 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/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 +6 -129
- 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 +52 -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 +10 -0
- data/lib/decidim/private_download_helper.rb +15 -0
- 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 +34 -1
- data/lib/decidim/soft_deletable.rb +17 -0
- data/lib/decidim/taxonomizable.rb +72 -0
- 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} +25 -18
- data/lib/tasks/upgrade/decidim_active_storage_migration_tasks.rake +1 -1
- data/lib/tasks/upgrade/migrations.rake +91 -0
- metadata +195 -102
- 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
@@ -0,0 +1,36 @@
|
|
1
|
+
.tribute-container {
|
2
|
+
@apply w-full relative;
|
3
|
+
|
4
|
+
#results {
|
5
|
+
@apply absolute max-h-[225px] top-full left-0 right-0 p-0 my-2 rounded z-50 overflow-y-scroll bg-white border border-gray-3;
|
6
|
+
|
7
|
+
li {
|
8
|
+
@apply flex items-center gap-2 cursor-pointer px-4 py-2;
|
9
|
+
}
|
10
|
+
|
11
|
+
li:hover {
|
12
|
+
@apply cursor-pointer bg-background;
|
13
|
+
}
|
14
|
+
|
15
|
+
img {
|
16
|
+
@apply rounded-full w-6 h-6 object-cover;
|
17
|
+
}
|
18
|
+
|
19
|
+
span,
|
20
|
+
strong {
|
21
|
+
@apply font-semibold text-sm text-secondary;
|
22
|
+
}
|
23
|
+
|
24
|
+
small {
|
25
|
+
@apply font-normal text-gray-2 text-xs;
|
26
|
+
}
|
27
|
+
|
28
|
+
svg {
|
29
|
+
@apply w-4 h-4 text-primary fill-current;
|
30
|
+
}
|
31
|
+
|
32
|
+
.is-group {
|
33
|
+
@apply ml-auto flex items-center gap-1;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
@@ -58,6 +58,7 @@
|
|
58
58
|
@import "stylesheets/decidim/_hero.scss";
|
59
59
|
@import "stylesheets/decidim/_actions.scss";
|
60
60
|
@import "stylesheets/decidim/_emoji.scss";
|
61
|
+
@import "stylesheets/decidim/_success_image.scss";
|
61
62
|
}
|
62
63
|
|
63
64
|
@import "stylesheets/decidim/vendor/datepicker_light.scss";
|
@@ -1,13 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
as currently is missing the "file-loader" in the webpack.config.js
|
5
|
-
|
6
|
-
See https://github.com/Leaflet/Leaflet/issues/4849 for further info
|
7
|
-
*/
|
8
|
-
@import "stylesheets/decidim/legacy/leaflet";
|
9
|
-
@import "stylesheets/decidim/legacy/MarkerCluster";
|
10
|
-
@import "stylesheets/decidim/legacy/MarkerCluster.Default";
|
1
|
+
@import "leaflet/dist/leaflet";
|
2
|
+
@import "leaflet.markercluster/dist/MarkerCluster";
|
3
|
+
@import "leaflet.markercluster/dist/MarkerCluster.Default";
|
11
4
|
|
12
5
|
/* overwrite leaflet and card styles */
|
13
6
|
.leaflet-popup-content-wrapper {
|
@@ -30,6 +23,10 @@
|
|
30
23
|
@apply font-sans text-white;
|
31
24
|
}
|
32
25
|
|
26
|
+
&-metadata svg {
|
27
|
+
@apply fill-current;
|
28
|
+
}
|
29
|
+
|
33
30
|
&-title {
|
34
31
|
@apply truncate;
|
35
32
|
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
.resource_history {
|
2
|
+
@apply flex flex-col gap-3.5 lg:gap-[20px] p-4;
|
3
|
+
|
4
|
+
&__item {
|
5
|
+
@apply flex flex-row gap-2.5;
|
6
|
+
|
7
|
+
&_icon {
|
8
|
+
@apply w-8 h-8 rounded-full border-secondary border flex justify-center items-center;
|
9
|
+
|
10
|
+
&-creation {
|
11
|
+
@apply bg-secondary w-6 h-6 rounded-full flex justify-center items-center;
|
12
|
+
}
|
13
|
+
}
|
14
|
+
|
15
|
+
&_content {
|
16
|
+
@apply flex flex-col lg:items-center lg:flex-row lg:gap-1;
|
17
|
+
}
|
18
|
+
|
19
|
+
&_date {
|
20
|
+
@apply text-sm text-gray-2;
|
21
|
+
}
|
22
|
+
}
|
23
|
+
|
24
|
+
&_text {
|
25
|
+
@apply flex flex-col lg:flex-none lg:block relative;
|
26
|
+
}
|
27
|
+
|
28
|
+
&__line {
|
29
|
+
@apply absolute -left-[26px] lg:-left-[130px] top-3.5 lg:top-[26px] w-px h-full bg-secondary;
|
30
|
+
}
|
31
|
+
}
|
@@ -24,6 +24,7 @@ module Decidim
|
|
24
24
|
user_group_action?
|
25
25
|
user_group_invitations_action?
|
26
26
|
apply_endorsement_permissions if permission_action.subject == :endorsement
|
27
|
+
show_my_location_button?
|
27
28
|
|
28
29
|
permission_action
|
29
30
|
end
|
@@ -56,7 +57,6 @@ module Decidim
|
|
56
57
|
|
57
58
|
return allow! if component.published?
|
58
59
|
return allow! if user_can_preview_component?
|
59
|
-
return allow! if user_can_admin_component?
|
60
60
|
return allow! if user_can_admin_component_via_space?
|
61
61
|
|
62
62
|
disallow!
|
@@ -163,7 +163,7 @@ module Decidim
|
|
163
163
|
end
|
164
164
|
|
165
165
|
def user_can_preview_component?
|
166
|
-
|
166
|
+
context[:share_token].present? && Decidim::ShareToken.use!(token_for: component, token: context[:share_token], user:)
|
167
167
|
rescue ActiveRecord::RecordNotFound, StandardError
|
168
168
|
nil
|
169
169
|
end
|
@@ -193,6 +193,12 @@ module Decidim
|
|
193
193
|
end
|
194
194
|
end
|
195
195
|
|
196
|
+
def show_my_location_button?
|
197
|
+
return unless permission_action.action == :locate && permission_action.subject == :geolocation
|
198
|
+
|
199
|
+
allow!
|
200
|
+
end
|
201
|
+
|
196
202
|
def not_already_active?(authorization)
|
197
203
|
Verifications::Authorizations.new(organization: user.organization, user:, name: authorization.name).none?
|
198
204
|
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AdminLog
|
5
|
+
# This class holds the shared logic for `Decidim::User` and `Decidim::UserGroup`
|
6
|
+
# presenters for the `AdminLog`.
|
7
|
+
class BaseUserPresenter < Decidim::Log::BasePresenter
|
8
|
+
private
|
9
|
+
|
10
|
+
def i18n_params
|
11
|
+
super.merge(
|
12
|
+
blocked_count: blocked_users.count,
|
13
|
+
unblocked_count: unblocked_users.count,
|
14
|
+
unreported_users_count: unreported_users.count
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
def blocked_users
|
19
|
+
action_log.extra.dig("extra", "blocked")&.values || []
|
20
|
+
end
|
21
|
+
|
22
|
+
def unblocked_users
|
23
|
+
action_log.extra.dig("extra", "unblocked")&.values || []
|
24
|
+
end
|
25
|
+
|
26
|
+
def unreported_users
|
27
|
+
action_log.extra.dig("extra", "unreported")&.values || []
|
28
|
+
end
|
29
|
+
|
30
|
+
def current_justification
|
31
|
+
action_log.extra.dig("extra", "current_justification") || Hash.new("")
|
32
|
+
end
|
33
|
+
|
34
|
+
def changeset
|
35
|
+
config = changeset_config[action.to_s]
|
36
|
+
return {} unless config
|
37
|
+
|
38
|
+
original = config[:original].call
|
39
|
+
return {} if original.values.flatten.all?(&:empty?)
|
40
|
+
|
41
|
+
Decidim::Log::DiffChangesetCalculator.new(original, config[:fields], i18n_labels_scope).changeset
|
42
|
+
end
|
43
|
+
|
44
|
+
def changeset_config
|
45
|
+
{
|
46
|
+
"bulk_block" => {
|
47
|
+
original: -> { { justification: [blocked_users.join(", "), current_justification] } },
|
48
|
+
fields: { justification: :string }
|
49
|
+
},
|
50
|
+
"bulk_unblock" => {
|
51
|
+
original: -> { { unblocked_users: ["", unblocked_users.join(", ")] } },
|
52
|
+
fields: { unblocked_users: :string }
|
53
|
+
},
|
54
|
+
"bulk_ignore" => {
|
55
|
+
original: -> { { unreported_users: ["", unreported_users.join(", ")] } },
|
56
|
+
fields: { unreported_users: :string }
|
57
|
+
}
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# override this as it not depend on the old version
|
62
|
+
def has_diff?
|
63
|
+
diff_actions.include?(action.to_s) && changeset.any?
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -29,9 +29,9 @@ module Decidim
|
|
29
29
|
|
30
30
|
def action_string
|
31
31
|
case action
|
32
|
-
when "export_component"
|
32
|
+
when "export_component", "soft_delete", "restore"
|
33
33
|
"decidim.admin_log.component.#{action}"
|
34
|
-
when "create", "delete", "publish", "unpublish", "update_permissions"
|
34
|
+
when "create", "delete", "publish", "unpublish", "update_permissions", "update_filters"
|
35
35
|
generate_action_string(action)
|
36
36
|
else
|
37
37
|
super
|
@@ -48,7 +48,7 @@ module Decidim
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def diff_actions
|
51
|
-
super + %w(unpublish update_permissions)
|
51
|
+
super + %w(unpublish update_permissions update_filters)
|
52
52
|
end
|
53
53
|
|
54
54
|
def i18n_params
|
@@ -70,6 +70,35 @@ module Decidim
|
|
70
70
|
})
|
71
71
|
end
|
72
72
|
end
|
73
|
+
|
74
|
+
def changeset
|
75
|
+
changes = action_log.version.changeset
|
76
|
+
mapping = diff_fields_mapping
|
77
|
+
if action == "update_filters"
|
78
|
+
changes = {
|
79
|
+
"taxonomy_filters" => [
|
80
|
+
filters_for(action_log.version.changeset["settings"].first.dig("global", "taxonomy_filters")),
|
81
|
+
filters_for(action_log.version.changeset["settings"].last.dig("global", "taxonomy_filters"))
|
82
|
+
]
|
83
|
+
}
|
84
|
+
mapping = { taxonomy_filters: :array }
|
85
|
+
end
|
86
|
+
Decidim::Log::DiffChangesetCalculator.new(
|
87
|
+
changes,
|
88
|
+
mapping,
|
89
|
+
i18n_labels_scope
|
90
|
+
).changeset
|
91
|
+
end
|
92
|
+
|
93
|
+
def filters_for(ids)
|
94
|
+
return [] if ids.blank?
|
95
|
+
|
96
|
+
@filters_ids ||= {}
|
97
|
+
ids.map do |id|
|
98
|
+
@filters_ids[id] ||= Decidim::TaxonomyFilter.find_by(id: ids)
|
99
|
+
@filters_ids[id] ? "#{id}: #{@filters_ids[id].translated_internal_name}" : id
|
100
|
+
end
|
101
|
+
end
|
73
102
|
end
|
74
103
|
end
|
75
104
|
end
|
@@ -12,6 +12,8 @@ module Decidim
|
|
12
12
|
# view_helpers # => this comes from the views
|
13
13
|
# ModerationPresenter.new(action_log, view_helpers).present
|
14
14
|
class ModerationPresenter < Decidim::Log::BasePresenter
|
15
|
+
include Decidim::TranslatableAttributes
|
16
|
+
|
15
17
|
private
|
16
18
|
|
17
19
|
def diff_fields_mapping
|
@@ -23,7 +25,7 @@ module Decidim
|
|
23
25
|
|
24
26
|
def action_string
|
25
27
|
case action
|
26
|
-
when "hide", "unreport"
|
28
|
+
when "hide", "unreport", "bulk_hide", "bulk_unhide", "bulk_unreport"
|
27
29
|
"decidim.admin_log.moderation.#{action}"
|
28
30
|
else
|
29
31
|
super
|
@@ -36,12 +38,37 @@ module Decidim
|
|
36
38
|
|
37
39
|
def i18n_params
|
38
40
|
super.merge(
|
39
|
-
resource_type: action_log.extra.dig("extra", "reportable_type").try(:demodulize)
|
41
|
+
resource_type: action_log.extra.dig("extra", "reportable_type").try(:demodulize),
|
42
|
+
reported_count: action_log.extra.dig("extra", "reported_count") || "?"
|
40
43
|
)
|
41
44
|
end
|
42
45
|
|
46
|
+
def reported_content
|
47
|
+
action_log.extra.dig("extra", "reported_content") || {}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Overwrite the changeset.
|
51
|
+
def changeset
|
52
|
+
types = changeset_config.keys.index_with { |_key| :string }
|
53
|
+
Decidim::Log::DiffChangesetCalculator.new(changeset_config, types, "decidim.admin.admin_log.changeset").changeset
|
54
|
+
end
|
55
|
+
|
56
|
+
def changeset_config
|
57
|
+
reported_content.to_h do |key, items|
|
58
|
+
[
|
59
|
+
key.to_sym,
|
60
|
+
["", items.values.map { |title| translated_attribute(title) }.join(", ")]
|
61
|
+
]
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
# override this as it not depend on the old version
|
66
|
+
def has_diff?
|
67
|
+
diff_actions.include?(action.to_s) && changeset.any?
|
68
|
+
end
|
69
|
+
|
43
70
|
def diff_actions
|
44
|
-
super + %w(unreport)
|
71
|
+
super + %w(unreport bulk_hide bulk_unhide bulk_unreport)
|
45
72
|
end
|
46
73
|
end
|
47
74
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AdminLog
|
5
|
+
# This class extends the default resource presenter for logs, so that
|
6
|
+
# it can properly link to the static page.
|
7
|
+
class ShareTokenPresenter < Decidim::Log::BasePresenter
|
8
|
+
private
|
9
|
+
|
10
|
+
def diff_fields_mapping
|
11
|
+
{
|
12
|
+
token: :string,
|
13
|
+
expires_at: :date,
|
14
|
+
registered_only: :boolean,
|
15
|
+
token_for: :string
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def action_string
|
20
|
+
case action
|
21
|
+
when "create", "delete", "update"
|
22
|
+
"decidim.admin_log.share_token.#{action}#{suffix}"
|
23
|
+
else
|
24
|
+
super
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def suffix
|
29
|
+
return "_with_space" if action_log.extra.dig("component", "title").present?
|
30
|
+
|
31
|
+
""
|
32
|
+
end
|
33
|
+
|
34
|
+
def diff_actions
|
35
|
+
%w(update create delete)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AdminLog
|
5
|
+
# This class holds the logic to present a `Decidim::Taxonomy`
|
6
|
+
# for the `AdminLog` log.
|
7
|
+
#
|
8
|
+
# Usage should be automatic and you should not need to call this class
|
9
|
+
# directly, but here is an example:
|
10
|
+
#
|
11
|
+
# action_log = Decidim::ActionLog.last
|
12
|
+
# view_helpers # => this comes from the views
|
13
|
+
# TaxonomyFilterPresenter.new(action_log, view_helpers).present
|
14
|
+
class TaxonomyFilterPresenter < Decidim::Log::BasePresenter
|
15
|
+
include Decidim::SanitizeHelper
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def diff_fields_mapping
|
20
|
+
{
|
21
|
+
name: :i18n,
|
22
|
+
internal_name: :i18n,
|
23
|
+
root_taxonomy_id: :taxonomy,
|
24
|
+
participatory_space_manifests: :array
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
def action_string
|
29
|
+
case action
|
30
|
+
when "create", "delete", "update"
|
31
|
+
if filter_items_count.present? && taxonomy_name.present?
|
32
|
+
"decidim.admin_log.taxonomy_filter.#{action}_with_filter_info"
|
33
|
+
else
|
34
|
+
"decidim.admin_log.taxonomy_filter.#{action}"
|
35
|
+
end
|
36
|
+
else
|
37
|
+
super
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def i18n_params
|
42
|
+
super.merge(
|
43
|
+
filter_items_count:,
|
44
|
+
taxonomy_name: decidim_escape_translated(taxonomy_name)
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def filter_items_count
|
49
|
+
action_log.extra.dig("extra", "filter_items_count")
|
50
|
+
end
|
51
|
+
|
52
|
+
def taxonomy_name
|
53
|
+
action_log.extra.dig("extra", "taxonomy_name")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module AdminLog
|
5
|
+
# This class holds the logic to present a `Decidim::Taxonomy`
|
6
|
+
# for the `AdminLog` log.
|
7
|
+
#
|
8
|
+
# Usage should be automatic and you should not need to call this class
|
9
|
+
# directly, but here is an example:
|
10
|
+
#
|
11
|
+
# action_log = Decidim::ActionLog.last
|
12
|
+
# view_helpers # => this comes from the views
|
13
|
+
# TaxonomyPresenter.new(action_log, view_helpers).present
|
14
|
+
class TaxonomyPresenter < Decidim::Log::BasePresenter
|
15
|
+
private
|
16
|
+
|
17
|
+
def diff_fields_mapping
|
18
|
+
{
|
19
|
+
name: :i18n,
|
20
|
+
parent_id: :taxonomy
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def action_string
|
25
|
+
case action
|
26
|
+
when "create", "delete", "update"
|
27
|
+
if parent_name.present?
|
28
|
+
"decidim.admin_log.taxonomy.#{action}_with_parent"
|
29
|
+
else
|
30
|
+
"decidim.admin_log.taxonomy.#{action}"
|
31
|
+
end
|
32
|
+
else
|
33
|
+
super
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def i18n_params
|
38
|
+
super.merge(
|
39
|
+
parent_taxonomy: h.translated_attribute(parent_name)
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
def parent_name
|
44
|
+
action_log.extra.dig("extra", "parent_name")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -11,21 +11,21 @@ module Decidim
|
|
11
11
|
# action_log = Decidim::ActionLog.last
|
12
12
|
# view_helpers # => this comes from the views
|
13
13
|
# UserGroupPresenter.new(action_log, view_helpers).present
|
14
|
-
class UserGroupPresenter <
|
14
|
+
class UserGroupPresenter < BaseUserPresenter
|
15
15
|
private
|
16
16
|
|
17
|
-
def has_diff?
|
18
|
-
false
|
19
|
-
end
|
20
|
-
|
21
17
|
def action_string
|
22
18
|
case action
|
23
|
-
when "verify", "verify_via_csv", "reject", "block", "unblock"
|
19
|
+
when "verify", "verify_via_csv", "reject", "block", "unblock", "bulk_block", "bulk_unblock", "bulk_ignore"
|
24
20
|
"decidim.admin_log.user_group.#{action}"
|
25
21
|
else
|
26
22
|
super
|
27
23
|
end
|
28
24
|
end
|
25
|
+
|
26
|
+
def diff_actions
|
27
|
+
%w(bulk_block bulk_unblock bulk_ignore)
|
28
|
+
end
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
@@ -11,12 +11,13 @@ module Decidim
|
|
11
11
|
# action_log = Decidim::ActionLog.last
|
12
12
|
# view_helpers # => this comes from the views
|
13
13
|
# UserPresenter.new(action_log, view_helpers).present
|
14
|
-
class UserPresenter <
|
14
|
+
class UserPresenter < BaseUserPresenter
|
15
15
|
private
|
16
16
|
|
17
17
|
def action_string
|
18
18
|
case action
|
19
|
-
when "grant_id_documents_offline_verification", "invite", "officialize", "remove_from_admin",
|
19
|
+
when "grant_id_documents_offline_verification", "invite", "officialize", "remove_from_admin",
|
20
|
+
"show_email", "unofficialize", "block", "unblock", "bulk_block", "bulk_unblock", "promote", "transfer", "bulk_ignore"
|
20
21
|
"decidim.admin_log.user.#{action}"
|
21
22
|
else
|
22
23
|
super
|
@@ -45,23 +46,8 @@ module Decidim
|
|
45
46
|
action_log.extra.dig("extra", "previous_justification") || ""
|
46
47
|
end
|
47
48
|
|
48
|
-
def current_justification
|
49
|
-
action_log.extra.dig("extra", "current_justification") || Hash.new("")
|
50
|
-
end
|
51
|
-
|
52
|
-
# Overwrite the changeset for officialization and block actions.
|
53
|
-
def changeset
|
54
|
-
original = { badge: [previous_user_badge, user_badge] }
|
55
|
-
fields = { badge: :i18n }
|
56
|
-
if action.to_s == "block"
|
57
|
-
original = { justification: [previous_justification, current_justification] }
|
58
|
-
fields = { justification: :string }
|
59
|
-
end
|
60
|
-
Decidim::Log::DiffChangesetCalculator.new(original, fields, i18n_labels_scope).changeset
|
61
|
-
end
|
62
|
-
|
63
49
|
def diff_actions
|
64
|
-
%w(officialize unofficialize block)
|
50
|
+
%w(officialize unofficialize block bulk_block bulk_unblock bulk_ignore)
|
65
51
|
end
|
66
52
|
end
|
67
53
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Log
|
5
|
+
module ValueTypes
|
6
|
+
# This class presents the given value as a Decidim::Taxonomy. Check
|
7
|
+
# the `DefaultPresenter` for more info on how value
|
8
|
+
# presenters work.
|
9
|
+
class TaxonomyPresenter < DefaultPresenter
|
10
|
+
# Public: Presents the value as a Decidim::Taxonomy. If the taxonomy can
|
11
|
+
# be found, it shows its title. Otherwise it shows its ID.
|
12
|
+
#
|
13
|
+
# Returns an HTML-safe String.
|
14
|
+
def present
|
15
|
+
return unless value
|
16
|
+
return h.translated_attribute(taxonomy.name) if taxonomy
|
17
|
+
|
18
|
+
I18n.t("not_found", id: value, scope: "decidim.log.value_types.taxonomy_presenter")
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def taxonomy
|
24
|
+
@taxonomy ||= Decidim::Taxonomy.find_by(id: value)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
#
|
5
|
+
# Decorator for assembly members
|
6
|
+
#
|
7
|
+
class ParticipatorySpacePrivateUserPresenter < SimpleDelegator
|
8
|
+
delegate :profile_url, to: :user, allow_nil: true
|
9
|
+
|
10
|
+
def name
|
11
|
+
user ? user.name : full_name
|
12
|
+
end
|
13
|
+
|
14
|
+
def nickname
|
15
|
+
user.nickname if user
|
16
|
+
end
|
17
|
+
|
18
|
+
def avatar_url(variant = nil)
|
19
|
+
return user.avatar_url(variant) if user.present?
|
20
|
+
|
21
|
+
non_user_avatar_path(variant)
|
22
|
+
end
|
23
|
+
|
24
|
+
def non_user_avatar_path(variant = nil)
|
25
|
+
return non_user_avatar.default_url(variant) unless non_user_avatar.attached?
|
26
|
+
|
27
|
+
non_user_avatar.path(variant:)
|
28
|
+
end
|
29
|
+
|
30
|
+
def non_user_avatar
|
31
|
+
attached_uploader(:non_user_avatar)
|
32
|
+
end
|
33
|
+
|
34
|
+
def has_tooltip?
|
35
|
+
false
|
36
|
+
end
|
37
|
+
|
38
|
+
def deleted?
|
39
|
+
false
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def user
|
45
|
+
@user ||= if (user = __getobj__.user.presence)
|
46
|
+
Decidim::UserPresenter.new(user)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
#
|
5
|
+
# Decorator for taxonomies.
|
6
|
+
#
|
7
|
+
class TaxonomyFilterPresenter < SimpleDelegator
|
8
|
+
include Decidim::TranslationsHelper
|
9
|
+
include Decidim::SanitizeHelper
|
10
|
+
|
11
|
+
def translated_name
|
12
|
+
@translated_name ||= decidim_sanitize_translated(name)
|
13
|
+
end
|
14
|
+
|
15
|
+
def translated_internal_name
|
16
|
+
@translated_internal_name ||= decidim_sanitize_translated(internal_name)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
#
|
5
|
+
# Decorator for taxonomies.
|
6
|
+
#
|
7
|
+
class TaxonomyPresenter < SimpleDelegator
|
8
|
+
include Decidim::TranslationsHelper
|
9
|
+
|
10
|
+
def translated_name
|
11
|
+
@translated_name ||= translated_attribute name
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|