decidim-core 0.26.8 → 0.27.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-core might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/cells/decidim/amendable/announcement_cell.rb +4 -9
- data/app/cells/decidim/announcement_cell.rb +2 -2
- data/app/cells/decidim/author_cell.rb +1 -1
- data/app/cells/decidim/card_m_cell.rb +1 -1
- data/app/cells/decidim/collapsible_list/show.erb +1 -1
- data/app/cells/decidim/content_blocks/cta/show.erb +1 -1
- data/app/cells/decidim/content_blocks/cta_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/footer_sub_hero/show.erb +1 -1
- data/app/cells/decidim/content_blocks/hero/show.erb +2 -2
- data/app/cells/decidim/content_blocks/highlighted_content_banner/show.erb +5 -5
- data/app/cells/decidim/content_blocks/highlighted_elements_cell.rb +1 -1
- data/app/cells/decidim/content_blocks/how_to_participate/show.erb +1 -1
- data/app/cells/decidim/content_blocks/last_activity/show.erb +1 -1
- data/app/cells/decidim/content_blocks/last_activity_cell.rb +3 -3
- data/app/cells/decidim/content_blocks/stats_cell.rb +4 -5
- data/app/cells/decidim/content_blocks/sub_hero/show.erb +1 -1
- data/app/cells/decidim/content_blocks/sub_hero_cell.rb +1 -1
- data/app/cells/decidim/data_consent/category.erb +64 -0
- data/app/cells/decidim/data_consent/dialog.erb +29 -0
- data/app/cells/decidim/data_consent/modal.erb +39 -0
- data/app/cells/decidim/data_consent/show.erb +3 -0
- data/app/cells/decidim/data_consent_cell.rb +21 -0
- data/app/cells/decidim/follow_button_cell.rb +5 -7
- data/app/cells/decidim/newsletter_templates/base_cell.rb +0 -8
- data/app/cells/decidim/newsletter_templates/basic_only_text/show.erb +4 -4
- data/app/cells/decidim/newsletter_templates/image_text_cta/show.erb +4 -4
- data/app/cells/decidim/profile_sidebar_cell.rb +1 -1
- data/app/cells/decidim/search_results_cell.rb +1 -1
- data/app/cells/decidim/tos_page/refuse_btn_modal.erb +1 -1
- data/app/cells/decidim/upload_modal/files.erb +52 -0
- data/app/cells/decidim/upload_modal/modal.erb +49 -0
- data/app/cells/decidim/upload_modal/show.erb +3 -0
- data/app/cells/decidim/upload_modal_cell.rb +205 -0
- data/app/cells/decidim/user_conversation/reply.erb +1 -1
- data/app/cells/decidim/user_conversations/add_conversation_users.erb +5 -3
- data/app/cells/decidim/version_cell.rb +2 -13
- data/app/cells/decidim/versions_list_cell.rb +2 -13
- data/app/cells/decidim/versions_list_item_cell.rb +2 -13
- data/app/commands/decidim/accept_group_invitation.rb +1 -1
- data/app/commands/decidim/accept_user_group_join_request.rb +1 -1
- data/app/commands/decidim/amendable/accept.rb +1 -1
- data/app/commands/decidim/amendable/create_draft.rb +1 -1
- data/app/commands/decidim/amendable/destroy_draft.rb +1 -1
- data/app/commands/decidim/amendable/promote.rb +1 -1
- data/app/commands/decidim/amendable/publish_draft.rb +1 -1
- data/app/commands/decidim/amendable/reject.rb +1 -1
- data/app/commands/decidim/amendable/update_draft.rb +1 -1
- data/app/commands/decidim/amendable/withdraw.rb +1 -1
- data/app/commands/decidim/attachment_methods.rb +3 -2
- data/app/commands/decidim/create_editor_image.rb +1 -1
- data/app/commands/decidim/create_follow.rb +1 -1
- data/app/commands/decidim/create_omniauth_registration.rb +2 -3
- data/app/commands/decidim/create_registration.rb +1 -2
- data/app/commands/decidim/create_report.rb +1 -1
- data/app/commands/decidim/create_user_group.rb +2 -2
- data/app/commands/decidim/create_user_report.rb +5 -3
- data/app/commands/decidim/delete_follow.rb +1 -1
- data/app/commands/decidim/demote_membership.rb +1 -1
- data/app/commands/decidim/destroy_account.rb +1 -1
- data/app/commands/decidim/endorse_resource.rb +1 -1
- data/app/commands/decidim/gallery_methods.rb +45 -10
- data/app/commands/decidim/invite_user.rb +1 -3
- data/app/commands/decidim/invite_user_again.rb +1 -1
- data/app/commands/decidim/invite_user_to_group.rb +1 -1
- data/app/commands/decidim/join_user_group.rb +1 -1
- data/app/commands/decidim/leave_user_group.rb +8 -2
- data/app/commands/decidim/messaging/reply_to_conversation.rb +2 -2
- data/app/commands/decidim/messaging/start_conversation.rb +2 -2
- data/app/commands/decidim/multiple_attachments_methods.rb +44 -5
- data/app/commands/decidim/promote_membership.rb +1 -1
- data/app/commands/decidim/reject_group_invitation.rb +1 -1
- data/app/commands/decidim/reject_user_group_join_request.rb +1 -1
- data/app/commands/decidim/remove_user_from_group.rb +1 -1
- data/app/commands/decidim/resend_confirmation_instructions.rb +18 -0
- data/app/commands/decidim/search.rb +10 -9
- data/app/commands/decidim/unendorse_resource.rb +2 -2
- data/app/commands/decidim/unsubscribe_settings.rb +1 -1
- data/app/commands/decidim/update_account.rb +2 -2
- data/app/commands/decidim/update_notifications_settings.rb +3 -2
- data/app/commands/decidim/update_password.rb +31 -0
- data/app/commands/decidim/update_user_group.rb +2 -2
- data/app/commands/decidim/update_user_interests.rb +1 -1
- data/app/commands/decidim/validate_upload.rb +15 -0
- data/app/controllers/concerns/decidim/devise_controllers.rb +0 -1
- data/app/controllers/concerns/decidim/filter_resource.rb +23 -24
- data/app/controllers/concerns/decidim/force_authentication.rb +1 -2
- data/app/controllers/concerns/decidim/http_caching_disabler.rb +1 -1
- data/app/controllers/concerns/decidim/needs_password_change.rb +43 -0
- data/app/controllers/concerns/decidim/needs_tos_accepted.rb +3 -3
- data/app/controllers/concerns/decidim/orderable.rb +1 -1
- data/app/controllers/concerns/decidim/participatory_space_context.rb +2 -2
- data/app/controllers/concerns/decidim/resource_versions_concern.rb +0 -4
- data/app/controllers/decidim/account_controller.rb +45 -0
- data/app/controllers/decidim/application_controller.rb +1 -1
- data/app/controllers/decidim/authorization_modals_controller.rb +1 -1
- data/app/controllers/decidim/devise/invitations_controller.rb +4 -9
- data/app/controllers/decidim/devise/passwords_controller.rb +33 -0
- data/app/controllers/decidim/devise/registrations_controller.rb +3 -5
- data/app/controllers/decidim/devise/sessions_controller.rb +2 -0
- data/app/controllers/decidim/{data_portability_controller.rb → download_your_data_controller.rb} +8 -8
- data/app/controllers/decidim/groups_controller.rb +5 -5
- data/app/controllers/decidim/last_activities_controller.rb +7 -9
- data/app/controllers/decidim/links_controller.rb +11 -10
- data/app/controllers/decidim/manifests_controller.rb +11 -0
- data/app/controllers/decidim/newsletters_controller.rb +1 -1
- data/app/controllers/decidim/notifications_subscriptions_controller.rb +16 -0
- data/app/controllers/decidim/offline_controller.rb +7 -0
- data/app/controllers/decidim/profiles_controller.rb +2 -2
- data/app/controllers/decidim/searches_controller.rb +4 -3
- data/app/controllers/decidim/short_links_controller.rb +35 -0
- data/app/controllers/decidim/upload_validations_controller.rb +44 -0
- data/app/controllers/decidim/user_activities_controller.rb +32 -16
- data/app/controllers/decidim/user_interests_controller.rb +0 -2
- data/app/controllers/decidim/user_timeline_controller.rb +6 -8
- data/app/events/decidim/change_nickname_event.rb +21 -0
- data/app/events/decidim/resource_endorsed_event.rb +1 -2
- data/app/forms/decidim/account_form.rb +3 -3
- data/app/forms/decidim/amendable/form.rb +1 -2
- data/app/forms/decidim/form.rb +1 -1
- data/app/forms/decidim/messaging/conversation_form.rb +1 -1
- data/app/forms/decidim/notifications_settings_form.rb +8 -2
- data/app/forms/decidim/password_form.rb +10 -0
- data/app/forms/decidim/registration_form.rb +2 -2
- data/app/forms/decidim/upload_validation_form.rb +54 -0
- data/app/forms/decidim/user_group_form.rb +1 -1
- data/app/forms/decidim/user_interest_scope_form.rb +1 -1
- data/app/forms/decidim/user_interests_form.rb +1 -1
- data/app/forms/translatable_presence_validator.rb +2 -2
- data/app/forms/url_validator.rb +1 -1
- data/app/helpers/decidim/application_helper.rb +2 -2
- data/app/helpers/decidim/attachments_helper.rb +1 -1
- data/app/helpers/decidim/cells_helper.rb +0 -1
- data/app/helpers/decidim/cells_paginate_helper.rb +1 -1
- data/app/helpers/decidim/datalist_select_helper.rb +40 -0
- data/app/helpers/decidim/decidim_form_helper.rb +1 -1
- data/app/helpers/decidim/external_domain_helper.rb +3 -14
- data/app/helpers/decidim/filters_helper.rb +1 -5
- data/app/helpers/decidim/followable_helper.rb +1 -1
- data/app/helpers/decidim/icon_helper.rb +4 -4
- data/app/helpers/decidim/layout_helper.rb +19 -16
- data/app/helpers/decidim/map_helper.rb +12 -8
- data/app/helpers/decidim/meta_tags_helper.rb +0 -2
- data/app/helpers/decidim/newsletters_helper.rb +0 -1
- data/app/helpers/decidim/notifications_settings_helper.rb +15 -0
- data/app/helpers/decidim/passwords_helper.rb +41 -0
- data/app/helpers/decidim/sanitize_helper.rb +6 -15
- data/app/helpers/decidim/searches_helper.rb +6 -6
- data/app/helpers/decidim/short_link_helper.rb +28 -0
- data/app/helpers/decidim/translations_helper.rb +2 -2
- data/app/jobs/decidim/{data_portability_export_job.rb → download_your_data_export_job.rb} +5 -5
- data/app/jobs/decidim/email_notifications_digest_generator_job.rb +21 -0
- data/app/jobs/decidim/notification_generator_for_recipient_job.rb +5 -3
- data/app/jobs/decidim/reminder_generator_job.rb +12 -0
- data/app/jobs/decidim/resend_confirmation_instructions_job.rb +11 -0
- data/app/jobs/decidim/user_report_job.rb +2 -2
- data/app/mailers/concerns/decidim/multitenant_asset_host.rb +11 -3
- data/app/mailers/decidim/application_mailer.rb +1 -1
- data/app/mailers/decidim/block_user_mailer.rb +8 -7
- data/app/mailers/decidim/export_mailer.rb +2 -2
- data/app/mailers/decidim/newsletter_mailer.rb +5 -12
- data/app/mailers/decidim/newsletters_opt_in_mailer.rb +7 -5
- data/app/mailers/decidim/notification_mailer.rb +0 -1
- data/app/mailers/decidim/notifications_digest_mailer.rb +23 -0
- data/app/mailers/decidim/user_report_mailer.rb +10 -11
- data/app/models/decidim/action_log.rb +95 -11
- data/app/models/decidim/amendment.rb +0 -1
- data/app/models/decidim/area.rb +1 -2
- data/app/models/decidim/area_type.rb +5 -0
- data/app/models/decidim/attachment.rb +6 -0
- data/app/models/decidim/attachment_collection.rb +5 -0
- data/app/models/decidim/category.rb +9 -4
- data/app/models/decidim/coauthorship.rb +0 -2
- data/app/models/decidim/contextual_help_section.rb +5 -1
- data/app/models/decidim/follow.rb +2 -2
- data/app/models/decidim/gamification/badge_score.rb +0 -1
- data/app/models/decidim/identity.rb +2 -2
- data/app/models/decidim/messaging/conversation.rb +4 -4
- data/app/models/decidim/messaging/message.rb +1 -2
- data/app/models/decidim/messaging/participation.rb +0 -2
- data/app/models/decidim/messaging/receipt.rb +0 -2
- data/app/models/decidim/newsletter.rb +0 -28
- data/app/models/decidim/notification.rb +5 -2
- data/app/models/decidim/oauth_application.rb +12 -1
- data/app/models/decidim/organization.rb +7 -13
- data/app/models/decidim/participatory_space_private_user.rb +4 -2
- data/app/models/decidim/permission_action.rb +1 -0
- data/app/models/decidim/reminder.rb +10 -0
- data/app/models/decidim/reminder_delivery.rb +7 -0
- data/app/models/decidim/reminder_record.rb +29 -0
- data/app/models/decidim/report.rb +2 -2
- data/app/models/decidim/scope.rb +3 -4
- data/app/models/decidim/scope_type.rb +1 -24
- data/app/models/decidim/share_token.rb +0 -2
- data/app/models/decidim/short_link.rb +162 -0
- data/app/models/decidim/user.rb +36 -6
- data/app/models/decidim/user_base_entity.rb +1 -4
- data/app/models/decidim/user_block.rb +2 -2
- data/app/models/decidim/user_group.rb +4 -4
- data/app/models/decidim/user_moderation.rb +0 -2
- data/app/models/decidim/user_report.rb +2 -2
- data/app/packs/entrypoints/decidim_core.js +2 -2
- data/app/packs/entrypoints/decidim_sw.js +1 -0
- data/app/packs/images/decidim/gamification/badges/decidim_gamification_badges_invitations.svg +1 -0
- data/app/packs/src/decidim/autocomplete.js +298 -0
- data/app/packs/src/decidim/cookie_consent/consent_manager.js +133 -0
- data/app/packs/src/decidim/cookie_consent/cookie_consent.js +103 -0
- data/app/packs/src/decidim/datalist_select.js +36 -0
- data/app/packs/src/decidim/direct_uploads/upload_field.js +117 -0
- data/app/packs/src/decidim/direct_uploads/upload_modal.js +264 -0
- data/app/packs/src/decidim/direct_uploads/upload_utility.js +49 -0
- data/app/packs/src/decidim/direct_uploads/uploader.js +89 -0
- data/app/packs/src/decidim/editor/linebreak_module.js +8 -0
- data/app/packs/src/decidim/editor.js +33 -70
- data/app/packs/src/decidim/external_domain_warning.js +1 -1
- data/app/packs/src/decidim/external_link.js +14 -3
- data/app/packs/src/decidim/external_link.test.js +64 -0
- data/app/packs/src/decidim/form_filter.component.test.js +5 -148
- data/app/packs/src/decidim/form_filter.js +4 -26
- data/app/packs/src/decidim/geocoding.js +10 -35
- data/app/packs/src/decidim/identity_selector_dialog.js +1 -1
- data/app/packs/src/decidim/impersonation.js +3 -3
- data/app/packs/src/decidim/input_character_counter.js +177 -7
- data/app/packs/src/decidim/input_multiple_mentions.js +87 -187
- data/app/packs/src/decidim/map/controller/drag_marker.js +2 -0
- data/app/packs/src/decidim/map/controller/markers.js +1 -0
- data/app/packs/src/decidim/map/controller/static.js +1 -0
- data/app/packs/src/decidim/map/controller.js +2 -0
- data/app/packs/src/decidim/map/factory.js +1 -4
- data/app/packs/src/decidim/map/icon.js +3 -1
- data/app/packs/src/decidim/map/legacy.js +1 -0
- data/app/packs/src/decidim/map/provider/default.js +0 -2
- data/app/packs/src/decidim/map/provider/here.js +1 -2
- data/app/packs/src/decidim/map/svg-icon.js +248 -0
- data/app/packs/src/decidim/security/selfxss_warning.js +5 -1
- data/app/packs/src/decidim/session_timeouter.js +15 -15
- data/app/packs/src/decidim/sw/a2hs.js +28 -0
- data/app/packs/src/decidim/sw/index.js +3 -0
- data/app/packs/src/decidim/sw/loader.js +18 -0
- data/app/packs/src/decidim/sw/push-permissions.js +87 -0
- data/app/packs/src/decidim/sw/sw.js +80 -0
- data/app/packs/src/decidim/vizzs/areachart.js +33 -28
- data/app/packs/src/decidim/vizzs/linechart.js +23 -18
- data/app/packs/src/decidim/vizzs/rowchart.js +15 -11
- data/app/packs/stylesheets/decidim/_editor.scss +0 -129
- data/app/packs/stylesheets/decidim/email.scss +66 -7
- data/app/packs/stylesheets/decidim/extras/_quill.scss +6 -0
- data/app/packs/stylesheets/decidim/layouts/_user.scss +8 -0
- data/app/packs/stylesheets/decidim/modules/_autocomplete.scss +99 -0
- data/app/packs/stylesheets/decidim/modules/_buttons.scss +6 -10
- data/app/packs/stylesheets/decidim/modules/_cards.scss +1 -3
- data/app/packs/stylesheets/decidim/modules/_comments.scss +0 -26
- data/app/packs/stylesheets/decidim/modules/_cookie-consent.scss +115 -0
- data/app/packs/stylesheets/decidim/modules/_footer.scss +4 -0
- data/app/packs/stylesheets/decidim/modules/_forms.scss +0 -5
- data/app/packs/stylesheets/decidim/modules/_input-multiple-mentions.scss +29 -2
- data/app/packs/stylesheets/decidim/modules/_modules.scss +3 -1
- data/app/packs/stylesheets/decidim/modules/_reveal.scss +15 -0
- data/app/packs/stylesheets/decidim/modules/_upload_modal.scss +143 -0
- data/app/packs/stylesheets/decidim/utils/_fontface.scss +3 -0
- data/app/packs/stylesheets/decidim/vizzs/_linechart.scss +2 -2
- data/app/packs/stylesheets/decidim/vizzs/_rowchart.scss +2 -2
- data/app/permissions/decidim/permissions.rb +4 -8
- data/app/presenters/decidim/admin_log/area_type_presenter.rb +34 -0
- data/app/presenters/decidim/admin_log/attachment_collection_presenter.rb +35 -0
- data/app/presenters/decidim/admin_log/attachment_presenter.rb +27 -0
- data/app/presenters/decidim/admin_log/category_presenter.rb +36 -0
- data/app/presenters/decidim/admin_log/component_presenter.rb +35 -3
- data/app/presenters/decidim/admin_log/contextual_help_section_presenter.rb +33 -0
- data/app/presenters/decidim/admin_log/organization_presenter.rb +9 -4
- data/app/presenters/decidim/admin_log/scope_type_presenter.rb +34 -0
- data/app/presenters/decidim/admin_log/user_group_presenter.rb +1 -1
- data/app/presenters/decidim/admin_log/user_moderation_presenter.rb +1 -1
- data/app/presenters/decidim/home_stats_presenter.rb +8 -13
- data/app/presenters/decidim/log/base_presenter.rb +1 -1
- data/app/presenters/decidim/menu_item_presenter.rb +1 -1
- data/app/presenters/decidim/metric_charts_presenter.rb +7 -1
- data/app/presenters/decidim/nil_presenter.rb +3 -1
- data/app/presenters/decidim/notification_presenter.rb +1 -1
- data/app/presenters/decidim/notification_to_mailer_presenter.rb +39 -0
- data/app/presenters/decidim/notifications_digest_presenter.rb +42 -0
- data/app/presenters/decidim/official_author_presenter.rb +4 -0
- data/app/presenters/decidim/organization_presenter.rb +22 -0
- data/app/presenters/decidim/push_notification_presenter.rb +24 -0
- data/app/presenters/decidim/stats_presenter.rb +9 -8
- data/app/presenters/decidim/user_group_presenter.rb +1 -1
- data/app/presenters/decidim/user_presenter.rb +5 -13
- data/app/presenters/decidim/validation_errors_presenter.rb +1 -1
- data/app/queries/decidim/messaging/user_conversations.rb +1 -1
- data/app/queries/decidim/metric_manage.rb +1 -1
- data/app/queries/decidim/metrics/users_metric_manage.rb +6 -6
- data/app/queries/decidim/own_activities.rb +11 -0
- data/app/queries/decidim/participatory_processes_with_user_role.rb +1 -1
- data/app/{services/decidim/activity_search.rb → queries/decidim/public_activities.rb} +35 -78
- data/app/queries/decidim/public_components.rb +1 -1
- data/app/queries/decidim/similar_emendations.rb +1 -1
- data/app/queries/decidim/stats_users_count.rb +1 -1
- data/app/queries/decidim/user_groups/accepted_memberships.rb +1 -1
- data/app/queries/decidim/user_groups/accepted_user_groups.rb +1 -1
- data/app/queries/decidim/user_groups/accepted_users.rb +1 -1
- data/app/queries/decidim/user_groups/admin_memberships.rb +1 -1
- data/app/queries/decidim/user_groups/invited_memberships.rb +1 -1
- data/app/queries/decidim/user_groups/manageable_user_groups.rb +1 -1
- data/app/queries/decidim/user_groups/member_memberships.rb +1 -1
- data/app/scrubbers/decidim/user_input_scrubber.rb +5 -32
- data/app/services/decidim/{data_portability_exporter.rb → download_your_data_exporter.rb} +6 -6
- data/app/services/decidim/email_notification_generator.rb +2 -2
- data/app/services/decidim/engine_resolver.rb +66 -0
- data/app/services/decidim/events_manager.rb +1 -1
- data/app/services/decidim/iframe_disabler.rb +31 -0
- data/app/services/decidim/notification_generator_for_recipient.rb +1 -1
- data/app/services/decidim/notifications_digest_sending_decider.rb +18 -0
- data/app/services/decidim/notifications_subscriptions_persistor.rb +37 -0
- data/app/services/decidim/open_data_exporter.rb +1 -1
- data/app/services/decidim/resource_search.rb +17 -164
- data/app/services/decidim/send_push_notification.rb +59 -0
- data/app/services/decidim/traceability.rb +1 -2
- data/app/uploaders/decidim/application_uploader.rb +2 -12
- data/app/uploaders/decidim/cw/attachment_uploader.rb +1 -1
- data/app/uploaders/decidim/cw/{data_portability_uploader.rb → download_your_data_uploader.rb} +3 -3
- data/app/uploaders/decidim/cw/image_uploader.rb +2 -2
- data/app/uploaders/decidim/organization_favicon_uploader.rb +3 -2
- data/app/validators/etiquette_validator.rb +3 -7
- data/app/validators/passthru_validator.rb +29 -21
- data/app/validators/password_validator.rb +25 -4
- data/app/validators/uploader_image_dimensions_validator.rb +1 -1
- data/app/views/decidim/account/_account_notification.js.erb +20 -0
- data/app/views/decidim/account/_password_fields.html.erb +2 -2
- data/app/views/decidim/account/cancel_email_change.js.erb +6 -0
- data/app/views/decidim/account/resend_confirmation_instructions.erb +1 -0
- data/app/views/decidim/account/show.html.erb +19 -6
- data/app/views/decidim/application/{_attachments.html.erb → _attachments.erb} +2 -2
- data/app/views/decidim/application/_collection.html.erb +1 -1
- data/app/views/decidim/application/{_documents.html.erb → _documents.erb} +2 -2
- data/app/views/decidim/devise/confirmations/new.html.erb +1 -1
- data/app/views/decidim/devise/invitations/edit.html.erb +3 -4
- data/app/views/decidim/devise/omniauth_registrations/new.html.erb +3 -3
- data/app/views/decidim/devise/passwords/edit.html.erb +7 -5
- data/app/views/decidim/devise/passwords/new.html.erb +1 -1
- data/app/views/decidim/devise/registrations/edit.html.erb +41 -0
- data/app/views/decidim/devise/registrations/new.html.erb +5 -5
- data/app/views/decidim/devise/sessions/new.html.erb +2 -2
- data/app/views/decidim/{data_portability → download_your_data}/show.html.erb +2 -2
- data/app/views/decidim/export_mailer/download_your_data_export.html.erb +7 -0
- data/app/views/decidim/last_activities/index.html.erb +1 -1
- data/app/views/decidim/links/_modal.html.erb +1 -1
- data/app/views/decidim/links/new.html.erb +1 -1
- data/app/views/decidim/manifests/show.json.erb +31 -0
- data/app/views/decidim/messaging/conversations/_add_conversation_users.html.erb +5 -3
- data/app/views/decidim/messaging/conversations/_conversation.html.erb +5 -1
- data/app/views/decidim/messaging/conversations/_reply.html.erb +1 -1
- data/app/views/decidim/messaging/conversations/_start.html.erb +1 -3
- data/app/views/decidim/messaging/conversations/create.js.erb +1 -0
- data/app/views/decidim/newsletter_mailer/newsletter.html.erb +3 -3
- data/app/views/decidim/newsletters/show.html.erb +1 -1
- data/app/views/decidim/notification_mailer/event_received.html.erb +1 -1
- data/app/views/decidim/notifications_digest_mailer/_email_content.html.erb +11 -0
- data/app/views/decidim/notifications_digest_mailer/digest_mail.erb +27 -0
- data/app/views/decidim/notifications_settings/show.html.erb +79 -52
- data/app/views/decidim/offline/show.html.erb +9 -0
- data/app/views/decidim/pages/_standalone.html.erb +1 -1
- data/app/views/decidim/pages/_tabbed.html.erb +1 -1
- data/app/views/decidim/reported_mailer/hide.html.erb +1 -1
- data/app/views/decidim/reported_mailer/report.html.erb +1 -1
- data/app/views/decidim/scopes/picker.html.erb +1 -1
- data/app/views/decidim/searches/_filters.html.erb +2 -2
- data/app/views/decidim/shared/participatory_space_filters/_filters.html.erb +3 -3
- data/app/views/decidim/user_interests/show.html.erb +13 -11
- data/app/views/decidim/user_report_mailer/notify.html.erb +10 -3
- data/app/views/devise/mailer/confirmation_instructions.html.erb +3 -1
- data/app/views/layouts/decidim/_application.html.erb +6 -3
- data/app/views/layouts/decidim/_cookie_warning.html.erb +8 -8
- data/app/views/layouts/decidim/_decidim_javascript.html.erb +12 -0
- data/app/views/layouts/decidim/_head.html.erb +4 -2
- data/app/views/layouts/decidim/_js_configuration.html.erb +5 -1
- data/app/views/layouts/decidim/_mailer_logo.html.erb +2 -2
- data/app/views/layouts/decidim/_main_footer.html.erb +1 -0
- data/app/views/layouts/decidim/_offline_banner.html.erb +11 -0
- data/app/views/layouts/decidim/newsletter_base.html.erb +2 -2
- data/app/views/layouts/decidim/widget.html.erb +2 -2
- data/config/assets.rb +1 -0
- data/config/locales/am-ET.yml +1 -0
- data/config/locales/ar.yml +76 -456
- data/config/locales/bg.yml +46 -37
- data/config/locales/ca.yml +241 -77
- data/config/locales/cs.yml +251 -89
- data/config/locales/da.yml +1 -3
- data/config/locales/de.yml +60 -123
- data/config/locales/el.yml +44 -134
- data/config/locales/en.yml +220 -56
- data/config/locales/eo.yml +5 -11
- data/config/locales/es-MX.yml +229 -65
- data/config/locales/es-PY.yml +231 -67
- data/config/locales/es.yml +240 -76
- data/config/locales/et.yml +1 -3
- data/config/locales/eu.yml +126 -149
- data/config/locales/fi-plain.yml +220 -56
- data/config/locales/fi.yml +223 -59
- data/config/locales/fr-CA.yml +214 -64
- data/config/locales/fr.yml +220 -70
- data/config/locales/ga-IE.yml +10 -9
- data/config/locales/gl.yml +97 -35
- data/config/locales/hr.yml +1 -3
- data/config/locales/hu.yml +95 -259
- data/config/locales/id-ID.yml +47 -40
- data/config/locales/is-IS.yml +10 -22
- data/config/locales/it.yml +58 -38
- data/config/locales/ja.yml +226 -72
- data/config/locales/ko.yml +1 -0
- data/config/locales/lb.yml +54 -40
- data/config/locales/lt.yml +1 -1743
- data/config/locales/lv.yml +44 -33
- data/config/locales/mt.yml +1 -0
- data/config/locales/nl.yml +78 -41
- data/config/locales/no.yml +78 -40
- data/config/locales/om-ET.yml +1 -0
- data/config/locales/pl.yml +124 -34
- data/config/locales/pt-BR.yml +52 -37
- data/config/locales/pt.yml +48 -34
- data/config/locales/ro-RO.yml +49 -42
- data/config/locales/ru.yml +23 -34
- data/config/locales/si-LK.yml +1 -0
- data/config/locales/sk.yml +52 -51
- data/config/locales/sl.yml +1 -1
- data/config/locales/so-SO.yml +1 -0
- data/config/locales/sr-CS.yml +1 -10
- data/config/locales/sv.yml +126 -44
- data/config/locales/sw-KE.yml +1 -0
- data/config/locales/ti-ER.yml +1 -0
- data/config/locales/tr-TR.yml +51 -38
- data/config/locales/uk.yml +21 -35
- data/config/locales/val-ES.yml +1 -0
- data/config/locales/vi.yml +1 -0
- data/config/locales/zh-CN.yml +47 -33
- data/config/locales/zh-TW.yml +1 -1726
- data/config/routes.rb +19 -22
- data/db/migrate/20180508111710_add_accepted_tos_version_field_to_users.rb +1 -0
- data/db/migrate/20181030090144_destroy_deleted_users_follows.rb +2 -1
- data/db/migrate/20181204110723_remove_following_users_count_from_users.rb +2 -11
- data/db/migrate/20181214101250_add_notification_types_to_users.rb +1 -6
- data/db/migrate/20190412131728_fix_user_names.rb +2 -9
- data/db/migrate/20200211173227_add_direct_message_types_to_users.rb +1 -6
- data/db/migrate/20210302150803_invalidate_all_sessions_for_deleted_users.rb +3 -10
- data/db/migrate/20210310120640_add_followable_counter_cache_to_users.rb +3 -13
- data/db/migrate/20210831181634_add_service_name_to_active_storage_blobs.active_storage.rb +22 -0
- data/db/migrate/20210831181635_create_active_storage_variant_records.active_storage.rb +14 -0
- data/db/migrate/20211208155453_create_decidim_reminders.rb +11 -0
- data/db/migrate/20211209121025_create_decidim_reminder_records.rb +11 -0
- data/db/migrate/20211209121040_create_decidim_reminder_deliveries.rb +10 -0
- data/db/migrate/20220118121921_change_required_description_categories.rb +7 -0
- data/db/migrate/20220127113419_add_notification_settings_to_users.rb +7 -0
- data/db/migrate/20220203121137_add_notifications_sending_frequency_to_users.rb +7 -0
- data/db/migrate/20220215172439_add_digest_sent_at_to_users.rb +7 -0
- data/db/migrate/20220323195258_add_index_to_decidim_users_notifications_sending_frequency.rb +7 -0
- data/db/migrate/20220427142214_drop_emails_on_notifications_flag_from_user.rb +15 -0
- data/db/migrate/20220518094535_add_previous_passwords_to_users.rb +20 -0
- data/db/migrate/20220524195530_create_decidim_short_links.rb +23 -0
- data/db/seeds.rb +17 -18
- data/lib/decidim/acts_as_tree.rb +47 -0
- data/lib/decidim/api/input_sorts/component_input_sort.rb +2 -1
- data/lib/decidim/api/interfaces/authorable_interface.rb +6 -5
- data/lib/decidim/api/types/localized_string_type.rb +0 -9
- data/lib/decidim/api/types/translated_field_type.rb +5 -20
- data/lib/decidim/asset_router.rb +80 -0
- data/lib/decidim/attachment_attributes.rb +8 -8
- data/lib/decidim/attribute_object/form.rb +174 -0
- data/lib/decidim/attribute_object/model.rb +148 -0
- data/lib/decidim/attribute_object/nested_validator.rb +22 -0
- data/lib/decidim/attribute_object/type_map.rb +14 -0
- data/lib/decidim/attribute_object/type_resolver.rb +91 -0
- data/lib/decidim/attribute_object.rb +26 -0
- data/lib/decidim/attributes/array.rb +62 -0
- data/lib/decidim/attributes/blob.rb +20 -0
- data/lib/decidim/attributes/clean_string.rb +12 -6
- data/lib/decidim/attributes/hash.rb +36 -0
- data/lib/decidim/attributes/integer.rb +17 -0
- data/lib/decidim/attributes/localized_date.rb +8 -14
- data/lib/decidim/attributes/model.rb +24 -0
- data/lib/decidim/attributes/object.rb +28 -0
- data/lib/decidim/attributes/symbol.rb +23 -0
- data/lib/decidim/attributes/time_with_zone.rb +7 -17
- data/lib/decidim/attributes.rb +29 -0
- data/lib/decidim/authorable.rb +21 -6
- data/lib/decidim/authorization_form_builder.rb +9 -11
- data/lib/decidim/carrier_wave_migrator_service.rb +15 -15
- data/lib/decidim/coauthorable.rb +22 -4
- data/lib/decidim/command.rb +44 -0
- data/lib/decidim/common_passwords.rb +1 -1
- data/lib/decidim/component_manifest.rb +5 -5
- data/lib/decidim/component_validator.rb +2 -2
- data/lib/decidim/content_block_manifest.rb +1 -1
- data/lib/decidim/content_parsers/hashtag_parser.rb +2 -2
- data/lib/decidim/content_parsers/resource_parser.rb +1 -1
- data/lib/decidim/content_parsers/user_group_parser.rb +1 -1
- data/lib/decidim/content_parsers/user_parser.rb +4 -4
- data/lib/decidim/content_renderers/hashtag_renderer.rb +1 -1
- data/lib/decidim/content_renderers/link_renderer.rb +2 -2
- data/lib/decidim/content_renderers/user_group_renderer.rb +1 -1
- data/lib/decidim/content_renderers/user_renderer.rb +1 -1
- data/lib/decidim/controller_helpers.rb +41 -0
- data/lib/decidim/core/engine.rb +35 -19
- data/lib/decidim/core/test/factories.rb +54 -21
- data/lib/decidim/core/test/shared_examples/admin_resource_gallery_examples.rb +16 -4
- data/lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +15 -2
- data/lib/decidim/core/test/shared_examples/coauthorable_interface_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/comments_examples.rb +203 -36
- data/lib/decidim/core/test/shared_examples/localised_email.rb +1 -1
- data/lib/decidim/core/test/shared_examples/logo_email.rb +1 -1
- data/lib/decidim/core/test/shared_examples/map_examples.rb +3 -6
- data/lib/decidim/core/test/shared_examples/preview_component_with_share_token_examples.rb +0 -6
- data/lib/decidim/core/test/shared_examples/resource_search_examples.rb +120 -40
- data/lib/decidim/core/test/shared_examples/resourceable.rb +0 -6
- data/lib/decidim/core/test/shared_examples/rich_text_editor_examples.rb +3 -7
- data/lib/decidim/core/test/shared_examples/searchable_participatory_space_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/searchable_resources_shared_context.rb +1 -1
- data/lib/decidim/core/test/shared_examples/system_endorse_resource_examples.rb +3 -3
- data/lib/decidim/core/test/shared_examples/translated_event_examples.rb +2 -2
- data/lib/decidim/core/test/shared_examples/with_endorsable_permissions_examples.rb +1 -1
- data/lib/decidim/core/test.rb +0 -4
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/core.rb +105 -54
- data/lib/decidim/{data_portability.rb → download_your_data.rb} +3 -3
- data/lib/decidim/{data_portability_serializers/data_portability_conversation_serializer.rb → download_your_data_serializers/download_your_data_conversation_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_follow_serializer.rb → download_your_data_serializers/download_your_data_follow_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_identity_serializer.rb → download_your_data_serializers/download_your_data_identity_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_notification_serializer.rb → download_your_data_serializers/download_your_data_notification_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_participatory_space_private_user_serializer.rb → download_your_data_serializers/download_your_data_participatory_space_private_user_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_report_serializer.rb → download_your_data_serializers/download_your_data_report_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_user_group_serializer.rb → download_your_data_serializers/download_your_data_user_group_serializer.rb} +2 -2
- data/lib/decidim/{data_portability_serializers/data_portability_user_serializer.rb → download_your_data_serializers/download_your_data_user_serializer.rb} +3 -3
- data/lib/decidim/download_your_data_serializers.rb +23 -0
- data/lib/decidim/engine_router.rb +7 -1
- data/lib/decidim/env.rb +56 -0
- data/lib/decidim/event_recorder.rb +25 -0
- data/lib/decidim/events/base_event.rb +10 -14
- data/lib/decidim/events/simple_event.rb +6 -5
- data/lib/decidim/exporters/export_data.rb +1 -1
- data/lib/decidim/exporters/export_manifest.rb +2 -1
- data/lib/decidim/file_validator_humanizer.rb +24 -1
- data/lib/decidim/filterable_resource.rb +55 -0
- data/lib/decidim/fingerprint_calculator.rb +2 -4
- data/lib/decidim/form_builder.rb +174 -145
- data/lib/decidim/gamification/badge.rb +2 -3
- data/lib/decidim/gamification/badge_scorer.rb +1 -0
- data/lib/decidim/has_area.rb +27 -0
- data/lib/decidim/has_attachments.rb +2 -2
- data/lib/decidim/has_category.rb +36 -0
- data/lib/decidim/has_resource_permission.rb +2 -0
- data/lib/decidim/importers/import_manifest.rb +3 -21
- data/lib/decidim/jsonb_attributes.rb +6 -4
- data/lib/decidim/manifest_messages.rb +23 -0
- data/lib/decidim/map/autocomplete.rb +6 -4
- data/lib/decidim/map/frontend.rb +2 -2
- data/lib/decidim/map/provider/dynamic_map/here.rb +1 -46
- data/lib/decidim/map/provider/geocoding/here.rb +5 -5
- data/lib/decidim/map/provider/here.rb +3 -0
- data/lib/decidim/map/provider/osm.rb +3 -0
- data/lib/decidim/map.rb +4 -4
- data/lib/decidim/menu.rb +1 -1
- data/lib/decidim/metric_manifest.rb +2 -2
- data/lib/decidim/nicknamizable.rb +1 -1
- data/lib/decidim/notification_setting_manifest.rb +19 -0
- data/lib/decidim/organization_settings.rb +8 -7
- data/lib/decidim/participatory_space_context_manifest.rb +2 -2
- data/lib/decidim/participatory_space_manifest.rb +2 -2
- data/lib/decidim/participatory_space_resourceable.rb +1 -7
- data/lib/decidim/processes_file_locally.rb +31 -0
- data/lib/decidim/publicable.rb +0 -4
- data/lib/decidim/query.rb +84 -0
- data/lib/decidim/record_encryptor.rb +29 -8
- data/lib/decidim/reminder_manifest.rb +75 -0
- data/lib/decidim/reminder_registry.rb +67 -0
- data/lib/decidim/resource_manifest.rb +1 -1
- data/lib/decidim/resourceable.rb +15 -5
- data/lib/decidim/scopable.rb +15 -0
- data/lib/decidim/settings_manifest.rb +4 -4
- data/lib/decidim/spring.rb +16 -0
- data/lib/decidim/translatable_attributes.rb +13 -16
- data/lib/decidim/url_option_resolver.rb +50 -0
- data/lib/decidim/view_hooks.rb +1 -1
- data/lib/decidim/view_model.rb +5 -1
- data/lib/decidim/webpacker/thread_safe_compiler.rb +30 -0
- data/lib/decidim/webpacker/webpack/custom.js +15 -3
- data/lib/decidim/webpacker/webpacker.yml +1 -1
- data/lib/decidim/webpacker.rb +2 -0
- data/lib/devise/models/decidim_validatable.rb +1 -1
- data/lib/tasks/decidim_active_storage_migration_tasks.rake +1 -3
- data/lib/tasks/{decidim_data_portability_tasks.rake → decidim_download_your_data_tasks.rake} +9 -9
- data/lib/tasks/decidim_mailers_tasks.rake +23 -0
- data/lib/tasks/decidim_metrics_tasks.rake +1 -1
- data/lib/tasks/decidim_pwa_tasks.rake +18 -0
- data/lib/tasks/decidim_reminders_tasks.rake +17 -0
- data/lib/tasks/decidim_tasks.rake +6 -1
- data/lib/tasks/decidim_webpacker_tasks.rake +1 -1
- data/lib/tasks/upgrade/decidim_fix_nickname_uniqueness.rake +51 -0
- metadata +186 -104
- data/app/controllers/decidim/cookie_policy_controller.rb +0 -24
- data/app/helpers/decidim/cookies_helper.rb +0 -11
- data/app/helpers/decidim/layout_helper.rb.orig +0 -225
- data/app/packs/src/decidim/editor/clipboard_override.js +0 -147
- data/app/packs/src/decidim/editor/clipboard_utilities.js +0 -119
- data/app/packs/src/decidim/vizzs/renders.js +0 -9
- data/app/packs/src/decidim/vizzs.js +0 -1
- data/app/packs/stylesheets/decidim/modules/_cookie-bar.scss +0 -26
- data/app/packs/stylesheets/decidim/modules/_dropdown_menu.scss +0 -9
- data/app/scrubbers/decidim/admin_input_scrubber.rb +0 -27
- data/app/services/decidim/home_activity_search.rb +0 -80
- data/app/services/decidim/participatory_space_search.rb +0 -54
- data/app/views/decidim/cookie_policy/accept.js.erb +0 -3
- data/app/views/decidim/devise/registrations/new.html.erb.orig +0 -231
- data/app/views/decidim/export_mailer/data_portability_export.html.erb +0 -7
- data/app/views/decidim/links/_invalid_url_modal.html.erb +0 -17
- data/app/views/decidim/links/invalid_url.js.erb +0 -24
- data/config/environment.rb +0 -0
- data/config/locales/fa-IR.yml +0 -1
- data/config/locales/gn-PY.yml +0 -4
- data/config/locales/ka-GE.yml +0 -4
- data/config/locales/kaa.yml +0 -5
- data/config/locales/lo-LA.yml +0 -1
- data/config/locales/oc-FR.yml +0 -3
- data/lib/decidim/core/test/shared_examples/editor_shared_examples.rb +0 -10
- data/lib/decidim/core/test/shared_examples/mcell_examples.rb +0 -17
- data/lib/decidim/core/test/shared_examples/resource_endorsed_event_examples.rb +0 -60
- data/lib/decidim/core/test/shared_examples/versions_controller_examples.rb +0 -40
- data/lib/decidim/data_portability_serializers.rb +0 -23
- data/lib/decidim/dependency_resolver.rb +0 -272
- data/lib/decidim/middleware/rails_cookies.rb +0 -23
- data/lib/tasks/upgrade/decidim_user_moderation.rake +0 -14
- /data/app/packs/src/decidim/vizzs/{metrics.js → index.js} +0 -0
- /data/app/views/decidim/application/{_document.html.erb → _document.erb} +0 -0
- /data/app/views/decidim/application/{_photos.html.erb → _photos.erb} +0 -0
- /data/app/views/decidim/{data_portability → download_your_data}/export.html.erb +0 -0
@@ -1,24 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This controller allows the user to accept the cookie policy.
|
5
|
-
class CookiePolicyController < Decidim::ApplicationController
|
6
|
-
skip_before_action :store_current_location
|
7
|
-
|
8
|
-
def accept
|
9
|
-
response.set_cookie(
|
10
|
-
Decidim.config.consent_cookie_name,
|
11
|
-
value: "true",
|
12
|
-
path: "/",
|
13
|
-
httponly: true,
|
14
|
-
secure: request.session_options[:secure],
|
15
|
-
expires: 1.year.from_now.utc
|
16
|
-
)
|
17
|
-
|
18
|
-
respond_to do |format|
|
19
|
-
format.js
|
20
|
-
format.html { redirect_back fallback_location: root_path }
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# This module includes helpers to verify the acceptance of the cookie policy
|
5
|
-
module CookiesHelper
|
6
|
-
# Public: Returns true if the cookie policy has been accepted
|
7
|
-
def cookies_accepted?
|
8
|
-
cookies[Decidim.config.consent_cookie_name].present?
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
@@ -1,225 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# View helpers related to the layout.
|
5
|
-
module LayoutHelper
|
6
|
-
include Decidim::ModalHelper
|
7
|
-
include Decidim::TooltipHelper
|
8
|
-
|
9
|
-
# Public: Generates a set of meta tags that generate the different favicon
|
10
|
-
# versions for an organization.
|
11
|
-
#
|
12
|
-
# Returns a safe String with the versions.
|
13
|
-
def favicon
|
14
|
-
return if current_organization.favicon.blank?
|
15
|
-
|
16
|
-
safe_join(Decidim::OrganizationFaviconUploader::SIZES.map do |version, size|
|
17
|
-
favicon_link_tag(current_organization.attached_uploader(:favicon).variant_url(version, host: current_organization.host), sizes: "#{size}x#{size}")
|
18
|
-
end)
|
19
|
-
end
|
20
|
-
|
21
|
-
def apple_favicon
|
22
|
-
icon_image = current_organization.attached_uploader(:favicon).variant_url(:medium, host: current_organization.host)
|
23
|
-
return unless icon_image
|
24
|
-
|
25
|
-
favicon_link_tag(icon_image, rel: "apple-touch-icon", type: "image/png")
|
26
|
-
end
|
27
|
-
|
28
|
-
def legacy_favicon
|
29
|
-
variant = :favicon if current_organization.favicon.content_type != "image/vnd.microsoft.icon"
|
30
|
-
icon_image = current_organization.attached_uploader(:favicon).variant_url(variant, host: current_organization.host)
|
31
|
-
return unless icon_image
|
32
|
-
|
33
|
-
favicon_link_tag(icon_image, rel: "icon", sizes: "any", type: nil)
|
34
|
-
end
|
35
|
-
|
36
|
-
# Outputs an SVG-based icon.
|
37
|
-
#
|
38
|
-
# name - The String with the icon name.
|
39
|
-
# options - The Hash options used to customize the icon (default {}):
|
40
|
-
# :width - The Number of width in pixels (optional).
|
41
|
-
# :height - The Number of height in pixels (optional).
|
42
|
-
# :title - The title for the SVG element (optional, similar to alt for img)
|
43
|
-
# :aria_label - The String to set as aria label (optional).
|
44
|
-
# :aria_hidden - The Truthy value to enable aria_hidden (optional).
|
45
|
-
# :role - The String to set as the role (optional).
|
46
|
-
# :class - The String to add as a CSS class (optional).
|
47
|
-
#
|
48
|
-
# Returns a String.
|
49
|
-
def redesigned_icon(name, options = {})
|
50
|
-
default_html_properties = {
|
51
|
-
"width" => "1em",
|
52
|
-
"height" => "1em",
|
53
|
-
"role" => "img",
|
54
|
-
"aria-hidden" => "true"
|
55
|
-
}
|
56
|
-
|
57
|
-
html_properties = options.with_indifferent_access.transform_keys(&:dasherize).slice("width", "height", "aria-label", "role", "aria-hidden", "class", "style")
|
58
|
-
html_properties = default_html_properties.merge(html_properties)
|
59
|
-
|
60
|
-
href = Decidim.cors_enabled ? "" : asset_pack_path("media/images/remixicon.symbol.svg")
|
61
|
-
|
62
|
-
content_tag :svg, html_properties do
|
63
|
-
content_tag :use, nil, "href" => "#{href}#ri-#{name}", tabindex: -1
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
def legacy_icon(name, options = {})
|
68
|
-
options = options.with_indifferent_access
|
69
|
-
html_properties = {}
|
70
|
-
|
71
|
-
html_properties["width"] = options[:width]
|
72
|
-
html_properties["height"] = options[:height]
|
73
|
-
html_properties["aria-label"] = options[:aria_label] || options[:"aria-label"]
|
74
|
-
html_properties["role"] = options[:role] || "img"
|
75
|
-
html_properties["aria-hidden"] = options[:aria_hidden] || options[:"aria-hidden"]
|
76
|
-
|
77
|
-
html_properties["class"] = (["icon--#{name}"] + _icon_classes(options)).join(" ")
|
78
|
-
|
79
|
-
title = options["title"] || html_properties["aria-label"]
|
80
|
-
if title.blank? && html_properties["role"] == "img"
|
81
|
-
# This will make the accessibility audit tools happy as with the "img"
|
82
|
-
# role, the alternative text (aria-label) and title are required for the
|
83
|
-
# element. This will also force the SVG to be hidden because otherwise
|
84
|
-
# the screen reader would announce the icon name which can be in
|
85
|
-
# different language (English) than the page language which is not
|
86
|
-
# allowed.
|
87
|
-
title = name
|
88
|
-
html_properties["aria-label"] = title
|
89
|
-
html_properties["aria-hidden"] = true
|
90
|
-
end
|
91
|
-
|
92
|
-
href = Decidim.cors_enabled ? "" : asset_pack_path("media/images/icons.svg")
|
93
|
-
|
94
|
-
content_tag :svg, html_properties do
|
95
|
-
inner = content_tag :title, title
|
96
|
-
inner += content_tag :use, nil, "href" => "#{href}#icon-#{name}"
|
97
|
-
|
98
|
-
inner
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
def icon(*args)
|
103
|
-
redesign_enabled? ? redesigned_icon(*args) : legacy_icon(*args)
|
104
|
-
end
|
105
|
-
|
106
|
-
# Outputs a SVG icon from an external file. It apparently renders an image
|
107
|
-
# tag, but then a JS script kicks in and replaces it with an inlined SVG
|
108
|
-
# version.
|
109
|
-
#
|
110
|
-
# path - The asset's path
|
111
|
-
#
|
112
|
-
# Returns an <img /> tag with the SVG icon.
|
113
|
-
def external_icon(path, options = {})
|
114
|
-
classes = _icon_classes(options) + ["external-icon"]
|
115
|
-
|
116
|
-
if path.split(".").last == "svg"
|
117
|
-
icon_path = application_path(path)
|
118
|
-
return unless icon_path
|
119
|
-
|
120
|
-
attributes = { class: classes.join(" ") }.merge(options)
|
121
|
-
asset = File.read(icon_path)
|
122
|
-
asset.gsub("<svg ", "<svg#{tag_builder.tag_options(attributes)} ").html_safe
|
123
|
-
else
|
124
|
-
image_pack_tag(path, class: classes.join(" "), style: "display: none")
|
125
|
-
end
|
126
|
-
end
|
127
|
-
|
128
|
-
def application_path(path)
|
129
|
-
# Force the path to be returned without the protocol and host even when a
|
130
|
-
# custom asset host has been defined. The host parameter needs to be a
|
131
|
-
# non-nil because otherwise it will be set to the asset host at
|
132
|
-
# ActionView::Helpers::AssetUrlHelper#compute_asset_host.
|
133
|
-
img_path = asset_pack_path(path, host: "", protocol: :relative)
|
134
|
-
path = Rails.public_path.join(img_path.sub(%r{^/}, ""))
|
135
|
-
return unless File.exist?(path)
|
136
|
-
|
137
|
-
path
|
138
|
-
rescue ::Webpacker::Manifest::MissingEntryError
|
139
|
-
nil
|
140
|
-
end
|
141
|
-
|
142
|
-
# Allows to create role attribute according to accessibility rules
|
143
|
-
#
|
144
|
-
# Returns role attribute string if role option is specified
|
145
|
-
def role(options = {})
|
146
|
-
"role=\"#{options[:role]}\" " if options[:role]
|
147
|
-
end
|
148
|
-
|
149
|
-
def _icon_classes(options = {})
|
150
|
-
classes = options[:remove_icon_class] ? [] : ["icon"]
|
151
|
-
classes += [options[:class]]
|
152
|
-
classes.compact
|
153
|
-
end
|
154
|
-
|
155
|
-
def extended_navigation_bar(items, max_items: 5)
|
156
|
-
return unless items.any?
|
157
|
-
|
158
|
-
extra_items = items.slice((max_items + 1)..-1) || []
|
159
|
-
active_item = items.find { |item| item[:active] }
|
160
|
-
|
161
|
-
controller.view_context.render partial: "decidim/shared/extended_navigation_bar", locals: {
|
162
|
-
items:,
|
163
|
-
extra_items:,
|
164
|
-
active_item:,
|
165
|
-
max_items:
|
166
|
-
}
|
167
|
-
end
|
168
|
-
|
169
|
-
# Renders a view with the customizable CSS variables in two flavours:
|
170
|
-
# 1. as a hexadecimal valid CSS color (ie: #ff0000)
|
171
|
-
# 2. as a disassembled RGB components (ie: 255 0 0)
|
172
|
-
#
|
173
|
-
# Example:
|
174
|
-
#
|
175
|
-
# --primary: #ff0000;
|
176
|
-
# --primary-rgb: 255,0,0
|
177
|
-
#
|
178
|
-
# Hexadecimal variables can be used as a normal CSS color:
|
179
|
-
#
|
180
|
-
# color: var(--primary)
|
181
|
-
#
|
182
|
-
# While the disassembled variant can be used where you need to manipulate
|
183
|
-
# the color somehow (ie: adding a background transparency):
|
184
|
-
#
|
185
|
-
# background-color: rgba(var(--primary-rgb), 0.5)
|
186
|
-
def organization_colors
|
187
|
-
css = current_organization.colors.each.map { |k, v| "--#{k}: #{v};--#{k}-rgb: #{v[1..2].hex} #{v[3..4].hex} #{v[5..6].hex};" }.join
|
188
|
-
render partial: "layouts/decidim/organization_colors", locals: { css: }
|
189
|
-
end
|
190
|
-
|
191
|
-
<<<<<<< HEAD
|
192
|
-
def current_user_unread_data
|
193
|
-
return {} if current_user.blank?
|
194
|
-
|
195
|
-
{}.tap do |d|
|
196
|
-
d.merge!(unread_notifications: true) if current_user.notifications.any?
|
197
|
-
d.merge!(unread_conversations: true) if current_user.unread_conversations.any?
|
198
|
-
d.merge!(unread_items: d.present?)
|
199
|
-
end
|
200
|
-
end
|
201
|
-
|
202
|
-
||||||| parent of 53b6893e5c (Use local emojibase data instead of CDN)
|
203
|
-
=======
|
204
|
-
# Public: Gets the name of the webpacker entrypoint that will be used
|
205
|
-
# for the locale of the Emojibase NPM package, used with @picmo/popup-picker
|
206
|
-
#
|
207
|
-
# Returns a string with the entrypoint name
|
208
|
-
def emojibase_entrypoint_locale
|
209
|
-
entrypoint = Decidim::Webpacker.configuration.entrypoints.keys.select do |entry|
|
210
|
-
entry == "decidim_emojibase_#{I18n.locale}"
|
211
|
-
end
|
212
|
-
|
213
|
-
return "decidim_emojibase_en" if entrypoint.empty?
|
214
|
-
|
215
|
-
entrypoint.first
|
216
|
-
end
|
217
|
-
|
218
|
-
>>>>>>> 53b6893e5c (Use local emojibase data instead of CDN)
|
219
|
-
private
|
220
|
-
|
221
|
-
def tag_builder
|
222
|
-
@tag_builder ||= ActionView::Helpers::TagHelper::TagBuilder.new(self)
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
@@ -1,147 +0,0 @@
|
|
1
|
-
/* eslint max-lines: ["error", 350] */
|
2
|
-
|
3
|
-
/**
|
4
|
-
* Quill clipboard utilities
|
5
|
-
*
|
6
|
-
* Copyright (c) 2017, Slab
|
7
|
-
* Copyright (c) 2014, Jason Chen
|
8
|
-
* Copyright (c) 2013, salesforce.com
|
9
|
-
* BSD 3-Clause "New" or "Revised" License
|
10
|
-
*
|
11
|
-
* Extends the original version from https://github.com/quilljs/quill
|
12
|
-
* Relevant parts converted from TypeScript to JavaScript
|
13
|
-
*/
|
14
|
-
|
15
|
-
import CodeBlock from "quill/formats/code";
|
16
|
-
import { matchNewline, matchBreak, deltaEndsWith, traverse } from "src/decidim/editor/clipboard_utilities";
|
17
|
-
|
18
|
-
const Delta = Quill.import("delta");
|
19
|
-
const Clipboard = Quill.import("modules/clipboard");
|
20
|
-
|
21
|
-
/**
|
22
|
-
* Pasting bold text is broken in Quill as described at:
|
23
|
-
* https://github.com/quilljs/quill/issues/306
|
24
|
-
*
|
25
|
-
* The reason is that the `<strong>` nodes are not recognized as bold types.
|
26
|
-
* This override fixes the issue by introducing parts of the newer Quill code
|
27
|
-
* at GitHub and defining the `<strong>` tags as bold tags.
|
28
|
-
*/
|
29
|
-
export default class ClipboardOverride extends Clipboard {
|
30
|
-
constructor(quill, options) {
|
31
|
-
super(quill, options);
|
32
|
-
this.overrideMatcher("b", "b, strong");
|
33
|
-
this.overrideMatcher("br", "br", matchBreak);
|
34
|
-
|
35
|
-
// Change the matchNewLine matchers to the newer version
|
36
|
-
this.matchers[1][1] = matchNewline;
|
37
|
-
this.matchers[3][1] = matchNewline;
|
38
|
-
|
39
|
-
// Remove `matchSpacing` as that is also removed in the newer versions.
|
40
|
-
this.removeMatcher(Node.ELEMENT_NODE, "matchSpacing");
|
41
|
-
}
|
42
|
-
|
43
|
-
overrideMatcher(originalSelector, newSelector, newMatcher = null) {
|
44
|
-
const idx = this.matchers.findIndex((item) => item[0] === originalSelector);
|
45
|
-
if (idx >= 0) {
|
46
|
-
this.matchers[idx][0] = newSelector;
|
47
|
-
if (newMatcher) {
|
48
|
-
this.matchers[idx][1] = newMatcher;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
removeMatcher(selector, matcherName) {
|
54
|
-
const idx = this.matchers.findIndex((item) => item[0] === selector && item[1].name === matcherName);
|
55
|
-
if (idx >= 0) {
|
56
|
-
this.matchers.splice(idx, 1);
|
57
|
-
}
|
58
|
-
}
|
59
|
-
|
60
|
-
onPaste(ev) {
|
61
|
-
if (ev.defaultPrevented || !this.quill.isEnabled()) {
|
62
|
-
return;
|
63
|
-
}
|
64
|
-
ev.preventDefault();
|
65
|
-
const range = this.quill.getSelection(true);
|
66
|
-
if (range === null) {
|
67
|
-
return;
|
68
|
-
}
|
69
|
-
const html = ev.clipboardData.getData("text/html");
|
70
|
-
const text = ev.clipboardData.getData("text/plain");
|
71
|
-
const files = Array.from(ev.clipboardData.files || []);
|
72
|
-
if (!html && files.length > 0) {
|
73
|
-
if (typeof this.quill.uploader !== "undefined") {
|
74
|
-
this.quill.uploader.upload(range, files);
|
75
|
-
}
|
76
|
-
return;
|
77
|
-
}
|
78
|
-
if (html && files.length > 0) {
|
79
|
-
const doc = new DOMParser().parseFromString(html, "text/html");
|
80
|
-
if (
|
81
|
-
doc.body.childElementCount === 1 &&
|
82
|
-
doc.body.firstElementChild.tagName === "IMG"
|
83
|
-
) {
|
84
|
-
if (typeof this.quill.uploader !== "undefined") {
|
85
|
-
this.quill.uploader.upload(range, files);
|
86
|
-
}
|
87
|
-
return;
|
88
|
-
}
|
89
|
-
}
|
90
|
-
this.onPasteRange(range, { html, text });
|
91
|
-
}
|
92
|
-
|
93
|
-
onPasteRange(range, { text, html }) {
|
94
|
-
const formats = this.quill.getFormat(range.index);
|
95
|
-
const pastedDelta = this.convertPaste({ text, html }, formats);
|
96
|
-
// debug.log('onPaste", pastedDelta, { text, html });
|
97
|
-
const delta = new Delta().retain(range.index).delete(range.length).concat(pastedDelta);
|
98
|
-
this.quill.updateContents(delta, Quill.sources.USER);
|
99
|
-
// range.length contributes to delta.length()
|
100
|
-
this.quill.setSelection(
|
101
|
-
delta.length() - range.length,
|
102
|
-
Quill.sources.SILENT,
|
103
|
-
);
|
104
|
-
this.quill.scrollIntoView();
|
105
|
-
}
|
106
|
-
|
107
|
-
convertPaste({ html, text }, formats = {}) {
|
108
|
-
if (formats[CodeBlock.blotName]) {
|
109
|
-
return new Delta().insert(text, {
|
110
|
-
[CodeBlock.blotName]: formats[CodeBlock.blotName]
|
111
|
-
});
|
112
|
-
}
|
113
|
-
if (!html) {
|
114
|
-
return new Delta().insert(text || "");
|
115
|
-
}
|
116
|
-
const delta = this.convertPasteHTML(html);
|
117
|
-
// Remove trailing newline
|
118
|
-
if (
|
119
|
-
deltaEndsWith(delta, "\n") &&
|
120
|
-
(delta.ops[delta.ops.length - 1].attributes === null || formats.table)
|
121
|
-
) {
|
122
|
-
return delta.compose(new Delta().retain(delta.length() - 1).delete(1));
|
123
|
-
}
|
124
|
-
return delta;
|
125
|
-
}
|
126
|
-
|
127
|
-
convertPasteHTML(html) {
|
128
|
-
const doc = new DOMParser().parseFromString(html, "text/html");
|
129
|
-
const container = doc.body;
|
130
|
-
const nodeMatches = new WeakMap();
|
131
|
-
const [elementMatchers, textMatchers] = this.prepareMatching(
|
132
|
-
container,
|
133
|
-
nodeMatches
|
134
|
-
);
|
135
|
-
return traverse(
|
136
|
-
this.quill.scroll,
|
137
|
-
container,
|
138
|
-
elementMatchers,
|
139
|
-
textMatchers,
|
140
|
-
nodeMatches
|
141
|
-
);
|
142
|
-
}
|
143
|
-
}
|
144
|
-
|
145
|
-
// Disable warning messages from overwritting modules
|
146
|
-
Quill.debug("error");
|
147
|
-
Quill.register({"modules/clipboard": ClipboardOverride}, true);
|
@@ -1,119 +0,0 @@
|
|
1
|
-
import { BlockEmbed } from "quill/blots/block";
|
2
|
-
|
3
|
-
const Delta = Quill.import("delta");
|
4
|
-
const Parchment = Quill.import("parchment");
|
5
|
-
|
6
|
-
// Newer version used only for the pasting, not compatible with the version of
|
7
|
-
// Quill in use.
|
8
|
-
const traverse = (scroll, node, elementMatchers, textMatchers, nodeMatches) => { // eslint-disable-line max-params
|
9
|
-
// Post-order
|
10
|
-
if (node.nodeType === node.TEXT_NODE) {
|
11
|
-
return textMatchers.reduce((delta, matcher) => {
|
12
|
-
return matcher(node, delta, scroll);
|
13
|
-
}, new Delta());
|
14
|
-
}
|
15
|
-
if (node.nodeType === node.ELEMENT_NODE) {
|
16
|
-
return Array.from(node.childNodes || []).reduce((delta, childNode) => {
|
17
|
-
let childrenDelta = traverse(
|
18
|
-
scroll,
|
19
|
-
childNode,
|
20
|
-
elementMatchers,
|
21
|
-
textMatchers,
|
22
|
-
nodeMatches,
|
23
|
-
);
|
24
|
-
if (childNode.nodeType === node.ELEMENT_NODE) {
|
25
|
-
childrenDelta = elementMatchers.reduce((reducedDelta, matcher) => {
|
26
|
-
return matcher(childNode, reducedDelta, scroll);
|
27
|
-
}, childrenDelta);
|
28
|
-
childrenDelta = (nodeMatches.get(childNode) || []).reduce(
|
29
|
-
(reducedDelta, matcher) => {
|
30
|
-
return matcher(childNode, reducedDelta, scroll);
|
31
|
-
},
|
32
|
-
childrenDelta,
|
33
|
-
);
|
34
|
-
}
|
35
|
-
return delta.concat(childrenDelta);
|
36
|
-
}, new Delta());
|
37
|
-
}
|
38
|
-
return new Delta();
|
39
|
-
}
|
40
|
-
|
41
|
-
const deltaEndsWith = (delta, text) => {
|
42
|
-
let endText = "";
|
43
|
-
for (let idx = delta.ops.length - 1; idx >= 0 && endText.length < text.length; idx -= 1) {
|
44
|
-
const op = delta.ops[idx];
|
45
|
-
if (typeof op.insert !== "string") {
|
46
|
-
break;
|
47
|
-
}
|
48
|
-
endText = op.insert + endText;
|
49
|
-
}
|
50
|
-
return endText.slice(-1 * text.length) === text;
|
51
|
-
}
|
52
|
-
|
53
|
-
const isLine = (node) => {
|
54
|
-
if (node.childNodes.length === 0) {
|
55
|
-
// Exclude embed blocks
|
56
|
-
return false;
|
57
|
-
}
|
58
|
-
return [
|
59
|
-
"address", "article", "blockquote", "canvas", "dd", "div", "dl", "dt",
|
60
|
-
"fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3",
|
61
|
-
"h4", "h5", "h6", "header", "iframe", "li", "main", "nav", "ol", "output",
|
62
|
-
"p", "pre", "section", "table", "td", "tr", "ul", "video"
|
63
|
-
].includes(node.tagName.toLowerCase());
|
64
|
-
}
|
65
|
-
|
66
|
-
const matchNewLineScroll = (nextSibling, delta, scroll) => {
|
67
|
-
if (!scroll) {
|
68
|
-
return null;
|
69
|
-
}
|
70
|
-
|
71
|
-
const match = Parchment.query(nextSibling)
|
72
|
-
if (match && match.prototype instanceof BlockEmbed) {
|
73
|
-
return delta.insert("\n");
|
74
|
-
}
|
75
|
-
return null;
|
76
|
-
}
|
77
|
-
|
78
|
-
const matchNewline = (node, delta, scroll) => {
|
79
|
-
if (!deltaEndsWith(delta, "\n")) {
|
80
|
-
// When scroll is defined, it was initiated from the paste event. Otherwise
|
81
|
-
// it is a normal Quill initiated traversal which handles adding the line
|
82
|
-
// breaks already.
|
83
|
-
if (scroll && node.nodeType === node.ELEMENT_NODE && node.tagName === "BR") {
|
84
|
-
return delta.insert({"break": ""});
|
85
|
-
}
|
86
|
-
if (isLine(node)) {
|
87
|
-
return delta.insert("\n");
|
88
|
-
}
|
89
|
-
if (delta.length() > 0 && node.nextSibling) {
|
90
|
-
let { nextSibling } = node;
|
91
|
-
while (nextSibling !== null) {
|
92
|
-
if (isLine(nextSibling)) {
|
93
|
-
return delta.insert("\n");
|
94
|
-
}
|
95
|
-
const scrollMatch = matchNewLineScroll(nextSibling, delta, scroll);
|
96
|
-
if (scrollMatch) {
|
97
|
-
return scrollMatch;
|
98
|
-
}
|
99
|
-
nextSibling = nextSibling.firstChild;
|
100
|
-
}
|
101
|
-
}
|
102
|
-
}
|
103
|
-
return delta;
|
104
|
-
}
|
105
|
-
|
106
|
-
const matchBreak = (node, delta) => {
|
107
|
-
if (!deltaEndsWith(delta, "\n")) {
|
108
|
-
delta.insert({"break": ""});
|
109
|
-
}
|
110
|
-
return delta;
|
111
|
-
}
|
112
|
-
|
113
|
-
export {
|
114
|
-
traverse,
|
115
|
-
deltaEndsWith,
|
116
|
-
isLine,
|
117
|
-
matchNewline,
|
118
|
-
matchBreak
|
119
|
-
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
/* eslint-disable require-jsdoc */
|
2
|
-
// renderChart receives a chart function as argument and renders it
|
3
|
-
// Also captures change.zf.tabs event and re-renders the chart
|
4
|
-
export default function renderChart(chart) {
|
5
|
-
chart()
|
6
|
-
$(document).on("change.zf.tabs", () => {
|
7
|
-
chart()
|
8
|
-
});
|
9
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
import "src/decidim/vizzs/metrics"
|
@@ -1,26 +0,0 @@
|
|
1
|
-
.cookie-warning{
|
2
|
-
background: $medium-gray;
|
3
|
-
padding: .5em 1em;
|
4
|
-
text-align: center;
|
5
|
-
|
6
|
-
a{
|
7
|
-
color: darken($anchor-color, 10%);
|
8
|
-
}
|
9
|
-
}
|
10
|
-
|
11
|
-
.cookie-warning__action{
|
12
|
-
text-align: center;
|
13
|
-
|
14
|
-
.button{
|
15
|
-
margin: .5em 0;
|
16
|
-
}
|
17
|
-
|
18
|
-
@include breakpoint(mediumlarge){
|
19
|
-
vertical-align: baseline;
|
20
|
-
display: inline-block;
|
21
|
-
|
22
|
-
.button{
|
23
|
-
margin: 0 0 0 1em;
|
24
|
-
}
|
25
|
-
}
|
26
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# Use this class as a scrubber to sanitize admin user input. The default
|
5
|
-
# scrubbed provided by Rails does not allow `iframe`s, and we are using
|
6
|
-
# them to embed videos, so we need to provide a whole new scrubber.
|
7
|
-
#
|
8
|
-
# Example:
|
9
|
-
#
|
10
|
-
# sanitize(@page.body, scrubber: Decidim::AdminInputScrubber.new)
|
11
|
-
#
|
12
|
-
# Lists of default tags and attributes are extracted from
|
13
|
-
# https://stackoverflow.com/a/35073814/2110884.
|
14
|
-
class AdminInputScrubber < UserInputScrubber
|
15
|
-
private
|
16
|
-
|
17
|
-
DECIDIM_ALLOWED_TAGS = %w(img video audio source comment iframe).freeze
|
18
|
-
|
19
|
-
def custom_allowed_attributes
|
20
|
-
super + %w(frameborder allowfullscreen) - %w(onerror)
|
21
|
-
end
|
22
|
-
|
23
|
-
def custom_allowed_tags
|
24
|
-
super + DECIDIM_ALLOWED_TAGS
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
@@ -1,80 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
# A class to search for recent activity performed in a Decidim Organization.
|
5
|
-
# It will only return the `Decidim::ActionLog` rows that have an action as
|
6
|
-
# `created` or `published`.
|
7
|
-
#
|
8
|
-
# This class is thought to be used in the `LastActivityCell` uniquely.
|
9
|
-
class HomeActivitySearch < Searchlight::Search
|
10
|
-
# Needed by Searchlight, this is the base query that will be used to
|
11
|
-
# append other criteria to the search.
|
12
|
-
def base_query
|
13
|
-
ActionLog
|
14
|
-
.where(visibility: %w(public-only all))
|
15
|
-
.where(organization: options.fetch(:organization))
|
16
|
-
end
|
17
|
-
|
18
|
-
# Overwrites the default Searchlight run method since we want to return
|
19
|
-
# activities in an specific order but we need to set it at the end of the chain.
|
20
|
-
def run
|
21
|
-
super.order(created_at: :desc)
|
22
|
-
end
|
23
|
-
|
24
|
-
# Adds a constrain to filter by resource type(s).
|
25
|
-
def search_resource_type
|
26
|
-
if resource_types.include?(resource_type)
|
27
|
-
scope_for(resource_type)
|
28
|
-
else
|
29
|
-
all_resources_scope
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# All the resource types that are eligible to be included as an activity.
|
34
|
-
def resource_types
|
35
|
-
@resource_types ||= %w(
|
36
|
-
Decidim::Accountability::Result
|
37
|
-
Decidim::Blogs::Post
|
38
|
-
Decidim::Comments::Comment
|
39
|
-
Decidim::Consultations::Question
|
40
|
-
Decidim::Debates::Debate
|
41
|
-
Decidim::Meetings::Meeting
|
42
|
-
Decidim::Proposals::Proposal
|
43
|
-
Decidim::Surveys::Survey
|
44
|
-
Decidim::Assembly
|
45
|
-
Decidim::Consultation
|
46
|
-
Decidim::Initiative
|
47
|
-
Decidim::ParticipatoryProcess
|
48
|
-
).select do |klass|
|
49
|
-
klass.safe_constantize.present?
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
def publicable_resource_types
|
56
|
-
@publicable_resource_types ||= resource_types.select { |klass| klass.constantize.column_names.include?("published_at") }
|
57
|
-
end
|
58
|
-
|
59
|
-
def scope_for(resource_type)
|
60
|
-
action = if publicable_resource_types.include?(resource_type)
|
61
|
-
"publish"
|
62
|
-
else
|
63
|
-
"create"
|
64
|
-
end
|
65
|
-
|
66
|
-
query.where(resource_type: resource_type, action: action)
|
67
|
-
end
|
68
|
-
|
69
|
-
def all_resources_scope
|
70
|
-
query
|
71
|
-
.where(
|
72
|
-
"(action = ? AND resource_type IN (?)) OR (action = ? AND resource_type IN (?))",
|
73
|
-
"publish",
|
74
|
-
publicable_resource_types,
|
75
|
-
"create",
|
76
|
-
(resource_types - publicable_resource_types)
|
77
|
-
)
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|