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
@@ -10,6 +10,10 @@ module Decidim
|
|
10
10
|
|
11
11
|
field :name, !TranslatedFieldType, "The name of this component."
|
12
12
|
|
13
|
+
field :weight, !types.Int, "The weight of the component"
|
14
|
+
|
15
|
+
field :participatorySpace, !ParticipatorySpaceType, "The participatory space in which this component belongs to.", property: :participatory_space
|
16
|
+
|
13
17
|
resolve_type ->(obj, _ctx) { obj.manifest.query_type.constantize }
|
14
18
|
end
|
15
19
|
end
|
@@ -10,6 +10,13 @@ module Decidim
|
|
10
10
|
|
11
11
|
field :title, !TranslatedFieldType, "The name of this participatory space."
|
12
12
|
|
13
|
+
field :type, !types.String do
|
14
|
+
description "The participatory space class name. i.e. Decidim::ParticipatoryProcess"
|
15
|
+
resolve ->(participatory_space, _args, _ctx) {
|
16
|
+
participatory_space.class.name
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
13
20
|
field :components, types[ComponentInterface] do
|
14
21
|
description "Lists the components this space contains."
|
15
22
|
|
@@ -7,7 +7,7 @@ module Decidim
|
|
7
7
|
name "ScopableInterface"
|
8
8
|
description "An interface that can be used in scopable objects."
|
9
9
|
|
10
|
-
field :scope,
|
10
|
+
field :scope, Decidim::Core::ScopeApiType, "The object's scope"
|
11
11
|
end
|
12
12
|
end
|
13
13
|
end
|
data/lib/decidim/coauthorable.rb
CHANGED
@@ -29,7 +29,7 @@ module Decidim
|
|
29
29
|
# Overwrite default reload method to unset the instance variables so reloading works as expected.
|
30
30
|
def reload(options = nil)
|
31
31
|
remove_instance_variable(:@authors) if defined?(@authors)
|
32
|
-
remove_instance_variable(:@
|
32
|
+
remove_instance_variable(:@notifiable_identities) if defined?(@notifiable_identities)
|
33
33
|
super(options)
|
34
34
|
end
|
35
35
|
|
@@ -50,12 +50,14 @@ module Decidim
|
|
50
50
|
end.compact.uniq
|
51
51
|
end
|
52
52
|
|
53
|
-
# Returns the
|
53
|
+
# Returns the identities that should be notified for a coauthorable.
|
54
54
|
#
|
55
|
-
def
|
56
|
-
@
|
57
|
-
if
|
58
|
-
|
55
|
+
def notifiable_identities
|
56
|
+
@notifiable_identities ||= identities.flat_map do |identity|
|
57
|
+
if identity.is_a?(Decidim::User)
|
58
|
+
identity
|
59
|
+
elsif identity.is_a?(Decidim::UserGroup)
|
60
|
+
identity.managers
|
59
61
|
elsif respond_to?(:component)
|
60
62
|
component.participatory_space.admins
|
61
63
|
end
|
@@ -82,6 +84,13 @@ module Decidim
|
|
82
84
|
coauthorships.order(:created_at).first
|
83
85
|
end
|
84
86
|
|
87
|
+
# Checks whether the user is the creator of the given proposal
|
88
|
+
#
|
89
|
+
# author - the author to check for authorship
|
90
|
+
def created_by?(author)
|
91
|
+
author == creator_author
|
92
|
+
end
|
93
|
+
|
85
94
|
# Syntactic sugar to access first coauthor Author
|
86
95
|
def creator_author
|
87
96
|
creator.try(:author)
|
@@ -95,7 +104,7 @@ module Decidim
|
|
95
104
|
|
96
105
|
# Adds a new coauthor to the list of coauthors. The coauthorship is created with
|
97
106
|
# current object as coauthorable and `user` param as author. To set the user group
|
98
|
-
# use `extra_attributes`
|
107
|
+
# use `extra_attributes` with the `user_group` key.
|
99
108
|
#
|
100
109
|
# @param author: The new coauthor.
|
101
110
|
# @extra_attrs: Extra
|
@@ -141,6 +141,7 @@ module Decidim
|
|
141
141
|
#
|
142
142
|
# Returns nothing.
|
143
143
|
def exports(name, &block)
|
144
|
+
return unless name
|
144
145
|
@exports ||= []
|
145
146
|
@exports << [name, block]
|
146
147
|
@export_manifests = nil
|
@@ -151,8 +152,8 @@ module Decidim
|
|
151
152
|
#
|
152
153
|
# Returns an Array<Decidim::Components::ExportManifest>.
|
153
154
|
def export_manifests
|
154
|
-
@export_manifests ||= @exports.map do |(name, block)|
|
155
|
-
Decidim::Components::ExportManifest.new(name).tap do |manifest|
|
155
|
+
@export_manifests ||= Array(@exports).map do |(name, block)|
|
156
|
+
Decidim::Components::ExportManifest.new(name, self).tap do |manifest|
|
156
157
|
block.call(manifest)
|
157
158
|
end
|
158
159
|
end
|
@@ -6,15 +6,26 @@ module Decidim
|
|
6
6
|
# exportable in a component. It is used via the `ComponentManifest`.
|
7
7
|
#
|
8
8
|
class ExportManifest
|
9
|
-
|
9
|
+
include ActiveModel::Model
|
10
|
+
include Virtus.model
|
11
|
+
|
12
|
+
attr_reader :name, :component_manifest
|
13
|
+
|
14
|
+
# An setting to choose if the collection exported by this manifest should
|
15
|
+
# be included in the open data export available for all users.
|
16
|
+
attribute :include_in_open_data, Boolean, default: false
|
10
17
|
|
11
18
|
# Initializes the manifest.
|
12
19
|
#
|
13
20
|
# name - The name of the export artifact. It should be unique in the
|
14
21
|
# component.
|
15
22
|
#
|
16
|
-
|
23
|
+
# component_manifest - The parent ComponentManifest where this export
|
24
|
+
# manifest belongs to.
|
25
|
+
#
|
26
|
+
def initialize(name, component_manifest)
|
17
27
|
@name = name.to_sym
|
28
|
+
@component_manifest = component_manifest
|
18
29
|
end
|
19
30
|
|
20
31
|
# Public: Sets the collection when a block is given, or returns it if
|
@@ -2,34 +2,67 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module ContentParsers
|
5
|
-
# A parser that searches
|
5
|
+
# A parser that searches hashtags in content.
|
6
6
|
#
|
7
|
-
# A word starting with `#` will be considered as a
|
8
|
-
#
|
7
|
+
# A word starting with `#` will be considered as a hashtag if
|
8
|
+
# it only contains letters, numbers or underscores. If the `#` is
|
9
9
|
# followed with an underscore, then it is not considered.
|
10
10
|
#
|
11
11
|
# @see BaseParser Examples of how to use a content parser
|
12
12
|
class HashtagParser < BaseParser
|
13
|
+
# Class used as a container for metadata
|
14
|
+
#
|
15
|
+
# @!attribute hashtags
|
16
|
+
# @return [Array] an array of Decidim::Hashtag mentioned in content
|
13
17
|
Metadata = Struct.new(:hashtags)
|
14
18
|
|
15
|
-
#
|
16
|
-
#
|
19
|
+
# Matches a hashtag if it starts with a letter or number
|
20
|
+
# and only contains letters, numbers or underscores.
|
21
|
+
HASHTAG_REGEX = /\B#([[:alnum:]](?:[[:alnum:]]|_)*)\b/i
|
22
|
+
|
23
|
+
# Replaces hashtags name with new or existing hashtags models global ids.
|
17
24
|
#
|
18
|
-
# @return [String] the content with the hashtags replaced by
|
25
|
+
# @return [String] the content with the hashtags replaced by global ids
|
19
26
|
def rewrite
|
20
|
-
content.gsub(
|
21
|
-
|
22
|
-
Regexp.last_match[1] + hashtag.to_global_id.to_s
|
23
|
-
else
|
24
|
-
match
|
25
|
-
end
|
27
|
+
content.gsub(HASHTAG_REGEX) do |match|
|
28
|
+
hashtag(match[1..-1]).to_global_id.to_s + "/" + (extra_hashtags? ? "_" : "") + match[1..-1]
|
26
29
|
end
|
27
30
|
end
|
28
31
|
|
29
32
|
def metadata
|
30
|
-
Metadata.new(
|
31
|
-
|
32
|
-
|
33
|
+
Metadata.new(content_hashtags.map { |content_hashtag| hashtag(content_hashtag) }.uniq)
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def hashtag(name)
|
39
|
+
hashtags[name.downcase] ||= Decidim::Hashtag.create(organization: current_organization, name: name.downcase)
|
40
|
+
end
|
41
|
+
|
42
|
+
def hashtags
|
43
|
+
@hashtags ||= Hash[
|
44
|
+
existing_hashtags.map do |hashtag|
|
45
|
+
[hashtag.name, hashtag]
|
46
|
+
end
|
47
|
+
]
|
48
|
+
end
|
49
|
+
|
50
|
+
def existing_hashtags
|
51
|
+
@existing_hashtags ||= Decidim::Hashtag.where(organization: current_organization, name: content_hashtags.map(&:downcase))
|
52
|
+
end
|
53
|
+
|
54
|
+
def content_hashtags
|
55
|
+
@content_hashtags ||= content.scan(HASHTAG_REGEX).flatten.uniq
|
56
|
+
end
|
57
|
+
|
58
|
+
def current_organization
|
59
|
+
@current_organization ||= context[:current_organization]
|
60
|
+
end
|
61
|
+
|
62
|
+
def extra_hashtags?
|
63
|
+
return @extra_hashtags if defined?(@extra_hashtags)
|
64
|
+
|
65
|
+
@extra_hashtags = context[:extra_hashtags]
|
33
66
|
end
|
34
67
|
end
|
35
68
|
end
|
@@ -16,9 +16,9 @@ module Decidim
|
|
16
16
|
# @return [Array] an array of Decidim::User mentioned in content
|
17
17
|
Metadata = Struct.new(:users)
|
18
18
|
|
19
|
-
# Matches a nickname if
|
19
|
+
# Matches a nickname if it starts with a letter or number
|
20
20
|
# and only contains letters, numbers or underscores.
|
21
|
-
MENTION_REGEX =
|
21
|
+
MENTION_REGEX = /\B@([a-zA-Z0-9]\w*)\b/
|
22
22
|
|
23
23
|
# Replaces found mentions matching a nickname of an existing
|
24
24
|
# user in the current organization with a global id. Other
|
@@ -28,19 +28,35 @@ module Decidim
|
|
28
28
|
# @return [String] the content with the valid mentions replaced by a global id
|
29
29
|
def rewrite
|
30
30
|
content.gsub(MENTION_REGEX) do |match|
|
31
|
-
|
32
|
-
Regexp.last_match[1] + user.to_global_id.to_s
|
33
|
-
else
|
34
|
-
match
|
35
|
-
end
|
31
|
+
users[match[1..-1]]&.to_global_id&.to_s || match
|
36
32
|
end
|
37
33
|
end
|
38
34
|
|
39
35
|
# (see BaseParser#metadata)
|
40
36
|
def metadata
|
41
|
-
Metadata.new(
|
42
|
-
|
43
|
-
|
37
|
+
Metadata.new(existing_users)
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
|
42
|
+
def users
|
43
|
+
@users ||= Hash[
|
44
|
+
existing_users.map do |user|
|
45
|
+
[user.nickname, user]
|
46
|
+
end
|
47
|
+
]
|
48
|
+
end
|
49
|
+
|
50
|
+
def existing_users
|
51
|
+
@existing_users ||= Decidim::User.where(organization: current_organization, nickname: content_nicknames)
|
52
|
+
end
|
53
|
+
|
54
|
+
def content_nicknames
|
55
|
+
@content_nicknames ||= content.scan(MENTION_REGEX).flatten.uniq
|
56
|
+
end
|
57
|
+
|
58
|
+
def current_organization
|
59
|
+
@current_organization ||= context[:current_organization]
|
44
60
|
end
|
45
61
|
end
|
46
62
|
end
|
@@ -10,43 +10,66 @@ module Decidim
|
|
10
10
|
# @see BaseRenderer Examples of how to use a content renderer
|
11
11
|
class HashtagRenderer < BaseRenderer
|
12
12
|
# Matches a global id representing a Decidim::Hashtag
|
13
|
-
GLOBAL_ID_REGEX = %r{gid:\/\/[\w-]*\/Decidim::Hashtag\/(\d+)}
|
13
|
+
GLOBAL_ID_REGEX = %r{gid:\/\/[\w-]*\/Decidim::Hashtag\/(\d+)\/?(_?)([[:alnum:]](?:[[:alnum:]]|_)*)?\b}
|
14
14
|
|
15
15
|
# Replaces found Global IDs matching an existing hashtag with
|
16
16
|
# a link to their detail page. The Global IDs representing an
|
17
17
|
# invalid Decidim::Hashtag are replaced with an empty string.
|
18
18
|
#
|
19
|
+
# links - should render hashtags as links?
|
20
|
+
# extras - should include extra hashtags?
|
21
|
+
#
|
19
22
|
# @return [String] the content ready to display (contains HTML)
|
20
|
-
def render
|
23
|
+
def render(links: true, extras: true)
|
21
24
|
content.gsub(GLOBAL_ID_REGEX) do |hashtag_gid|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
25
|
+
id, extra, cased_name = hashtag_gid.scan(GLOBAL_ID_REGEX).flatten
|
26
|
+
hashtag = hashtags[id.to_i]
|
27
|
+
|
28
|
+
next "" if hashtag.nil? || (!extras && extra.present?)
|
29
|
+
|
30
|
+
presenter = Decidim::HashtagPresenter.new(hashtag, cased_name: cased_name)
|
31
|
+
|
32
|
+
if links
|
33
|
+
presenter.display_hashtag
|
34
|
+
else
|
35
|
+
presenter.display_hashtag_name
|
27
36
|
end
|
28
37
|
end
|
29
38
|
end
|
30
39
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
parsed_content[locale] = replace_hashtag_gid_with_hashtag_name(string)
|
35
|
-
end
|
36
|
-
else
|
37
|
-
replace_hashtag_gid_with_hashtag_name(content)
|
38
|
-
end
|
40
|
+
# Returns all the extra hashtags found in the content
|
41
|
+
def extra_hashtags
|
42
|
+
@extra_hashtags ||= existing_hashtags.select { |hashtag| content_extra_hashtags_ids.member?(hashtag.id) }
|
39
43
|
end
|
40
44
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
""
|
45
|
+
private
|
46
|
+
|
47
|
+
def hashtags
|
48
|
+
@hashtags ||= Hash[
|
49
|
+
existing_hashtags.map do |hashtag|
|
50
|
+
[hashtag.id, hashtag]
|
48
51
|
end
|
49
|
-
|
52
|
+
]
|
53
|
+
end
|
54
|
+
|
55
|
+
def existing_hashtags
|
56
|
+
@existing_hashtags ||= Decidim::Hashtag.where(id: content_hashtags_ids)
|
57
|
+
end
|
58
|
+
|
59
|
+
def content_hashtags_ids
|
60
|
+
@content_hashtags_ids ||= ids_from_matches(content_matches)
|
61
|
+
end
|
62
|
+
|
63
|
+
def content_extra_hashtags_ids
|
64
|
+
@content_extra_hashtags_ids ||= ids_from_matches(content_matches.select { |match| match[1].present? })
|
65
|
+
end
|
66
|
+
|
67
|
+
def content_matches
|
68
|
+
@content_matches ||= content.scan(GLOBAL_ID_REGEX)
|
69
|
+
end
|
70
|
+
|
71
|
+
def ids_from_matches(matches)
|
72
|
+
matches.map(&:first).map(&:to_i).uniq
|
50
73
|
end
|
51
74
|
end
|
52
75
|
end
|
data/lib/decidim/core.rb
CHANGED
@@ -52,6 +52,8 @@ module Decidim
|
|
52
52
|
autoload :ContentBlockManifest, "decidim/content_block_manifest"
|
53
53
|
autoload :MetricRegistry, "decidim/metric_registry"
|
54
54
|
autoload :MetricManifest, "decidim/metric_manifest"
|
55
|
+
autoload :MetricOperation, "decidim/metric_operation"
|
56
|
+
autoload :MetricOperationManifest, "decidim/metric_operation_manifest"
|
55
57
|
autoload :NewsletterEncryptor, "decidim/newsletter_encryptor"
|
56
58
|
autoload :Searchable, "decidim/searchable"
|
57
59
|
autoload :SearchResourceFieldsMapper, "decidim/search_resource_fields_mapper"
|
@@ -65,9 +67,13 @@ module Decidim
|
|
65
67
|
autoload :DataPortabilitySerializers, "decidim/data_portability_serializers"
|
66
68
|
autoload :DataPortabilityFileReader, "decidim/data_portability_file_reader"
|
67
69
|
autoload :DataPortabilityFileZipper, "decidim/data_portability_file_zipper"
|
70
|
+
autoload :Amendable, "decidim/amendable"
|
68
71
|
autoload :Gamification, "decidim/gamification"
|
69
72
|
autoload :Hashtag, "decidim/hashtag"
|
70
73
|
autoload :Hashtaggable, "decidim/hashtaggable"
|
74
|
+
autoload :Paddable, "decidim/paddable"
|
75
|
+
autoload :OpenDataExporter, "decidim/open_data_exporter"
|
76
|
+
|
71
77
|
include ActiveSupport::Configurable
|
72
78
|
# Loads seeds from all engines.
|
73
79
|
def self.seed!
|
@@ -82,7 +88,20 @@ module Decidim
|
|
82
88
|
railtie.load_seed
|
83
89
|
end
|
84
90
|
|
85
|
-
participatory_space_manifests.each
|
91
|
+
participatory_space_manifests.each do |manifest|
|
92
|
+
manifest.seed!
|
93
|
+
|
94
|
+
Organization.all.each do |organization|
|
95
|
+
ContextualHelpSection.set_content(
|
96
|
+
organization,
|
97
|
+
manifest.name,
|
98
|
+
Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
99
|
+
Decidim::Faker::Localized.sentence(15)
|
100
|
+
end
|
101
|
+
)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
86
105
|
Gamification.badges.each do |badge|
|
87
106
|
puts "Setting random values for the \"#{badge.name}\" badge..."
|
88
107
|
User.all.find_each do |user|
|
@@ -220,12 +239,18 @@ module Decidim
|
|
220
239
|
2.days
|
221
240
|
end
|
222
241
|
|
242
|
+
# Exposes a configuration option: an object to configure Etherpad
|
243
|
+
config_accessor :etherpad
|
244
|
+
|
223
245
|
# A base path for the uploads. If set, make sure it ends in a slash.
|
224
246
|
# Uploads will be set to `<base_path>/uploads/`. This can be useful if you
|
225
247
|
# want to use the same uploads place for both staging and production
|
226
248
|
# environments, but in different folders.
|
227
249
|
config_accessor :base_uploads_path
|
228
250
|
|
251
|
+
# Exposes a configuration option: an object to deliver SMS codes to users.
|
252
|
+
config_accessor :sms_gateway_service
|
253
|
+
|
229
254
|
# Public: Registers a global engine. This method is intended to be used
|
230
255
|
# by component engines that also offer unscoped functionality
|
231
256
|
#
|
@@ -299,6 +324,14 @@ module Decidim
|
|
299
324
|
resource_registry.register(name, &block)
|
300
325
|
end
|
301
326
|
|
327
|
+
# Public: Finds all registered resource manifests via the `register_component`
|
328
|
+
# method.
|
329
|
+
#
|
330
|
+
# Returns an Array[ResourceManifest].
|
331
|
+
def self.resource_manifests
|
332
|
+
resource_registry.manifests
|
333
|
+
end
|
334
|
+
|
302
335
|
# Public: Finds all registered component manifest's via the `register_component`
|
303
336
|
# method.
|
304
337
|
#
|
@@ -388,8 +421,13 @@ module Decidim
|
|
388
421
|
@traceability ||= Traceability.new
|
389
422
|
end
|
390
423
|
|
391
|
-
# Public: Stores an instance of
|
424
|
+
# Public: Stores an instance of MetricRegistry
|
392
425
|
def self.metrics_registry
|
393
426
|
@metrics_registry ||= MetricRegistry.new
|
394
427
|
end
|
428
|
+
|
429
|
+
# Public: Stores an instance of MetricOperation
|
430
|
+
def self.metrics_operation
|
431
|
+
@metrics_operation ||= MetricOperation.new
|
432
|
+
end
|
395
433
|
end
|