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
@@ -22,7 +22,7 @@ module Decidim
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def form_attribute_values
|
25
|
-
raise "You need to define the list of attributes to be fetched from form object fetch_form_attributes"
|
25
|
+
raise "You need to define the list of attributes to be fetched from form object fetch_form_attributes" if form_attributes.empty?
|
26
26
|
|
27
27
|
form_attributes.index_with do |field|
|
28
28
|
form.send(field)
|
@@ -30,7 +30,7 @@ module Decidim
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def file_attribute_values
|
33
|
-
return {}
|
33
|
+
return {} if file_attributes.empty?
|
34
34
|
|
35
35
|
attachment_attributes(*file_attributes)
|
36
36
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Commands
|
5
|
+
class RestoreResource < ::Decidim::Command
|
6
|
+
# Initializes the command.
|
7
|
+
#
|
8
|
+
# @param resource [ActiveRecord::Base] the resource to restore.
|
9
|
+
# @param current_user [Decidim::User] the current user.
|
10
|
+
def initialize(resource, current_user)
|
11
|
+
@resource = resource
|
12
|
+
@current_user = current_user
|
13
|
+
end
|
14
|
+
|
15
|
+
# Restores the resource.
|
16
|
+
#
|
17
|
+
# Broadcasts :ok if successful, :invalid otherwise.
|
18
|
+
def call
|
19
|
+
return broadcast(:invalid) if invalid?
|
20
|
+
|
21
|
+
restore_resource
|
22
|
+
|
23
|
+
broadcast(:ok, resource)
|
24
|
+
rescue Decidim::Commands::HookError, StandardError
|
25
|
+
broadcast(:invalid)
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
attr_reader :resource, :current_user
|
31
|
+
|
32
|
+
def invalid? = false
|
33
|
+
|
34
|
+
def restore_resource
|
35
|
+
Decidim.traceability.perform_action!(
|
36
|
+
"restore",
|
37
|
+
resource,
|
38
|
+
current_user
|
39
|
+
) do
|
40
|
+
resource.restore
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Commands
|
5
|
+
class SoftDeleteResource < ::Decidim::Command
|
6
|
+
# Initializes the command.
|
7
|
+
#
|
8
|
+
# @param resource [ActiveRecord::Base] the resource to soft delete.
|
9
|
+
# @param current_user [Decidim::User] the current user.
|
10
|
+
def initialize(resource, current_user)
|
11
|
+
@resource = resource
|
12
|
+
@current_user = current_user
|
13
|
+
end
|
14
|
+
|
15
|
+
# Soft deletes the resource.
|
16
|
+
#
|
17
|
+
# Broadcasts :ok if successful, :invalid otherwise.
|
18
|
+
def call
|
19
|
+
return broadcast(:invalid) if invalid?
|
20
|
+
|
21
|
+
soft_delete_resource
|
22
|
+
send_notification_to_authors
|
23
|
+
|
24
|
+
broadcast(:ok, resource)
|
25
|
+
rescue Decidim::Commands::HookError, StandardError
|
26
|
+
broadcast(:invalid)
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
|
31
|
+
attr_reader :resource, :current_user
|
32
|
+
|
33
|
+
def invalid? = false
|
34
|
+
|
35
|
+
def soft_delete_resource
|
36
|
+
Decidim.traceability.perform_action!(
|
37
|
+
"soft_delete",
|
38
|
+
resource,
|
39
|
+
current_user
|
40
|
+
) do
|
41
|
+
resource.destroy!
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def send_notification_to_authors
|
46
|
+
coauthors = resource.try(:coauthorships)&.map do |coauthorship|
|
47
|
+
coauthorship.decidim_author_type.constantize.find(coauthorship.decidim_author_id)
|
48
|
+
end || []
|
49
|
+
|
50
|
+
recipients = (resource.try(:authors) || [resource.try(:author)]).compact + coauthors
|
51
|
+
|
52
|
+
return if recipients.empty?
|
53
|
+
|
54
|
+
Decidim::EventsManager.publish(
|
55
|
+
event: "decidim.events.resources.soft_deleted",
|
56
|
+
event_class: Decidim::SoftDeleteResourceEvent,
|
57
|
+
resource:,
|
58
|
+
affected_users: recipients.uniq
|
59
|
+
)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -142,6 +142,13 @@ module Decidim
|
|
142
142
|
@seeds&.call(participatory_space)
|
143
143
|
end
|
144
144
|
|
145
|
+
# The name of the named Rails route to create the url to the resource.
|
146
|
+
#
|
147
|
+
# Returns a String.
|
148
|
+
def route_name
|
149
|
+
"component"
|
150
|
+
end
|
151
|
+
|
145
152
|
# Public: Adds configurable attributes for this component, scoped to a name. It
|
146
153
|
# uses the DSL specified under `Decidim::SettingsManifest`.
|
147
154
|
#
|
data/lib/decidim/core/api.rb
CHANGED
@@ -18,6 +18,7 @@ module Decidim
|
|
18
18
|
autoload :AreaTypeType, "decidim/api/types/area_type_type"
|
19
19
|
autoload :AttachmentType, "decidim/api/types/attachment_type"
|
20
20
|
autoload :CategoryType, "decidim/api/types/category_type"
|
21
|
+
autoload :TaxonomyType, "decidim/api/types/taxonomy_type"
|
21
22
|
autoload :ComponentType, "decidim/api/types/component_type"
|
22
23
|
autoload :CoordinatesType, "decidim/api/types/coordinates_type"
|
23
24
|
autoload :DecidimType, "decidim/api/types/decidim_type"
|
@@ -64,6 +65,7 @@ module Decidim
|
|
64
65
|
autoload :AuthorableInterface, "decidim/api/interfaces/authorable_interface"
|
65
66
|
autoload :CoauthorableInterface, "decidim/api/interfaces/coauthorable_interface"
|
66
67
|
autoload :CategoriesContainerInterface, "decidim/api/interfaces/categories_container_interface"
|
68
|
+
autoload :TaxonomizableInterface, "decidim/api/interfaces/taxonomizable_interface"
|
67
69
|
autoload :CategorizableInterface, "decidim/api/interfaces/categorizable_interface"
|
68
70
|
autoload :ScopableInterface, "decidim/api/interfaces/scopable_interface"
|
69
71
|
autoload :AttachableInterface, "decidim/api/interfaces/attachable_interface"
|
data/lib/decidim/core/engine.rb
CHANGED
@@ -11,7 +11,6 @@ require "acts_as_list"
|
|
11
11
|
require "devise"
|
12
12
|
require "devise-i18n"
|
13
13
|
require "devise_invitable"
|
14
|
-
require "foundation_rails_helper"
|
15
14
|
require "active_link_to"
|
16
15
|
require "rails-i18n"
|
17
16
|
require "date_validator"
|
@@ -37,6 +36,7 @@ require "mime-types"
|
|
37
36
|
require "diffy"
|
38
37
|
require "ransack"
|
39
38
|
require "wisper"
|
39
|
+
require "chartkick"
|
40
40
|
require "shakapacker"
|
41
41
|
|
42
42
|
require "decidim/api"
|
@@ -56,7 +56,8 @@ module Decidim
|
|
56
56
|
|
57
57
|
initializer "decidim_core.register_icons", after: "decidim_core.add_social_share_services" do
|
58
58
|
Decidim.icons.register(name: "phone-line", icon: "phone-line", category: "system", description: "", engine: :core)
|
59
|
-
|
59
|
+
Decidim.icons.register(name: "more-2-fill", icon: "more-2-fill", category: "system", description: "Resource Action button", engine: :core)
|
60
|
+
Decidim.icons.register(name: "more-fill", icon: "more-fill", category: "system", description: "Resource Action button", engine: :core)
|
60
61
|
Decidim.icons.register(name: "upload-cloud-2-line", icon: "upload-cloud-2-line", category: "system",
|
61
62
|
description: "Upload cloud 2 line used in attachments form", engine: :core)
|
62
63
|
Decidim.icons.register(name: "arrow-right-line", icon: "arrow-right-line", category: "system",
|
@@ -104,6 +105,7 @@ module Decidim
|
|
104
105
|
Decidim.icons.register(name: "account-pin-circle-line", icon: "account-pin-circle-line", category: "system", description: "", engine: :core)
|
105
106
|
Decidim.icons.register(name: "award-line", icon: "award-line", category: "system", description: "", engine: :core)
|
106
107
|
Decidim.icons.register(name: "eye-2-line", icon: "eye-2-line", category: "system", description: "", engine: :core)
|
108
|
+
Decidim.icons.register(name: "eye-close", icon: "eye-close-line", category: "system", description: "", engine: :core)
|
107
109
|
Decidim.icons.register(name: "group-line", icon: "group-line", category: "system", description: "", engine: :core)
|
108
110
|
Decidim.icons.register(name: "team-line", icon: "team-line", category: "system", description: "", engine: :core)
|
109
111
|
Decidim.icons.register(name: "apps-2-line", icon: "apps-2-line", category: "system", description: "", engine: :core)
|
@@ -151,6 +153,8 @@ module Decidim
|
|
151
153
|
Decidim.icons.register(name: "arrow-up-s-fill", icon: "arrow-up-s-fill", category: "system", description: "", engine: :core)
|
152
154
|
Decidim.icons.register(name: "treasure-map-line", icon: "treasure-map-line", category: "system", description: "", engine: :core)
|
153
155
|
Decidim.icons.register(name: "chat-new-line", icon: "chat-new-line", category: "system", description: "", engine: :core)
|
156
|
+
Decidim.icons.register(name: "history", icon: "history-line", category: "system", description: "History timeline", engine: :core)
|
157
|
+
Decidim.icons.register(name: "survey-line", icon: "survey-line", category: "system", description: "Survey line", engine: :core)
|
154
158
|
Decidim.icons.register(name: "draft-line", icon: "draft-line", category: "system", description: "", engine: :core)
|
155
159
|
Decidim.icons.register(name: "user-voice-line", icon: "user-voice-line", category: "system", description: "", engine: :core)
|
156
160
|
|
@@ -169,19 +173,22 @@ module Decidim
|
|
169
173
|
Decidim.icons.register(name: "calendar-todo-line", icon: "calendar-todo-line", category: "system", description: "", engine: :core)
|
170
174
|
Decidim.icons.register(name: "home-8-line", icon: "home-8-line", category: "system", description: "", engine: :core)
|
171
175
|
|
172
|
-
Decidim.icons.register(name: "like", icon: "heart-
|
173
|
-
Decidim.icons.register(name: "dislike", icon: "
|
176
|
+
Decidim.icons.register(name: "like", icon: "heart-line", description: "Like", category: "action", engine: :core)
|
177
|
+
Decidim.icons.register(name: "dislike", icon: "heart-fill", description: "Dislike", category: "action", engine: :core)
|
174
178
|
Decidim.icons.register(name: "drag-move-2-line", icon: "drag-move-2-line", category: "system", description: "", engine: :core)
|
175
179
|
Decidim.icons.register(name: "drag-move-2-fill", icon: "drag-move-2-fill", category: "system", description: "", engine: :core)
|
180
|
+
Decidim.icons.register(name: "draggable", icon: "draggable", category: "system", description: "", engine: :core)
|
176
181
|
Decidim.icons.register(name: "login-circle-line", icon: "login-circle-line", category: "system", description: "", engine: :core)
|
177
182
|
Decidim.icons.register(name: "list-check", icon: "list-check", category: "system", description: "", engine: :core)
|
178
183
|
Decidim.icons.register(name: "add-fill", icon: "add-fill", category: "system", description: "", engine: :core)
|
179
184
|
Decidim.icons.register(name: "clipboard-line", icon: "clipboard-line", category: "system", description: "", engine: :initiatives)
|
185
|
+
Decidim.icons.register(name: "user-forbid-line", icon: "user-forbid-line", category: "system", description: "", engine: :core)
|
180
186
|
|
181
187
|
# Refactor later: Some of the icons here are duplicated, and it would be a greater refactor to remove the duplicates
|
182
188
|
Decidim.icons.register(name: "Decidim::Amendment", icon: "git-branch-line", category: "activity", description: "Amendment", engine: :core)
|
183
189
|
Decidim.icons.register(name: "Decidim::Category", icon: "price-tag-3-line", description: "Category", category: "activity", engine: :core)
|
184
190
|
Decidim.icons.register(name: "Decidim::Scope", icon: "scan-line", description: "Scope", category: "activity", engine: :core)
|
191
|
+
Decidim.icons.register(name: "Decidim::Taxonomy", icon: "scan-line", description: "Taxonomy", category: "activity", engine: :core)
|
185
192
|
Decidim.icons.register(name: "Decidim::User", icon: "user-line", description: "User", category: "activity", engine: :core)
|
186
193
|
Decidim.icons.register(name: "Decidim::UserGroup", icon: "group-line", description: "User Group", category: "activity", engine: :core)
|
187
194
|
Decidim.icons.register(name: "follow", icon: "notification-3-line", description: "Follow", category: "action", engine: :core)
|
@@ -192,6 +199,7 @@ module Decidim
|
|
192
199
|
Decidim.icons.register(name: "profile", icon: "team-line", description: "Groups", category: "profile", engine: :core)
|
193
200
|
Decidim.icons.register(name: "user_group", icon: "team-line", description: "Groups", category: "profile", engine: :core)
|
194
201
|
Decidim.icons.register(name: "link", icon: "link", description: "web / URL", category: "profile", engine: :core)
|
202
|
+
Decidim.icons.register(name: "unlink", icon: "link-unlink-m", description: "Unlink", category: "profile", engine: :core)
|
195
203
|
Decidim.icons.register(name: "following", icon: "eye-2-line", description: "Following", category: "profile", engine: :core)
|
196
204
|
Decidim.icons.register(name: "activity", icon: "bubble-chart-line", description: "Activity", category: "profile", engine: :core)
|
197
205
|
Decidim.icons.register(name: "followers", icon: "group-line", description: "Followers", category: "profile", engine: :core)
|
@@ -335,10 +343,14 @@ module Decidim
|
|
335
343
|
value_presence = ->(v) { v.present? }
|
336
344
|
minute_start = ->(v) { v.to_time.strftime("%Y-%m-%dT%H:%M:00") }
|
337
345
|
minute_end = ->(v) { v.to_time.strftime("%Y-%m-%dT%H:%M:59") }
|
346
|
+
integer_presence = ->(v) { v.to_i.positive? }
|
347
|
+
array_cast = ->(v) { Arel.sql("ARRAY[#{v.to_i}]") }
|
338
348
|
config.add_predicate("dtgt", arel_predicate: "gt", formatter: minute_start, validator: value_presence, type: :datetime)
|
339
349
|
config.add_predicate("dtlt", arel_predicate: "lt", formatter: minute_end, validator: value_presence, type: :datetime)
|
340
350
|
config.add_predicate("dtgteq", arel_predicate: "gteq", formatter: minute_start, validator: value_presence, type: :datetime)
|
341
351
|
config.add_predicate("dtlteq", arel_predicate: "lteq", formatter: minute_end, validator: value_presence, type: :datetime)
|
352
|
+
# this allows to search for an integer inside a column that is an array
|
353
|
+
config.add_predicate("contains", arel_predicate: "contains", formatter: array_cast, validator: integer_presence)
|
342
354
|
end
|
343
355
|
end
|
344
356
|
|
@@ -415,8 +427,8 @@ module Decidim
|
|
415
427
|
Decidim.stats.register :processes_count, priority: StatsRegistry::HIGH_PRIORITY do |organization, start_at, end_at|
|
416
428
|
processes = ParticipatoryProcesses::OrganizationPrioritizedParticipatoryProcesses.new(organization)
|
417
429
|
|
418
|
-
processes = processes.where(
|
419
|
-
processes = processes.where(
|
430
|
+
processes = processes.where(created_at: start_at..) if start_at.present?
|
431
|
+
processes = processes.where(created_at: ..end_at) if end_at.present?
|
420
432
|
processes.count
|
421
433
|
end
|
422
434
|
end
|
@@ -764,7 +776,9 @@ module Decidim
|
|
764
776
|
end
|
765
777
|
|
766
778
|
config.to_prepare do
|
767
|
-
|
779
|
+
ActiveSupport.on_load(:action_view) do
|
780
|
+
include Decidim::FlashHelperExtensions
|
781
|
+
end
|
768
782
|
end
|
769
783
|
end
|
770
784
|
end
|
data/lib/decidim/core/menu.rb
CHANGED
@@ -56,11 +56,6 @@ module Decidim
|
|
56
56
|
position: 1.3
|
57
57
|
end
|
58
58
|
|
59
|
-
menu.add_item :user_interests,
|
60
|
-
t("my_interests", scope: "layouts.decidim.user_profile"),
|
61
|
-
decidim.user_interests_path,
|
62
|
-
position: 1.4
|
63
|
-
|
64
59
|
menu.add_item :download_your_data,
|
65
60
|
t("my_data", scope: "layouts.decidim.user_profile"),
|
66
61
|
decidim.download_your_data_path,
|
data/lib/decidim/core/seeds.rb
CHANGED
@@ -14,10 +14,50 @@ module Decidim
|
|
14
14
|
Rails.application.reloader.reload! if Rails.application.reloader.check!
|
15
15
|
reset_column_information
|
16
16
|
|
17
|
-
ActiveJob::Base.queue_adapter = :inline
|
18
|
-
|
19
17
|
organization = create_organization!
|
20
18
|
|
19
|
+
if organization.taxonomies.none?
|
20
|
+
taxonomy = create_taxonomy!(name: "Scopes", parent: nil)
|
21
|
+
3.times do
|
22
|
+
sub_taxonomy = create_taxonomy!(name: ::Faker::Address.state, parent: taxonomy)
|
23
|
+
|
24
|
+
5.times do
|
25
|
+
create_taxonomy!(name: ::Faker::Address.city, parent: sub_taxonomy)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
# filters for all participatory spaces
|
29
|
+
create_taxonomy_filter!(root_taxonomy: taxonomy,
|
30
|
+
taxonomies: taxonomy.all_children,
|
31
|
+
participatory_space_manifests: Decidim.participatory_space_manifests.pluck(:name))
|
32
|
+
|
33
|
+
taxonomy = create_taxonomy!(name: "Areas", parent: nil)
|
34
|
+
sub_taxonomy = create_taxonomy!(name: "Territorial", parent: taxonomy)
|
35
|
+
3.times do
|
36
|
+
create_taxonomy!(name: ::Faker::Lorem.word, parent: sub_taxonomy)
|
37
|
+
end
|
38
|
+
|
39
|
+
sub_taxonomy = create_taxonomy!(name: "Sectorial", parent: taxonomy)
|
40
|
+
5.times do
|
41
|
+
create_taxonomy!(name: ::Faker::Lorem.word, parent: sub_taxonomy)
|
42
|
+
end
|
43
|
+
# filters for all participatory except conferences
|
44
|
+
create_taxonomy_filter!(root_taxonomy: taxonomy,
|
45
|
+
taxonomies: taxonomy.all_children,
|
46
|
+
participatory_space_manifests: Decidim.participatory_space_manifests.pluck(:name) - [:conferences])
|
47
|
+
|
48
|
+
taxonomy = create_taxonomy!(name: "Categories", parent: nil)
|
49
|
+
3.times do
|
50
|
+
sub_taxonomy = create_taxonomy!(name: ::Faker::Lorem.sentence(word_count: 5), parent: taxonomy)
|
51
|
+
|
52
|
+
5.times do
|
53
|
+
create_taxonomy!(name: ::Faker::Lorem.sentence(word_count: 5), parent: sub_taxonomy)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
# filters not available for participatory spaces
|
57
|
+
create_taxonomy_filter!(root_taxonomy: taxonomy,
|
58
|
+
taxonomies: taxonomy.all_children)
|
59
|
+
end
|
60
|
+
|
21
61
|
if organization.top_scopes.none?
|
22
62
|
province = create_scope_type!(name: "province", plural: "provinces")
|
23
63
|
municipality = create_scope_type!(name: "municipality", plural: "municipalities")
|
@@ -202,6 +202,7 @@ FactoryBot.define do
|
|
202
202
|
accepted_tos_version { organization.tos_version }
|
203
203
|
notifications_sending_frequency { "real_time" }
|
204
204
|
email_on_moderations { true }
|
205
|
+
email_on_assigned_proposals { true }
|
205
206
|
password_updated_at { Time.current }
|
206
207
|
previous_passwords { [] }
|
207
208
|
extended_data { {} }
|
@@ -250,6 +251,15 @@ FactoryBot.define do
|
|
250
251
|
managed { true }
|
251
252
|
end
|
252
253
|
|
254
|
+
trait :tos_not_accepted do
|
255
|
+
accepted_tos_version { nil }
|
256
|
+
end
|
257
|
+
|
258
|
+
trait :ephemeral do
|
259
|
+
managed
|
260
|
+
extended_data { { ephemeral: true } }
|
261
|
+
end
|
262
|
+
|
253
263
|
trait :officialized do
|
254
264
|
officialized_at { Time.current }
|
255
265
|
officialized_as { generate_localized_title(:officialized_as, skip_injection:) }
|
@@ -269,6 +279,16 @@ FactoryBot.define do
|
|
269
279
|
end
|
270
280
|
user
|
271
281
|
privatable_to { create(:participatory_process, organization: user.organization, skip_injection:) }
|
282
|
+
|
283
|
+
role { generate_localized_title(:role, skip_injection:) }
|
284
|
+
|
285
|
+
trait :unpublished do
|
286
|
+
published { false }
|
287
|
+
end
|
288
|
+
|
289
|
+
trait :published do
|
290
|
+
published { true }
|
291
|
+
end
|
272
292
|
end
|
273
293
|
|
274
294
|
factory :assembly_private_user, class: "Decidim::ParticipatorySpacePrivateUser" do
|
@@ -421,6 +441,10 @@ FactoryBot.define do
|
|
421
441
|
slug { Decidim::StaticPage::DEFAULT_PAGES.sample }
|
422
442
|
end
|
423
443
|
|
444
|
+
trait :public do
|
445
|
+
allow_public_access { true }
|
446
|
+
end
|
447
|
+
|
424
448
|
trait :tos do
|
425
449
|
slug { "terms-of-service" }
|
426
450
|
after(:create) do |tos_page|
|
@@ -497,6 +521,7 @@ FactoryBot.define do
|
|
497
521
|
participatory_space { create(:participatory_process, organization:, skip_injection:) }
|
498
522
|
manifest_name { "dummy" }
|
499
523
|
published_at { Time.current }
|
524
|
+
deleted_at { nil }
|
500
525
|
settings do
|
501
526
|
{
|
502
527
|
dummy_global_translatable_text: generate_localized_title(:dummy_global_translatable_text, skip_injection:),
|
@@ -527,6 +552,10 @@ FactoryBot.define do
|
|
527
552
|
published_at { Time.current }
|
528
553
|
end
|
529
554
|
|
555
|
+
trait :trashed do
|
556
|
+
deleted_at { Time.current }
|
557
|
+
end
|
558
|
+
|
530
559
|
trait :with_amendments_enabled do
|
531
560
|
settings do
|
532
561
|
{
|
@@ -634,6 +663,56 @@ FactoryBot.define do
|
|
634
663
|
organization
|
635
664
|
end
|
636
665
|
|
666
|
+
factory :taxonomy, class: "Decidim::Taxonomy" do
|
667
|
+
transient do
|
668
|
+
skip_injection { false }
|
669
|
+
end
|
670
|
+
|
671
|
+
name { generate_localized_title(:taxonomy_name, skip_injection:) }
|
672
|
+
organization
|
673
|
+
parent { nil }
|
674
|
+
weight { nil }
|
675
|
+
|
676
|
+
trait :with_parent do
|
677
|
+
parent { create(:taxonomy, organization:, skip_injection:) }
|
678
|
+
end
|
679
|
+
|
680
|
+
trait :with_children do
|
681
|
+
transient do
|
682
|
+
children_count { 3 }
|
683
|
+
end
|
684
|
+
|
685
|
+
after(:create) do |taxonomy, evaluator|
|
686
|
+
create_list(:taxonomy, evaluator.children_count, parent: taxonomy, organization: taxonomy.organization)
|
687
|
+
end
|
688
|
+
end
|
689
|
+
end
|
690
|
+
|
691
|
+
factory :taxonomization, class: "Decidim::Taxonomization" do
|
692
|
+
taxonomy { association(:taxonomy, :with_parent) }
|
693
|
+
taxonomizable { association(:dummy_resource) }
|
694
|
+
end
|
695
|
+
|
696
|
+
factory :taxonomy_filter, class: "Decidim::TaxonomyFilter" do
|
697
|
+
root_taxonomy { association(:taxonomy) }
|
698
|
+
participatory_space_manifests { ["participatory_processes"] }
|
699
|
+
|
700
|
+
trait :with_items do
|
701
|
+
transient do
|
702
|
+
items_count { 3 }
|
703
|
+
end
|
704
|
+
|
705
|
+
after(:create) do |taxonomy_filter, evaluator|
|
706
|
+
create_list(:taxonomy_filter_item, evaluator.items_count, taxonomy_filter:)
|
707
|
+
end
|
708
|
+
end
|
709
|
+
end
|
710
|
+
|
711
|
+
factory :taxonomy_filter_item, class: "Decidim::TaxonomyFilterItem" do
|
712
|
+
taxonomy_filter
|
713
|
+
taxonomy_item { association(:taxonomy, parent: taxonomy_filter.root_taxonomy) }
|
714
|
+
end
|
715
|
+
|
637
716
|
factory :coauthorship, class: "Decidim::Coauthorship" do
|
638
717
|
transient do
|
639
718
|
skip_injection { false }
|
@@ -743,6 +822,11 @@ FactoryBot.define do
|
|
743
822
|
some_extra_data: "1"
|
744
823
|
}
|
745
824
|
end
|
825
|
+
|
826
|
+
trait :proposal_coauthor_invite do
|
827
|
+
event_name { "decidim.events.proposals.coauthor_invited" }
|
828
|
+
event_class { "Decidim::Proposals::CoauthorInvitedEvent" }
|
829
|
+
end
|
746
830
|
end
|
747
831
|
|
748
832
|
factory :conversation, class: "Decidim::Messaging::Conversation" do
|
@@ -858,7 +942,6 @@ FactoryBot.define do
|
|
858
942
|
organization { resource.component.organization }
|
859
943
|
decidim_participatory_space { resource.component.participatory_space }
|
860
944
|
locale { I18n.locale }
|
861
|
-
scope { resource.scope }
|
862
945
|
content_a { Faker::Lorem.sentence }
|
863
946
|
datetime { Time.current }
|
864
947
|
end
|
@@ -917,6 +1000,22 @@ FactoryBot.define do
|
|
917
1000
|
end
|
918
1001
|
end
|
919
1002
|
|
1003
|
+
factory :user_block, class: "Decidim::UserBlock" do
|
1004
|
+
transient do
|
1005
|
+
organization { create(:organization) }
|
1006
|
+
blocked_at { Time.current }
|
1007
|
+
end
|
1008
|
+
justification { generate(:title) }
|
1009
|
+
blocking_user { create(:user, :admin, :confirmed, organization:) }
|
1010
|
+
user { create(:user, :blocked, :confirmed, organization:) }
|
1011
|
+
|
1012
|
+
after(:create) do |object, evaluator|
|
1013
|
+
object.user.block_id = object.id
|
1014
|
+
object.user.blocked_at = evaluator.blocked_at
|
1015
|
+
object.user.save!
|
1016
|
+
end
|
1017
|
+
end
|
1018
|
+
|
920
1019
|
factory :user_report, class: "Decidim::UserReport" do
|
921
1020
|
transient do
|
922
1021
|
skip_injection { false }
|
@@ -930,7 +1029,7 @@ FactoryBot.define do
|
|
930
1029
|
transient do
|
931
1030
|
skip_injection { false }
|
932
1031
|
end
|
933
|
-
user {
|
1032
|
+
user { create(:user, :confirmed) }
|
934
1033
|
end
|
935
1034
|
|
936
1035
|
factory :endorsement, class: "Decidim::Endorsement" do
|
@@ -961,6 +1060,10 @@ FactoryBot.define do
|
|
961
1060
|
object.organization ||= object.token_for.organization
|
962
1061
|
end
|
963
1062
|
|
1063
|
+
trait :with_token do
|
1064
|
+
token { SecureRandom.hex(32) }
|
1065
|
+
end
|
1066
|
+
|
964
1067
|
trait :expired do
|
965
1068
|
expires_at { 1.day.ago }
|
966
1069
|
end
|
@@ -1,5 +1,90 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
shared_examples "admin creates resource gallery for resources" do
|
4
|
+
context "when uploading images" do
|
5
|
+
let(:uploaded_files) do
|
6
|
+
[
|
7
|
+
{
|
8
|
+
title: "Picture of the city",
|
9
|
+
file: ActiveStorage::Blob.create_and_upload!(io: Decidim::Dev.test_file("city.jpeg", "image/jpeg"), filename: "city.jpeg").signed_id
|
10
|
+
},
|
11
|
+
{
|
12
|
+
title: "Picture of another city",
|
13
|
+
file: ActiveStorage::Blob.create_and_upload!(io: Decidim::Dev.test_file("city2.jpeg", "image/jpeg"), filename: "city2.jpeg").signed_id
|
14
|
+
}
|
15
|
+
]
|
16
|
+
end
|
17
|
+
let(:photos) { [] }
|
18
|
+
|
19
|
+
it "creates a gallery for the resource" do
|
20
|
+
command.call
|
21
|
+
expect { command.call }.to change(Decidim::Attachment, :count).by(uploaded_files.count)
|
22
|
+
|
23
|
+
resource = resource_class.last
|
24
|
+
expect(resource.photos.count).to eq(uploaded_files.count)
|
25
|
+
last_attachment = Decidim::Attachment.last
|
26
|
+
expect(last_attachment.attached_to).to eq(resource)
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when gallery is left blank" do
|
30
|
+
let(:uploaded_files) { [] }
|
31
|
+
|
32
|
+
it "broadcasts ok" do
|
33
|
+
expect { command.call }.to broadcast(:ok)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
shared_examples "admin manages resource gallery for resources" do
|
40
|
+
context "when managing images" do
|
41
|
+
let(:uploaded_files) do
|
42
|
+
[
|
43
|
+
{
|
44
|
+
title: "Picture of the city",
|
45
|
+
file: ActiveStorage::Blob.create_and_upload!(io: Decidim::Dev.test_file("city.jpeg", "image/jpeg"), filename: "city.jpeg").signed_id
|
46
|
+
},
|
47
|
+
{
|
48
|
+
title: "Picture of another city",
|
49
|
+
file: ActiveStorage::Blob.create_and_upload!(io: Decidim::Dev.test_file("city2.jpeg", "image/jpeg"), filename: "city2.jpeg").signed_id
|
50
|
+
}
|
51
|
+
]
|
52
|
+
end
|
53
|
+
let(:photos) { [] }
|
54
|
+
|
55
|
+
it "creates a gallery for the resource" do
|
56
|
+
command.call
|
57
|
+
expect { command.call }.to change(Decidim::Attachment, :count).by(uploaded_files.count)
|
58
|
+
resource = resource_class.last
|
59
|
+
expect(resource.photos.count).to eq(4)
|
60
|
+
last_attachment = Decidim::Attachment.last
|
61
|
+
expect(last_attachment.attached_to).to eq(resource)
|
62
|
+
end
|
63
|
+
|
64
|
+
context "when gallery is left blank" do
|
65
|
+
let(:uploaded_files) { [] }
|
66
|
+
|
67
|
+
it "broadcasts ok" do
|
68
|
+
expect { command.call }.to broadcast(:ok)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context "when images are removed" do
|
73
|
+
let!(:image1) { create(:attachment, :with_image, attached_to: resource) }
|
74
|
+
let!(:image2) { create(:attachment, :with_image, attached_to: resource) }
|
75
|
+
let(:uploaded_files) { [] }
|
76
|
+
let(:documents) { [] }
|
77
|
+
|
78
|
+
it "to decrease the number of photos in the gallery" do
|
79
|
+
expect(resource.attachments.count).to eq(3)
|
80
|
+
command.call
|
81
|
+
expect { command.call }.to change(Decidim::Attachment, :count).by(uploaded_files.count)
|
82
|
+
expect(resource.attachments.count).to eq(1)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
3
88
|
shared_examples "admin creates resource gallery" do
|
4
89
|
context "when uploading images" do
|
5
90
|
let(:uploaded_photos) do
|