decidim-core 0.15.2 → 0.16.0
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 +14 -1
- data/app/assets/config/decidim_core_manifest.js +14 -12
- data/app/assets/images/decidim/pattern.png +0 -0
- data/app/assets/javascripts/decidim.js.es6 +4 -0
- data/app/assets/javascripts/decidim/floating_help.js.es6 +40 -0
- data/app/assets/javascripts/decidim/input_hashtags.js.es6 +6 -4
- data/app/assets/javascripts/decidim/notifications.js.es6 +1 -1
- data/app/assets/javascripts/decidim/tooltip_keep_on_hover.js.es6 +18 -0
- data/app/assets/javascripts/decidim/vizzs/areachart.js.es6 +52 -10
- data/app/assets/javascripts/decidim/vizzs/metrics.js.es6 +68 -22
- data/app/assets/javascripts/decidim/vizzs/orgchart.js.es6 +10 -13
- data/app/assets/stylesheets/decidim/conference-diploma.css.scss +61 -0
- data/app/assets/stylesheets/decidim/layouts/_home.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_buttons.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_cards.scss +17 -1
- data/app/assets/stylesheets/decidim/modules/_conference-programme.scss +0 -4
- data/app/assets/stylesheets/decidim/modules/_filters.scss +37 -2
- data/app/assets/stylesheets/decidim/modules/_floating-helper.scss +106 -0
- data/app/assets/stylesheets/decidim/modules/_forms.scss +22 -0
- data/app/assets/stylesheets/decidim/modules/_help.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_layout.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/_margins.scss +1 -0
- data/app/assets/stylesheets/decidim/modules/_modules.scss +1 -1
- data/app/assets/stylesheets/decidim/modules/_navbar.scss +5 -1
- data/app/assets/stylesheets/decidim/modules/_order-by.scss +11 -1
- data/app/assets/stylesheets/decidim/modules/_process-header.scss +36 -38
- data/app/assets/stylesheets/decidim/modules/_process-nav.scss +61 -10
- data/app/assets/stylesheets/decidim/modules/_process-phase.scss +63 -30
- data/app/assets/stylesheets/decidim/modules/_share.scss +4 -0
- data/app/assets/stylesheets/decidim/modules/_typography.scss +17 -0
- data/app/assets/stylesheets/decidim/{modules → vizzs}/_orgchart.scss +2 -10
- data/app/cells/decidim/activities_cell.rb +6 -2
- data/app/cells/decidim/activity/show.erb +22 -19
- data/app/cells/decidim/activity_cell.rb +35 -5
- data/app/cells/decidim/amendable/amend_button_card/show.erb +9 -0
- data/app/cells/decidim/amendable/amend_button_card_cell.rb +43 -0
- data/app/cells/decidim/amendable/amenders_list/show.erb +18 -0
- data/app/cells/decidim/amendable/amenders_list_cell.rb +7 -0
- data/app/cells/decidim/amendable/announcement_cell.rb +58 -0
- data/app/cells/decidim/amendable/emendation_actions/show.erb +13 -0
- data/app/cells/decidim/amendable/emendation_actions_cell.rb +52 -0
- data/app/cells/decidim/amendable/promote_button_card/show.erb +9 -0
- data/app/cells/decidim/amendable/promote_button_card_cell.rb +47 -0
- data/app/cells/decidim/author/profile_inline.erb +23 -4
- data/app/cells/decidim/author/profile_minicard.erb +25 -0
- data/app/cells/decidim/author/show.erb +0 -1
- data/app/cells/decidim/author_cell.rb +6 -0
- data/app/cells/decidim/card_cell.rb +2 -4
- data/app/cells/decidim/card_m/top.erb +1 -1
- data/app/cells/decidim/card_m_cell.rb +3 -0
- data/app/cells/decidim/content_blocks/last_activity_cell.rb +1 -1
- data/app/cells/decidim/follow_button/show.erb +0 -1
- data/app/cells/decidim/follow_button_cell.rb +10 -0
- data/app/cells/decidim/following/show.erb +1 -1
- data/app/cells/decidim/following_cell.rb +1 -1
- data/app/cells/decidim/notifications/show.erb +1 -0
- data/app/cells/decidim/pad_iframe/show.erb +14 -0
- data/app/cells/decidim/pad_iframe_cell.rb +57 -0
- data/app/cells/decidim/profile/user_tabs.erb +8 -6
- data/app/cells/decidim/profile_cell.rb +1 -1
- data/app/cells/decidim/profile_sidebar/show.erb +58 -42
- data/app/cells/decidim/profile_sidebar_cell.rb +6 -0
- data/app/cells/decidim/search_results/show.erb +8 -0
- data/app/cells/decidim/search_results_cell.rb +38 -0
- data/app/cells/decidim/search_results_section/show.erb +24 -0
- data/app/cells/decidim/search_results_section_cell.rb +35 -0
- data/app/cells/decidim/user_activity/show.erb +15 -0
- data/app/cells/decidim/user_activity_cell.rb +17 -0
- data/app/cells/decidim/user_profile/header.erb +1 -16
- data/app/cells/decidim/user_profile/user_data.erb +16 -0
- data/app/cells/decidim/user_profile_cell.rb +4 -0
- data/app/cells/decidim/user_timeline/show.erb +15 -0
- data/app/cells/decidim/user_timeline_cell.rb +17 -0
- data/app/commands/decidim/accept_user_group_join_request.rb +1 -1
- data/app/commands/decidim/amendable/accept.rb +84 -0
- data/app/commands/decidim/amendable/create.rb +103 -0
- data/app/commands/decidim/amendable/promote.rb +79 -0
- data/app/commands/decidim/amendable/reject.rb +60 -0
- data/app/commands/decidim/amendable/withdraw.rb +46 -0
- data/app/commands/decidim/create_omniauth_registration.rb +17 -1
- data/app/commands/decidim/create_registration.rb +2 -0
- data/app/commands/decidim/demote_membership.rb +1 -1
- data/app/commands/decidim/invite_user.rb +1 -1
- data/app/commands/decidim/invite_user_to_group.rb +1 -1
- data/app/commands/decidim/join_user_group.rb +1 -7
- data/app/commands/decidim/messaging/reply_to_conversation.rb +1 -1
- data/app/commands/decidim/promote_membership.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/search.rb +65 -16
- data/app/commands/decidim/update_account.rb +1 -1
- data/app/commands/decidim/update_notifications_settings.rb +2 -1
- data/app/commands/decidim/update_user_interests.rb +35 -0
- data/app/controllers/concerns/decidim/amendments_controller.rb +104 -0
- data/app/controllers/concerns/decidim/participatory_space_context.rb +28 -6
- data/app/controllers/concerns/decidim/user_groups.rb +23 -0
- data/app/controllers/concerns/decidim/user_profile.rb +2 -4
- data/app/controllers/decidim/components/base_controller.rb +1 -0
- data/app/controllers/decidim/devise/confirmations_controller.rb +9 -0
- data/app/controllers/decidim/devise/omniauth_registrations_controller.rb +2 -1
- data/app/controllers/decidim/devise/passwords_controller.rb +6 -0
- data/app/controllers/decidim/devise/registrations_controller.rb +5 -0
- data/app/controllers/decidim/devise/sessions_controller.rb +12 -0
- data/app/controllers/decidim/group_admins_controller.rb +3 -0
- data/app/controllers/decidim/group_email_confirmations_controller.rb +32 -0
- data/app/controllers/decidim/group_invites_controller.rb +3 -0
- data/app/controllers/decidim/group_members_controller.rb +3 -0
- data/app/controllers/decidim/groups_controller.rb +3 -0
- data/app/controllers/decidim/homepage_controller.rb +10 -0
- data/app/controllers/decidim/last_activities_controller.rb +1 -1
- data/app/controllers/decidim/messaging/conversations_controller.rb +11 -2
- data/app/controllers/decidim/open_data_controller.rb +31 -0
- data/app/controllers/decidim/own_user_groups_controller.rb +3 -1
- data/app/controllers/decidim/pages_controller.rb +7 -15
- data/app/controllers/decidim/profiles_controller.rb +13 -2
- data/app/controllers/decidim/searches_controller.rb +11 -2
- data/app/controllers/decidim/user_activities_controller.rb +28 -0
- data/app/controllers/decidim/user_group_join_requests_controller.rb +3 -0
- data/app/controllers/decidim/user_interests_controller.rb +32 -0
- data/app/controllers/decidim/user_timeline_controller.rb +40 -0
- data/app/events/decidim/amendable/amendment_accepted_event.rb +23 -0
- data/app/events/decidim/amendable/amendment_base_event.rb +39 -0
- data/app/events/decidim/amendable/amendment_created_event.rb +23 -0
- data/app/events/decidim/amendable/amendment_rejected_event.rb +23 -0
- data/app/events/decidim/amendable/emendation_promoted_event.rb +23 -0
- data/app/events/decidim/welcome_notification_event.rb +58 -0
- data/app/forms/decidim/amendable/create_form.rb +54 -0
- data/app/forms/decidim/amendable/form.rb +22 -0
- data/app/forms/decidim/amendable/promote_form.rb +26 -0
- data/app/forms/decidim/amendable/reject_form.rb +14 -0
- data/app/forms/decidim/amendable/review_form.rb +35 -0
- data/app/forms/decidim/notifications_settings_form.rb +19 -6
- data/app/forms/decidim/omniauth_registration_form.rb +2 -1
- data/app/forms/decidim/user_group_form.rb +1 -2
- data/app/forms/decidim/user_interest_scope_form.rb +25 -0
- data/app/forms/decidim/user_interests_form.rb +22 -0
- data/app/helpers/decidim/amendments_helper.rb +130 -0
- data/app/helpers/decidim/application_helper.rb +19 -2
- data/app/helpers/decidim/card_helper.rb +0 -2
- data/app/helpers/decidim/cells_paginate_helper.rb +4 -0
- data/app/helpers/decidim/contextual_help_helper.rb +10 -0
- data/app/helpers/decidim/cta_button_helper.rb +3 -1
- data/app/helpers/decidim/decidim_form_helper.rb +1 -1
- data/app/helpers/decidim/layout_helper.rb +13 -0
- data/app/helpers/decidim/multi_translation_helper.rb +0 -0
- data/app/helpers/decidim/omniauth_helper.rb +9 -1
- data/app/helpers/decidim/pad_helper.rb +16 -0
- data/app/helpers/decidim/participatory_space_helpers.rb +15 -0
- data/app/helpers/decidim/searches_helper.rb +50 -6
- data/app/helpers/decidim/translations_helper.rb +3 -2
- data/app/jobs/decidim/email_notification_generator_job.rb +4 -2
- data/app/jobs/decidim/metric_job.rb +1 -1
- data/app/jobs/decidim/notification_generator_for_recipient_job.rb +2 -2
- data/app/jobs/decidim/notification_generator_job.rb +4 -2
- data/app/jobs/decidim/open_data_job.rb +16 -0
- data/app/mailers/decidim/messaging/conversation_mailer.rb +5 -2
- data/app/mailers/decidim/newsletter_mailer.rb +6 -2
- data/app/mailers/decidim/notification_mailer.rb +2 -2
- data/app/models/decidim/action_log.rb +7 -0
- data/app/models/decidim/amendment.rb +17 -0
- data/app/models/decidim/component.rb +8 -0
- data/app/models/decidim/contextual_help_section.rb +41 -0
- data/app/models/decidim/follow.rb +30 -0
- data/app/models/decidim/notification.rb +11 -1
- data/app/models/decidim/organization.rb +41 -0
- data/app/models/decidim/searchable_resource.rb +3 -0
- data/app/models/decidim/static_page.rb +11 -0
- data/app/models/decidim/static_page_topic.rb +12 -0
- data/app/models/decidim/user.rb +25 -2
- data/app/models/decidim/user_base_entity.rb +0 -6
- data/app/models/decidim/user_group.rb +29 -3
- data/app/permissions/decidim/permissions.rb +12 -0
- data/app/presenters/decidim/admin_log/organization_presenter.rb +13 -0
- data/app/presenters/decidim/admin_log/user_group_presenter.rb +1 -1
- data/app/presenters/decidim/admin_log/user_presenter.rb +1 -1
- data/app/presenters/decidim/hashtag_presenter.rb +7 -2
- data/app/presenters/decidim/metric_charts_presenter.rb +54 -21
- data/app/presenters/decidim/user_presenter.rb +4 -8
- data/app/queries/decidim/messaging/user_conversations.rb +1 -1
- data/app/queries/decidim/metric_manage.rb +16 -2
- data/app/queries/decidim/metric_measure.rb +35 -0
- data/app/queries/decidim/metrics/followers_metric_manage.rb +64 -0
- data/app/queries/decidim/metrics/participants_metric_manage.rb +72 -0
- data/app/queries/decidim/metrics/users_metric_manage.rb +1 -1
- data/app/queries/decidim/public_components.rb +32 -0
- data/app/resolvers/decidim/core/metric_resolver.rb +43 -11
- data/app/services/decidim/action_logger.rb +10 -0
- data/app/services/decidim/activity_search.rb +88 -13
- data/app/services/decidim/email_notification_generator.rb +23 -8
- data/app/services/decidim/events_manager.rb +9 -3
- data/app/services/decidim/home_activity_search.rb +80 -0
- data/app/services/decidim/log/diff_changeset_calculator.rb +3 -1
- data/app/services/decidim/notification_generator.rb +19 -7
- data/app/services/decidim/notification_generator_for_recipient.rb +6 -9
- data/app/services/decidim/open_data_exporter.rb +55 -0
- data/app/uploaders/decidim/open_data_uploader.rb +17 -0
- data/app/views/decidim/amendments/_form.html.erb +30 -0
- data/app/views/decidim/amendments/_review_form.html.erb +19 -0
- data/app/views/decidim/amendments/new.html.erb +29 -0
- data/app/views/decidim/amendments/review.html.erb +33 -0
- data/app/views/decidim/devise/registrations/new.html.erb +2 -2
- data/app/views/decidim/devise/sessions/new.html.erb +42 -29
- data/app/views/decidim/devise/shared/_links.html.erb +3 -3
- data/app/views/decidim/devise/shared/_omniauth_buttons.html.erb +7 -5
- data/app/views/decidim/follows/update_button.js.erb +1 -1
- data/app/views/decidim/group_members/index.html.erb +1 -1
- data/app/views/decidim/groups/_form.html.erb +9 -8
- data/app/views/decidim/groups/new.html.erb +3 -0
- data/app/views/decidim/{pages/home.html.erb → homepage/show.html.erb} +0 -0
- data/app/views/decidim/messaging/conversation_mailer/new_conversation.html.erb +6 -0
- data/app/views/decidim/messaging/conversation_mailer/new_message.html.erb +6 -0
- data/app/views/decidim/messaging/conversations/_message.html.erb +14 -0
- data/app/views/decidim/messaging/conversations/_reply.html.erb +11 -0
- data/app/views/decidim/messaging/conversations/_show.html.erb +21 -0
- data/app/views/decidim/messaging/conversations/_start.html.erb +12 -0
- data/app/views/decidim/messaging/conversations/create.js.erb +1 -1
- data/app/views/decidim/messaging/conversations/index.html.erb +51 -1
- data/app/views/decidim/messaging/conversations/new.html.erb +5 -1
- data/app/views/decidim/messaging/conversations/show.html.erb +9 -1
- data/app/views/decidim/messaging/conversations/update.js.erb +1 -1
- data/app/views/decidim/notification_mailer/event_received.html.erb +13 -3
- data/app/views/decidim/notifications/index.html.erb +5 -1
- data/app/views/decidim/notifications_settings/show.html.erb +19 -0
- data/app/views/decidim/pages/_standalone.html.erb +21 -0
- data/app/views/decidim/pages/_tabbed.html.erb +45 -0
- data/app/views/decidim/pages/index.html.erb +68 -29
- data/app/views/decidim/pages/show.html.erb +28 -0
- data/app/views/decidim/profiles/show.html.erb +1 -1
- data/app/views/decidim/searches/_count.html.erb +26 -1
- data/app/views/decidim/searches/_filters.html.erb +40 -17
- data/app/views/decidim/searches/index.html.erb +5 -16
- data/app/views/decidim/searches/index.js.erb +5 -3
- data/app/views/decidim/shared/_extended_navigation_bar.html.erb +50 -0
- data/app/views/decidim/shared/_floating_help.html.erb +30 -0
- data/app/views/decidim/shared/_follow_button.html.erb +1 -1
- data/app/views/decidim/shared/_login_modal.html.erb +35 -22
- data/app/views/decidim/shared/_results_per_page.html.erb +1 -1
- data/app/views/decidim/shared/_share_modal.html.erb +1 -1
- data/app/views/decidim/user_activities/index.html.erb +5 -0
- data/app/views/decidim/user_interests/_areas.html.erb +14 -0
- data/app/views/decidim/user_interests/_scopes.html.erb +15 -0
- data/app/views/decidim/user_interests/show.html.erb +12 -0
- data/app/views/decidim/user_timeline/index.html.erb +4 -0
- data/app/views/layouts/decidim/_user_menu.html.erb +1 -1
- data/app/views/layouts/decidim/_wrapper.html.erb +12 -5
- data/config/locales/ca.yml +199 -13
- data/config/locales/de.yml +200 -13
- data/config/locales/en.yml +200 -13
- data/config/locales/es-PY.yml +200 -13
- data/config/locales/es.yml +200 -13
- data/config/locales/eu.yml +200 -13
- data/config/locales/fi-pl.yml +200 -13
- data/config/locales/fi.yml +200 -13
- data/config/locales/fr.yml +200 -13
- data/config/locales/gl.yml +200 -13
- data/config/locales/hu.yml +200 -13
- data/config/locales/id-ID.yml +198 -13
- data/config/locales/it.yml +200 -13
- data/config/locales/nl.yml +200 -13
- data/config/locales/pl.yml +204 -13
- data/config/locales/pt-BR.yml +200 -13
- data/config/locales/pt.yml +200 -13
- data/config/locales/ru.yml +2 -16
- data/config/locales/sv.yml +200 -13
- data/config/locales/tr-TR.yml +200 -13
- data/config/locales/uk.yml +2 -16
- data/config/routes.rb +27 -1
- data/db/migrate/20171212103803_create_unique_nicknames.rb +1 -1
- data/db/migrate/20180221101934_fix_nickname_index.rb +1 -1
- data/db/migrate/20180706104107_add_nickname_to_managed_users.rb +1 -1
- data/db/migrate/20180720114847_create_decidim_amendments.rb +21 -0
- data/db/migrate/20181001124950_move_users_groups_to_users_table.rb +1 -1
- data/db/migrate/20181022090732_add_columns_to_pages.rb +20 -0
- data/db/migrate/20181023104416_add_static_page_topics.rb +15 -0
- data/db/migrate/20181025082245_add_timestamps_to_components.rb +12 -0
- data/db/migrate/20181029121244_add_welcome_notification.rb +13 -0
- data/db/migrate/20181108131058_add_users_registration_mode_to_organizations.rb +7 -0
- data/db/migrate/20181113101935_create_decidim_contextual_help_sections.rb +11 -0
- data/db/migrate/20181115102958_add_following_and_followers_counters_to_users.rb +26 -0
- data/db/migrate/20181119140636_add_columns_to_static_page_topic.rb +10 -0
- data/db/migrate/20181126145142_add_id_documents_fields_to_org.rb +13 -0
- data/db/migrate/20181204110723_remove_following_users_count_from_users.rb +17 -0
- data/db/migrate/20181211080834_add_scope_to_action_logs.rb +7 -0
- data/db/migrate/20181211090933_add_area_to_action_logs.rb +7 -0
- data/db/migrate/20181214101250_add_notification_types_to_users.rb +12 -0
- data/db/migrate/20181218171503_add_user_groups_switch_to_organizations.rb +8 -0
- data/db/seeds.rb +6 -1
- data/lib/decidim/amendable.rb +86 -0
- data/lib/decidim/api/component_interface.rb +4 -0
- data/lib/decidim/api/participatory_space_interface.rb +7 -0
- data/lib/decidim/api/scopable_interface.rb +1 -1
- data/lib/decidim/coauthorable.rb +16 -7
- data/lib/decidim/component_manifest.rb +3 -2
- data/lib/decidim/components/export_manifest.rb +13 -2
- data/lib/decidim/content_parsers/hashtag_parser.rb +48 -15
- data/lib/decidim/content_parsers/user_parser.rb +26 -10
- data/lib/decidim/content_renderers/hashtag_renderer.rb +46 -23
- data/lib/decidim/core.rb +40 -2
- data/lib/decidim/core/engine.rb +46 -12
- data/lib/decidim/core/test.rb +11 -0
- data/lib/decidim/core/test/factories.rb +44 -15
- data/lib/decidim/core/test/shared_examples/amendable/accept_amendment_examples.rb +57 -0
- data/lib/decidim/core/test/shared_examples/amendable/amendment_accepted_event_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/amendable/amendment_created_event_examples.rb +48 -0
- data/lib/decidim/core/test/shared_examples/amendable/amendment_form_examples.rb +45 -0
- data/lib/decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/amendable/create_amendment_examples.rb +78 -0
- data/lib/decidim/core/test/shared_examples/amendable/promote_amendment_examples.rb +43 -0
- data/lib/decidim/core/test/shared_examples/amendable/reject_amendment_examples.rb +41 -0
- data/lib/decidim/core/test/shared_examples/amendable/withdraw_amendment_examples.rb +29 -0
- data/lib/decidim/core/test/shared_examples/has_contextual_help.rb +30 -0
- data/lib/decidim/core/test/shared_examples/resourceable.rb +17 -0
- data/lib/decidim/core/test/shared_examples/searchable_results_examples.rb +1 -1
- data/lib/decidim/core/test/shared_examples/simple_event.rb +24 -2
- data/lib/decidim/core/version.rb +1 -1
- data/lib/decidim/events/base_event.rb +17 -12
- data/lib/decidim/events/simple_event.rb +21 -2
- data/lib/decidim/form_builder.rb +8 -0
- data/lib/decidim/gamification/badge_scorer.rb +3 -3
- data/lib/decidim/has_component.rb +1 -1
- data/lib/decidim/hashtag.rb +0 -2
- data/lib/decidim/hashtaggable.rb +2 -2
- data/lib/decidim/metric_manifest.rb +17 -2
- data/lib/decidim/metric_operation.rb +59 -0
- data/lib/decidim/metric_operation_manifest.rb +20 -0
- data/lib/decidim/metric_registry.rb +57 -19
- data/lib/decidim/paddable.rb +82 -0
- data/lib/decidim/participable.rb +24 -0
- data/lib/decidim/participatory_space_resourceable.rb +12 -0
- data/lib/decidim/query_extensions.rb +8 -1
- data/lib/decidim/resource_manifest.rb +5 -1
- data/lib/decidim/resourceable.rb +12 -0
- data/lib/decidim/searchable.rb +13 -4
- data/lib/decidim/settings_manifest.rb +2 -1
- data/lib/tasks/decidim_data_portability_tasks.rake +86 -0
- data/lib/tasks/decidim_open_data_tasks.rake +12 -0
- data/lib/tasks/decidim_tasks.rake +1 -83
- data/vendor/assets/javascripts/tribute.js +307 -145
- metadata +156 -22
- data/app/cells/decidim/conversation/show.erb +0 -18
- data/app/cells/decidim/conversation_cell.rb +0 -23
- data/app/cells/decidim/conversation_header/show.erb +0 -17
- data/app/cells/decidim/conversation_header_cell.rb +0 -16
- data/app/cells/decidim/conversations/show.erb +0 -45
- data/app/cells/decidim/conversations_cell.rb +0 -24
- data/app/cells/decidim/message/show.erb +0 -15
- data/app/cells/decidim/message_cell.rb +0 -23
- data/app/cells/decidim/new_conversation/show.erb +0 -19
- data/app/cells/decidim/new_conversation_cell.rb +0 -19
- data/app/views/decidim/pages/decidim_page.html.erb +0 -31
- data/app/views/decidim/searches/_results.html.erb +0 -5
- data/app/views/decidim/shared/_author_reference.html.erb +0 -1
data/lib/decidim/core/engine.rb
CHANGED
@@ -38,6 +38,7 @@ require "doorkeeper-i18n"
|
|
38
38
|
require "nobspw"
|
39
39
|
require "kaminari"
|
40
40
|
require "batch-loader"
|
41
|
+
require "etherpad-lite"
|
41
42
|
|
42
43
|
require "decidim/api"
|
43
44
|
|
@@ -55,7 +56,7 @@ module Decidim
|
|
55
56
|
end
|
56
57
|
|
57
58
|
initializer "decidim.middleware" do |app|
|
58
|
-
app.config.middleware.
|
59
|
+
app.config.middleware.insert_before Warden::Manager, Decidim::CurrentOrganization
|
59
60
|
app.config.middleware.use BatchLoader::Middleware
|
60
61
|
end
|
61
62
|
|
@@ -135,7 +136,7 @@ module Decidim
|
|
135
136
|
position: 1,
|
136
137
|
active: :exclusive
|
137
138
|
|
138
|
-
menu.item I18n.t("menu.
|
139
|
+
menu.item I18n.t("menu.help", scope: "decidim"),
|
139
140
|
decidim.pages_path,
|
140
141
|
position: 7,
|
141
142
|
active: :inclusive
|
@@ -159,15 +160,19 @@ module Decidim
|
|
159
160
|
position: 1.2
|
160
161
|
end
|
161
162
|
|
162
|
-
if user_groups.any?
|
163
|
+
if current_organization.user_groups_enabled? && user_groups.any?
|
163
164
|
menu.item t("user_groups", scope: "layouts.decidim.user_profile"),
|
164
165
|
decidim.own_user_groups_path,
|
165
166
|
position: 1.3
|
166
167
|
end
|
167
168
|
|
169
|
+
menu.item t("my_interests", scope: "layouts.decidim.user_profile"),
|
170
|
+
decidim.user_interests_path,
|
171
|
+
position: 1.4
|
172
|
+
|
168
173
|
menu.item t("my_data", scope: "layouts.decidim.user_profile"),
|
169
174
|
decidim.data_portability_path,
|
170
|
-
position: 1.
|
175
|
+
position: 1.5
|
171
176
|
|
172
177
|
menu.item t("delete_my_account", scope: "layouts.decidim.user_profile"),
|
173
178
|
decidim.delete_account_path,
|
@@ -182,14 +187,16 @@ module Decidim
|
|
182
187
|
event_name,
|
183
188
|
data[:event_class],
|
184
189
|
data[:resource],
|
185
|
-
data[:
|
190
|
+
data[:followers],
|
191
|
+
data[:affected_users],
|
186
192
|
data[:extra]
|
187
193
|
)
|
188
194
|
NotificationGeneratorJob.perform_later(
|
189
195
|
event_name,
|
190
196
|
data[:event_class],
|
191
197
|
data[:resource],
|
192
|
-
data[:
|
198
|
+
data[:followers],
|
199
|
+
data[:affected_users],
|
193
200
|
data[:extra]
|
194
201
|
)
|
195
202
|
end
|
@@ -207,6 +214,7 @@ module Decidim
|
|
207
214
|
|
208
215
|
initializer "add_cells_view_paths" do
|
209
216
|
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Core::Engine.root}/app/cells")
|
217
|
+
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Core::Engine.root}/app/cells/amendable")
|
210
218
|
Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Core::Engine.root}/app/views") # for partials
|
211
219
|
end
|
212
220
|
|
@@ -270,6 +278,7 @@ module Decidim
|
|
270
278
|
Decidim.register_resource(:user) do |resource|
|
271
279
|
resource.model_class_name = "Decidim::User"
|
272
280
|
resource.card = "decidim/user_profile"
|
281
|
+
resource.searchable = true
|
273
282
|
end
|
274
283
|
|
275
284
|
Decidim.register_resource(:user_group) do |resource|
|
@@ -279,12 +288,37 @@ module Decidim
|
|
279
288
|
end
|
280
289
|
|
281
290
|
initializer "decidim.core.register_metrics" do
|
282
|
-
Decidim.metrics_registry.register(
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
291
|
+
Decidim.metrics_registry.register(:users) do |metric_registry|
|
292
|
+
metric_registry.manager_class = "Decidim::Metrics::UsersMetricManage"
|
293
|
+
|
294
|
+
metric_registry.settings do |settings|
|
295
|
+
settings.attribute :highlighted, type: :boolean, default: true
|
296
|
+
settings.attribute :scopes, type: :array, default: %w(home)
|
297
|
+
settings.attribute :weight, type: :integer, default: 1
|
298
|
+
end
|
299
|
+
end
|
300
|
+
|
301
|
+
Decidim.metrics_registry.register(:participants) do |metric_registry|
|
302
|
+
metric_registry.manager_class = "Decidim::Metrics::ParticipantsMetricManage"
|
303
|
+
|
304
|
+
metric_registry.settings do |settings|
|
305
|
+
settings.attribute :highlighted, type: :boolean, default: true
|
306
|
+
settings.attribute :scopes, type: :array, default: %w(participatory_process)
|
307
|
+
settings.attribute :weight, type: :integer, default: 1
|
308
|
+
settings.attribute :stat_block, type: :string, default: "big"
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
Decidim.metrics_registry.register(:followers) do |metric_registry|
|
313
|
+
metric_registry.manager_class = "Decidim::Metrics::FollowersMetricManage"
|
314
|
+
|
315
|
+
metric_registry.settings do |settings|
|
316
|
+
settings.attribute :highlighted, type: :boolean, default: false
|
317
|
+
settings.attribute :scopes, type: :array, default: %w(participatory_process)
|
318
|
+
settings.attribute :weight, type: :integer, default: 10
|
319
|
+
settings.attribute :stat_block, type: :string, default: "medium"
|
320
|
+
end
|
321
|
+
end
|
288
322
|
end
|
289
323
|
|
290
324
|
initializer "decidim.core.content_blocks" do
|
data/lib/decidim/core/test.rb
CHANGED
@@ -27,3 +27,14 @@ require "decidim/core/test/shared_examples/searchable_results_examples"
|
|
27
27
|
require "decidim/core/test/shared_examples/has_space_in_mcell_examples"
|
28
28
|
require "decidim/core/test/shared_examples/railtie_examples"
|
29
29
|
require "decidim/core/test/shared_examples/edit_link_shared_examples"
|
30
|
+
require "decidim/core/test/shared_examples/amendable/create_amendment_examples"
|
31
|
+
require "decidim/core/test/shared_examples/amendable/withdraw_amendment_examples"
|
32
|
+
require "decidim/core/test/shared_examples/amendable/reject_amendment_examples"
|
33
|
+
require "decidim/core/test/shared_examples/amendable/promote_amendment_examples"
|
34
|
+
require "decidim/core/test/shared_examples/amendable/amendment_form_examples"
|
35
|
+
require "decidim/core/test/shared_examples/amendable/accept_amendment_examples"
|
36
|
+
require "decidim/core/test/shared_examples/resourceable"
|
37
|
+
require "decidim/core/test/shared_examples/amendable/amendment_created_event_examples"
|
38
|
+
require "decidim/core/test/shared_examples/amendable/amendment_accepted_event_examples"
|
39
|
+
require "decidim/core/test/shared_examples/amendable/amendment_rejected_event_examples"
|
40
|
+
require "decidim/core/test/shared_examples/amendable/amendment_promoted_event_examples"
|
@@ -78,19 +78,19 @@ FactoryBot.define do
|
|
78
78
|
favicon { Decidim::Dev.test_file("icon.png", "image/png") }
|
79
79
|
default_locale { Decidim.default_locale }
|
80
80
|
available_locales { Decidim.available_locales }
|
81
|
+
users_registration_mode { :enabled }
|
81
82
|
official_img_header { Decidim::Dev.test_file("avatar.jpg", "image/jpeg") }
|
82
83
|
official_img_footer { Decidim::Dev.test_file("avatar.jpg", "image/jpeg") }
|
83
84
|
official_url { Faker::Internet.url }
|
84
85
|
highlighted_content_banner_enabled { false }
|
85
86
|
enable_omnipresent_banner { false }
|
86
|
-
tos_version { Time.current }
|
87
87
|
badges_enabled { true }
|
88
|
+
user_groups_enabled { true }
|
89
|
+
send_welcome_notification { true }
|
88
90
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
create(:static_page, :tos, organization: organization) if tos_page.nil?
|
93
|
-
end
|
91
|
+
after(:create) do |organization|
|
92
|
+
tos_page = Decidim::StaticPage.find_by(slug: "terms-and-conditions", organization: organization)
|
93
|
+
create(:static_page, :tos, organization: organization) if tos_page.nil?
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -107,13 +107,8 @@ FactoryBot.define do
|
|
107
107
|
personal_url { Faker::Internet.url }
|
108
108
|
about { Faker::Lorem.paragraph(2) }
|
109
109
|
confirmation_sent_at { Time.current }
|
110
|
-
|
111
|
-
|
112
|
-
tos_page = Decidim::StaticPage.find_by(slug: "terms-and-conditions", organization: user.organization)
|
113
|
-
create(:static_page, :tos, organization: user.organization) if tos_page.nil?
|
114
|
-
user.accepted_tos_version = user.organization.tos_version
|
115
|
-
user.save
|
116
|
-
end
|
110
|
+
accepted_tos_version { organization.tos_version }
|
111
|
+
email_on_notification { true }
|
117
112
|
|
118
113
|
trait :confirmed do
|
119
114
|
confirmed_at { Time.current }
|
@@ -181,6 +176,10 @@ FactoryBot.define do
|
|
181
176
|
rejected_at { Time.current }
|
182
177
|
end
|
183
178
|
|
179
|
+
trait :confirmed do
|
180
|
+
confirmed_at { Time.current }
|
181
|
+
end
|
182
|
+
|
184
183
|
after(:build) do |user_group, evaluator|
|
185
184
|
user_group.extended_data = {
|
186
185
|
document_number: evaluator.document_number,
|
@@ -235,17 +234,35 @@ FactoryBot.define do
|
|
235
234
|
slug { generate(:slug) }
|
236
235
|
title { generate_localized_title }
|
237
236
|
content { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
238
|
-
organization
|
237
|
+
organization { build(:organization) }
|
239
238
|
|
240
239
|
trait :default do
|
241
|
-
slug { Decidim::StaticPage::DEFAULT_PAGES.sample }
|
240
|
+
slug { (Decidim::StaticPage::DEFAULT_PAGES - ["terms-and-conditions"]).sample }
|
242
241
|
end
|
243
242
|
|
244
243
|
trait :tos do
|
245
244
|
slug { "terms-and-conditions" }
|
245
|
+
after(:create) do |tos_page|
|
246
|
+
tos_page.organization.tos_version = tos_page.updated_at
|
247
|
+
tos_page.organization.save!
|
248
|
+
end
|
249
|
+
end
|
250
|
+
|
251
|
+
trait :with_topic do
|
252
|
+
after(:create) do |static_page|
|
253
|
+
topic = create(:static_page_topic, organization: static_page.organization)
|
254
|
+
static_page.topic = topic
|
255
|
+
static_page.save
|
256
|
+
end
|
246
257
|
end
|
247
258
|
end
|
248
259
|
|
260
|
+
factory :static_page_topic, class: "Decidim::StaticPageTopic" do
|
261
|
+
title { generate_localized_title }
|
262
|
+
description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
|
263
|
+
organization
|
264
|
+
end
|
265
|
+
|
249
266
|
factory :attachment_collection, class: "Decidim::AttachmentCollection" do
|
250
267
|
name { generate_localized_title }
|
251
268
|
description { generate_localized_title }
|
@@ -495,4 +512,16 @@ FactoryBot.define do
|
|
495
512
|
participatory_space { create :participatory_process, organization: organization }
|
496
513
|
related_object { create :component, participatory_space: participatory_space }
|
497
514
|
end
|
515
|
+
|
516
|
+
factory :amendment, class: "Decidim::Amendment" do
|
517
|
+
amender do
|
518
|
+
build(
|
519
|
+
:user,
|
520
|
+
organization: amendable.try(:organization) || build(:organization)
|
521
|
+
)
|
522
|
+
end
|
523
|
+
state { "evaluating" }
|
524
|
+
amendable { build(:dummy_resource) }
|
525
|
+
emendation { build(:dummy_resource) }
|
526
|
+
end
|
498
527
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples "accept amendment" do
|
4
|
+
context "when the form is valid" do
|
5
|
+
it "broadcasts ok" do
|
6
|
+
expect { command.call }.to broadcast(:ok)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "changes the emendation state to accepted" do
|
10
|
+
expect { command.call && emendation.reload }.to change(emendation, :state)
|
11
|
+
.from("evaluating").to("accepted")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "adds the emendation author as coauthor of the proposal" do
|
15
|
+
expect { command.call }.to change { amendable.coauthorships.count }
|
16
|
+
.from(1).to(2)
|
17
|
+
.and change { amendable.authored_by?(emendation.creator_author) }
|
18
|
+
.from(false).to(true)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "traces the action", versioning: true do
|
22
|
+
expect(Decidim.traceability)
|
23
|
+
.to receive(:update!)
|
24
|
+
.with(
|
25
|
+
amendment,
|
26
|
+
amendable.creator_author,
|
27
|
+
{ state: "accepted" },
|
28
|
+
visibility: "public-only"
|
29
|
+
).and_call_original
|
30
|
+
|
31
|
+
expect(Decidim.traceability)
|
32
|
+
.to receive(:update!)
|
33
|
+
.with(
|
34
|
+
amendable,
|
35
|
+
emendation.creator_author,
|
36
|
+
{ body: emendation.body, title: emendation.title },
|
37
|
+
visibility: "public-only"
|
38
|
+
).and_call_original
|
39
|
+
|
40
|
+
expect { command.call }.to change(Decidim::ActionLog, :count).by(2)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "notifies the change" do
|
44
|
+
expect(Decidim::EventsManager)
|
45
|
+
.to receive(:publish)
|
46
|
+
.with(
|
47
|
+
event: "decidim.events.amendments.amendment_accepted",
|
48
|
+
event_class: Decidim::Amendable::AmendmentAcceptedEvent,
|
49
|
+
resource: emendation,
|
50
|
+
followers: kind_of(Array),
|
51
|
+
affected_users: kind_of(Array)
|
52
|
+
)
|
53
|
+
|
54
|
+
command.call
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples "amendment accepted event" do
|
4
|
+
include_context "when a simple event"
|
5
|
+
|
6
|
+
let(:resource) { emendation }
|
7
|
+
let(:event_name) { "decidim.events.amendments.amendment_accepted" }
|
8
|
+
|
9
|
+
it_behaves_like "a simple event"
|
10
|
+
|
11
|
+
let(:amendable_title) { amendable.title }
|
12
|
+
let(:emendation_author_nickname) { "@#{emendation.creator_author.nickname}" }
|
13
|
+
let(:emendation_path) { Decidim::ResourceLocatorPresenter.new(emendation).path }
|
14
|
+
let(:emendation_author_path) { Decidim::UserPresenter.new(emendation.creator_author).profile_path }
|
15
|
+
let(:amendable_path) { Decidim::ResourceLocatorPresenter.new(amendable).path }
|
16
|
+
|
17
|
+
describe "email_subject" do
|
18
|
+
it "is generated correctly" do
|
19
|
+
expect(subject.email_subject).to eq("An amendment accepted for #{amendable_title} from #{emendation_author_nickname}")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "email_intro" do
|
24
|
+
it "is generated correctly" do
|
25
|
+
expect(subject.email_intro)
|
26
|
+
.to eq("An emendation has been accepted for #{amendable_title}. You can see it from this page:")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "email_outro" do
|
31
|
+
it "is generated correctly" do
|
32
|
+
expect(subject.email_outro)
|
33
|
+
.to eq("You have received this notification because you are following #{amendable_title}. You can stop receiving notifications following the previous link.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "notification_title" do
|
38
|
+
it "is generated correctly" do
|
39
|
+
expect(subject.notification_title)
|
40
|
+
.to include("The <a href=\"#{emendation_path}\">emendation</a> created by <a href=\"#{emendation_author_path}\">#{emendation_author_nickname}</a> has been accepted for <a href=\"#{amendable_path}\">#{amendable_title}</a> #{amendable_type}.") # rubocop:disable Metrics/LineLength
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples "amendment created event" do
|
4
|
+
include_context "when a simple event"
|
5
|
+
|
6
|
+
let(:resource) { amendable }
|
7
|
+
let(:event_name) { "decidim.events.amendments.amendment_created" }
|
8
|
+
let!(:extra) do
|
9
|
+
{
|
10
|
+
amendment_id: amendment.id
|
11
|
+
}
|
12
|
+
end
|
13
|
+
|
14
|
+
it_behaves_like "a simple event"
|
15
|
+
|
16
|
+
let(:amendable_title) { amendable.title }
|
17
|
+
let(:emendation_author_nickname) { "@#{emendation.creator_author.nickname}" }
|
18
|
+
let(:emendation_path) { Decidim::ResourceLocatorPresenter.new(emendation).path }
|
19
|
+
let(:emendation_author_path) { Decidim::UserPresenter.new(emendation.creator_author).profile_path }
|
20
|
+
let(:amendable_path) { Decidim::ResourceLocatorPresenter.new(amendable).path }
|
21
|
+
|
22
|
+
describe "email_subject" do
|
23
|
+
it "is generated correctly" do
|
24
|
+
expect(subject.email_subject).to eq("A new amendment for #{amendable_title} from #{emendation_author_nickname}")
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "email_intro" do
|
29
|
+
it "is generated correctly" do
|
30
|
+
expect(subject.email_intro)
|
31
|
+
.to eq("A new emendation has been created for #{amendable_title}. You can see it from this page:")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "email_outro" do
|
36
|
+
it "is generated correctly" do
|
37
|
+
expect(subject.email_outro)
|
38
|
+
.to eq("You have received this notification because you are following #{amendable_title}. You can stop receiving notifications following the previous link.")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "notification_title" do
|
43
|
+
it "is generated correctly" do
|
44
|
+
expect(subject.notification_title)
|
45
|
+
.to include("A <a href=\"#{emendation_path}\">new emendation</a> has been created by <a href=\"#{emendation_author_path}\">#{emendation_author_nickname}</a> for <a href=\"#{amendable_path}\">#{amendable_title}</a> #{amendable_type}.") # rubocop:disable Metrics/LineLength
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples "an amendment form" do
|
4
|
+
let(:title) { "More sidewalks and less roads!" }
|
5
|
+
let(:body) { "Everything would be better" }
|
6
|
+
let(:emendation_fields) do
|
7
|
+
{
|
8
|
+
title: title,
|
9
|
+
body: body
|
10
|
+
}
|
11
|
+
end
|
12
|
+
|
13
|
+
context "when everything is OK" do
|
14
|
+
it { is_expected.to be_valid }
|
15
|
+
end
|
16
|
+
|
17
|
+
context "when there's no title" do
|
18
|
+
let(:title) { nil }
|
19
|
+
|
20
|
+
it { is_expected.to be_invalid }
|
21
|
+
|
22
|
+
it "only adds errors to this field" do
|
23
|
+
subject.valid?
|
24
|
+
expect(subject.errors.keys).to eq [:title]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "when the title is too long" do
|
29
|
+
let(:body) { "A" * 200 }
|
30
|
+
|
31
|
+
it { is_expected.to be_invalid }
|
32
|
+
end
|
33
|
+
|
34
|
+
context "when the body is not etiquette-compliant" do
|
35
|
+
let(:body) { "A" }
|
36
|
+
|
37
|
+
it { is_expected.to be_invalid }
|
38
|
+
end
|
39
|
+
|
40
|
+
context "when there's no body" do
|
41
|
+
let(:body) { nil }
|
42
|
+
|
43
|
+
it { is_expected.to be_invalid }
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_examples "amendment promoted event" do
|
4
|
+
include_context "when a simple event"
|
5
|
+
|
6
|
+
let(:resource) { emendation }
|
7
|
+
let(:event_name) { "decidim.events.amendments.amendment_promoted" }
|
8
|
+
|
9
|
+
it_behaves_like "a simple event"
|
10
|
+
|
11
|
+
let(:amendable_title) { amendable.title }
|
12
|
+
let(:emendation_author_nickname) { "@#{emendation.creator_author.nickname}" }
|
13
|
+
let(:emendation_path) { Decidim::ResourceLocatorPresenter.new(emendation).path }
|
14
|
+
let(:emendation_author_path) { Decidim::UserPresenter.new(emendation.creator_author).profile_path }
|
15
|
+
let(:amendable_path) { Decidim::ResourceLocatorPresenter.new(amendable).path }
|
16
|
+
|
17
|
+
describe "email_subject" do
|
18
|
+
it "is generated correctly" do
|
19
|
+
expect(subject.email_subject).to eq("An emendation from #{emendation_author_nickname} has been promoted")
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "email_intro" do
|
24
|
+
it "is generated correctly" do
|
25
|
+
expect(subject.email_intro)
|
26
|
+
.to eq("An emendation rejected for #{amendable_title} has been promoted to an independent #{amendable_type}. You can see it from this page:")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "email_outro" do
|
31
|
+
it "is generated correctly" do
|
32
|
+
expect(subject.email_outro)
|
33
|
+
.to eq("You have received this notification because you are following #{amendable_title}. You can stop receiving notifications following the previous link.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "notification_title" do
|
38
|
+
it "is generated correctly" do
|
39
|
+
expect(subject.notification_title)
|
40
|
+
.to include("A <a href=\"#{emendation_path}\">rejected emendation</a> for <a href=\"#{amendable_path}\">#{amendable_title}</a> #{amendable_type} has been promoted by <a href=\"#{emendation_author_path}\">#{emendation_author_nickname}</a>.") # rubocop:disable Metrics/LineLength
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|