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
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require_dependency "devise/models/decidim_validatable"
|
4
|
+
require "valid_email2"
|
5
|
+
|
3
6
|
module Decidim
|
4
7
|
# A UserGroup is an organization of citizens
|
5
8
|
class UserGroup < UserBaseEntity
|
@@ -8,15 +11,22 @@ module Decidim
|
|
8
11
|
|
9
12
|
has_many :memberships, class_name: "Decidim::UserGroupMembership", foreign_key: :decidim_user_group_id, dependent: :destroy
|
10
13
|
has_many :users, through: :memberships, class_name: "Decidim::User", foreign_key: :decidim_user_id
|
14
|
+
has_many :managers,
|
15
|
+
-> { where(decidim_user_group_memberships: { role: [:creator, :admin] }) },
|
16
|
+
through: :memberships,
|
17
|
+
class_name: "Decidim::User",
|
18
|
+
foreign_key: :decidim_user_id,
|
19
|
+
source: :user
|
11
20
|
|
12
21
|
validates :name, presence: true, uniqueness: { scope: :decidim_organization_id }
|
13
|
-
validates :document_number, presence: true
|
14
|
-
validates :phone, presence: true
|
15
22
|
|
16
23
|
validate :correct_state
|
17
|
-
validate :unique_document_number
|
24
|
+
validate :unique_document_number, if: :has_document_number?
|
25
|
+
|
26
|
+
devise :confirmable, :decidim_validatable, confirmation_keys: [:decidim_organization_id, :email]
|
18
27
|
|
19
28
|
scope :verified, -> { where.not("extended_data->>'verified_at' IS ?", nil) }
|
29
|
+
scope :not_verified, -> { where("extended_data->>'verified_at' IS ?", nil) }
|
20
30
|
scope :rejected, -> { where.not("extended_data->>'rejected_at' IS ?", nil) }
|
21
31
|
scope :pending, -> { where("extended_data->>'rejected_at' IS ? AND extended_data->>'verified_at' IS ?", nil, nil) }
|
22
32
|
|
@@ -96,5 +106,21 @@ module Decidim
|
|
96
106
|
|
97
107
|
errors.add(:document_number, :taken) if is_repeated
|
98
108
|
end
|
109
|
+
|
110
|
+
def has_document_number?
|
111
|
+
document_number.present?
|
112
|
+
end
|
113
|
+
|
114
|
+
# Overwites method in `Decidim::Validatable`, as user groups don't have a
|
115
|
+
# password.
|
116
|
+
def password_required?
|
117
|
+
false
|
118
|
+
end
|
119
|
+
|
120
|
+
# Overwites method in `Decidim::Validatable`, as user groups don't have a
|
121
|
+
# password.
|
122
|
+
def password
|
123
|
+
nil
|
124
|
+
end
|
99
125
|
end
|
100
126
|
end
|
@@ -16,6 +16,7 @@ module Decidim
|
|
16
16
|
manage_self_user_action?
|
17
17
|
authorization_action?
|
18
18
|
follow_action?
|
19
|
+
amend_action?
|
19
20
|
notification_action?
|
20
21
|
conversation_action?
|
21
22
|
user_group_action?
|
@@ -77,6 +78,17 @@ module Decidim
|
|
77
78
|
toggle_allow(follow&.user == user)
|
78
79
|
end
|
79
80
|
|
81
|
+
def amend_action?
|
82
|
+
return unless permission_action.subject == :amendment
|
83
|
+
return allow! if permission_action.action == :create
|
84
|
+
return allow! if permission_action.action == :reject
|
85
|
+
return allow! if permission_action.action == :promote
|
86
|
+
return allow! if permission_action.action == :accept
|
87
|
+
|
88
|
+
amendment = context.fetch(:amendment, nil)
|
89
|
+
toggle_allow(amendment&.amender == user)
|
90
|
+
end
|
91
|
+
|
80
92
|
def notification_action?
|
81
93
|
return unless permission_action.subject == :notification
|
82
94
|
return allow! if permission_action.action == :read
|
@@ -19,6 +19,7 @@ module Decidim
|
|
19
19
|
.merge(omnipresent_banner_attributes_mapping)
|
20
20
|
.merge(highlighted_content_banner_attributes_mapping)
|
21
21
|
.merge(appearance_attributes_mapping)
|
22
|
+
.merge(id_documents_attributes_mapping)
|
22
23
|
end
|
23
24
|
|
24
25
|
def settings_attributes_mapping
|
@@ -71,13 +72,25 @@ module Decidim
|
|
71
72
|
}
|
72
73
|
end
|
73
74
|
|
75
|
+
def id_documents_attributes_mapping
|
76
|
+
{
|
77
|
+
id_documents_methods: :string,
|
78
|
+
id_documents_explanation_text: :i18n
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
74
82
|
def action_string
|
83
|
+
return "decidim.admin_log.organization.update_id_documents_config" if action == "update_id_documents_config"
|
75
84
|
"decidim.admin_log.organization.update"
|
76
85
|
end
|
77
86
|
|
78
87
|
def i18n_labels_scope
|
79
88
|
"activemodel.attributes.organization"
|
80
89
|
end
|
90
|
+
|
91
|
+
def has_diff?
|
92
|
+
action == "update_id_documents_config" || super
|
93
|
+
end
|
81
94
|
end
|
82
95
|
end
|
83
96
|
end
|
@@ -16,7 +16,7 @@ module Decidim
|
|
16
16
|
|
17
17
|
def action_string
|
18
18
|
case action
|
19
|
-
when "invite", "officialize", "remove_from_admin", "unofficialize"
|
19
|
+
when "grant_id_documents_offline_verification", "invite", "officialize", "remove_from_admin", "unofficialize"
|
20
20
|
"decidim.admin_log.user.#{action}"
|
21
21
|
else
|
22
22
|
super
|
@@ -8,11 +8,16 @@ module Decidim
|
|
8
8
|
include Rails.application.routes.mounted_helpers
|
9
9
|
include ActionView::Helpers::UrlHelper
|
10
10
|
|
11
|
+
def initialize(hashtag, cased_name: nil)
|
12
|
+
super(hashtag)
|
13
|
+
@cased_name = cased_name if cased_name&.downcase == hashtag.name
|
14
|
+
end
|
15
|
+
|
11
16
|
#
|
12
|
-
#
|
17
|
+
# hashtag presented in a twitter-like style
|
13
18
|
#
|
14
19
|
def name
|
15
|
-
"##{super}"
|
20
|
+
"##{@cased_name || super}"
|
16
21
|
end
|
17
22
|
|
18
23
|
delegate :url, to: :hashtag, prefix: true
|
@@ -3,11 +3,19 @@
|
|
3
3
|
module Decidim
|
4
4
|
# A presenter to render metrics in pages
|
5
5
|
class MetricChartsPresenter < Rectify::Presenter
|
6
|
-
attribute :organization, Decidim::Organization
|
7
|
-
|
8
6
|
# Public: Render a collection of primary metrics.
|
9
7
|
def highlighted
|
10
|
-
|
8
|
+
render_highlighted(Decidim.metrics_registry.filtered(highlight: true, scope: "home"))
|
9
|
+
end
|
10
|
+
|
11
|
+
# Public: Render a collection of metrics that are not primary.
|
12
|
+
def not_highlighted
|
13
|
+
render_not_highlighted(Decidim.metrics_registry.filtered(highlight: false, scope: "home"))
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def render_highlighted(highlighted_metrics)
|
11
19
|
safe_join(
|
12
20
|
highlighted_metrics.map do |metric|
|
13
21
|
render_metrics_data(metric.metric_name, klass: "column medium-4")
|
@@ -15,14 +23,13 @@ module Decidim
|
|
15
23
|
)
|
16
24
|
end
|
17
25
|
|
18
|
-
|
19
|
-
def not_highlighted
|
20
|
-
not_highlighted_metrics = Decidim.metrics_registry.not_highlighted
|
26
|
+
def render_not_highlighted(not_highlighted_metrics)
|
21
27
|
safe_join(
|
22
|
-
not_highlighted_metrics.in_groups_of(2
|
28
|
+
not_highlighted_metrics.in_groups_of(2).map do |metrics_group|
|
23
29
|
content_tag :div, class: "column medium-4" do
|
24
30
|
safe_join(
|
25
31
|
metrics_group.map do |metric|
|
32
|
+
next "" if metric.blank?
|
26
33
|
render_metrics_data(metric.metric_name, klass: "column medium-6", graph_klass: "small")
|
27
34
|
end
|
28
35
|
)
|
@@ -31,22 +38,48 @@ module Decidim
|
|
31
38
|
)
|
32
39
|
end
|
33
40
|
|
34
|
-
private
|
35
|
-
|
36
41
|
def render_metrics_data(metric_name, opts = {})
|
37
42
|
content_tag :div, class: opts[:klass].presence || "column medium-6" do
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
43
|
+
concat render_metric_chart(metric_name, opts)
|
44
|
+
concat render_downloader(metric_name) if opts[:download]
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def render_metrics_descriptive(metric_name, opts = {})
|
49
|
+
content_tag :div, class: opts[:klass].presence || "column medium-6" do
|
50
|
+
concat content_tag(:h3, opts[:title], class: "metric-title heading3 text-uppercase text-muted")
|
51
|
+
concat content_tag(:p, opts[:description], class: "metric-description text-medium")
|
52
|
+
concat render_metric_chart(metric_name, opts)
|
53
|
+
concat render_downloader(metric_name) if opts[:download]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def render_metric_chart(metric_name, opts = {})
|
58
|
+
data = {
|
59
|
+
chart: "areachart",
|
60
|
+
metric: metric_name,
|
61
|
+
info: {
|
62
|
+
title: I18n.t("decidim.metrics.#{metric_name}.title"),
|
63
|
+
object: I18n.t("decidim.metrics.#{metric_name}.object")
|
64
|
+
}
|
65
|
+
}
|
66
|
+
data.merge!(opts[:data] || {})
|
67
|
+
|
68
|
+
content_tag :div,
|
69
|
+
"",
|
70
|
+
id: "#{metric_name}_chart",
|
71
|
+
class: "areachart metric-chart #{opts[:graph_klass]}",
|
72
|
+
style: opts[:margin],
|
73
|
+
data: data
|
74
|
+
end
|
75
|
+
|
76
|
+
def render_downloader(metric_name)
|
77
|
+
content_tag :p, class: "pull-right mt-s" do
|
78
|
+
link_to "#", class: "metric-downloader", data: { metric: metric_name } do
|
79
|
+
content_tag :small, class: "text-small" do
|
80
|
+
content_tag :u, I18n.t("decidim.metrics.download.csv")
|
81
|
+
end
|
82
|
+
end
|
50
83
|
end
|
51
84
|
end
|
52
85
|
end
|
@@ -40,14 +40,6 @@ module Decidim
|
|
40
40
|
link_to nickname, profile_path, class: "user-mention"
|
41
41
|
end
|
42
42
|
|
43
|
-
def followers_count
|
44
|
-
__getobj__.followers.count
|
45
|
-
end
|
46
|
-
|
47
|
-
def following_count
|
48
|
-
__getobj__.following_users.count
|
49
|
-
end
|
50
|
-
|
51
43
|
def can_be_contacted?
|
52
44
|
true
|
53
45
|
end
|
@@ -60,5 +52,9 @@ module Decidim
|
|
60
52
|
def can_follow?
|
61
53
|
true
|
62
54
|
end
|
55
|
+
|
56
|
+
def has_tooltip?
|
57
|
+
true
|
58
|
+
end
|
63
59
|
end
|
64
60
|
end
|
@@ -9,9 +9,9 @@ module Decidim
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def initialize(day_string, organization)
|
12
|
-
@day = day_string.present? ? Date.parse(day_string) : Time.zone.
|
12
|
+
@day = day_string.present? ? Date.parse(day_string) : Time.zone.yesterday
|
13
13
|
raise ArgumentError, "[ERROR] Malformed `day` argument. Format must be `YYYY-MM-DD` and in the past" if @day > Time.zone.today
|
14
|
-
@day ||= Time.zone.
|
14
|
+
@day ||= Time.zone.yesterday
|
15
15
|
@organization = organization
|
16
16
|
@metric_name = metric_name
|
17
17
|
end
|
@@ -55,5 +55,19 @@ module Decidim
|
|
55
55
|
def quantity
|
56
56
|
@quantity ||= cumulative
|
57
57
|
end
|
58
|
+
|
59
|
+
# Search for all Participatory Space manifests and then all records available
|
60
|
+
# Limited to ParticipatoryProcesses only
|
61
|
+
def retrieve_participatory_spaces
|
62
|
+
Decidim.participatory_space_manifests.map do |space_manifest|
|
63
|
+
next unless space_manifest.name == :participatory_processes # Temporal limitation
|
64
|
+
space_manifest.participatory_spaces.call(@organization)
|
65
|
+
end.flatten.compact
|
66
|
+
end
|
67
|
+
|
68
|
+
# Search for all components published, within a fixed list of available
|
69
|
+
def retrieve_components(participatory_space)
|
70
|
+
participatory_space.components.published
|
71
|
+
end
|
58
72
|
end
|
59
73
|
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
# This class execute some measures related to Metrics, and return its results
|
5
|
+
#
|
6
|
+
# - day: Date object
|
7
|
+
# - resource: Object used to make measurements. Object class is dependant within each measure
|
8
|
+
class MetricMeasure
|
9
|
+
def initialize(day, resource)
|
10
|
+
@day = day.try(:to_date) || Time.zone.yesterday
|
11
|
+
raise ArgumentError, "[ERROR] Malformed `day` argument. Format must be `YYYY-MM-DD` and in the past" if @day > Time.zone.today
|
12
|
+
@day ||= Time.zone.yesterday
|
13
|
+
@resource = resource
|
14
|
+
end
|
15
|
+
|
16
|
+
def valid?
|
17
|
+
@day.present? && @resource.present?
|
18
|
+
end
|
19
|
+
|
20
|
+
# this method must be overwritten for each Measure class
|
21
|
+
def calculate
|
22
|
+
raise StandardError, "Not implemented"
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def start_time
|
28
|
+
@start_time ||= @day.beginning_of_day
|
29
|
+
end
|
30
|
+
|
31
|
+
def end_time
|
32
|
+
@end_time ||= @day.end_of_day
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Metrics
|
5
|
+
# Metric manager for Followers's registries
|
6
|
+
# Searches for unique Followers for registered MetricOperations
|
7
|
+
class FollowersMetricManage < Decidim::MetricManage
|
8
|
+
def metric_name
|
9
|
+
"followers"
|
10
|
+
end
|
11
|
+
|
12
|
+
def save
|
13
|
+
return @registry if @registry
|
14
|
+
@registry = []
|
15
|
+
query.each do |key, results|
|
16
|
+
cumulative_value = results[:cumulative_users].count
|
17
|
+
next if cumulative_value.zero?
|
18
|
+
quantity_value = results[:quantity_users].count || 0
|
19
|
+
space_type, space_id = key
|
20
|
+
record = Decidim::Metric.find_or_initialize_by(day: @day.to_s, metric_type: @metric_name,
|
21
|
+
participatory_space_type: space_type, participatory_space_id: space_id,
|
22
|
+
organization: @organization)
|
23
|
+
record.assign_attributes(cumulative: cumulative_value, quantity: quantity_value)
|
24
|
+
@registry << record
|
25
|
+
end
|
26
|
+
@registry.each(&:save!)
|
27
|
+
@registry
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
# Creates a Hashed structure with number of Followers grouped by
|
33
|
+
#
|
34
|
+
# - ParticipatorySpace (type & ID)
|
35
|
+
def query
|
36
|
+
return @query if @query
|
37
|
+
|
38
|
+
@query = retrieve_participatory_spaces.each_with_object({}) do |participatory_space, grouped_participants|
|
39
|
+
key = [participatory_space.class.name, participatory_space.id]
|
40
|
+
grouped_participants[key] = { cumulative_users: [], quantity_users: [] }
|
41
|
+
if (operation_manifest = Decidim.metrics_operation.for(:followers, participatory_space.manifest.name))
|
42
|
+
space_participants = operation_manifest.calculate(@day, participatory_space)
|
43
|
+
grouped_participants[key].merge!(space_participants || {}) do |_key, grouped_users, space_users|
|
44
|
+
grouped_users | space_users
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
components = retrieve_components(participatory_space)
|
49
|
+
components.each do |component|
|
50
|
+
operation_manifest = Decidim.metrics_operation.for(:followers, component.manifest_name)
|
51
|
+
next grouped_participants unless operation_manifest
|
52
|
+
component_participants = operation_manifest.calculate(@day, component)
|
53
|
+
grouped_participants[key].merge!(component_participants || {}) do |_key, grouped_users, component_users|
|
54
|
+
grouped_users | component_users
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
grouped_participants
|
59
|
+
end
|
60
|
+
@query
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Metrics
|
5
|
+
# Metric manager for Participant's registries
|
6
|
+
# Searches for Participants for registered MetricOperations
|
7
|
+
class ParticipantsMetricManage < Decidim::MetricManage
|
8
|
+
# This list limits the number of components involved in this Metric
|
9
|
+
AVAILABLE_COMPONENTS = %w(proposals debates surveys budgets).freeze
|
10
|
+
|
11
|
+
def metric_name
|
12
|
+
"participants"
|
13
|
+
end
|
14
|
+
|
15
|
+
def save
|
16
|
+
return @registry if @registry
|
17
|
+
@registry = []
|
18
|
+
query.each do |key, results|
|
19
|
+
cumulative_value = results[:cumulative_users].count
|
20
|
+
next if cumulative_value.zero?
|
21
|
+
quantity_value = results[:quantity_users].count || 0
|
22
|
+
space_type, space_id = key
|
23
|
+
record = Decidim::Metric.find_or_initialize_by(day: @day.to_s, metric_type: @metric_name,
|
24
|
+
participatory_space_type: space_type, participatory_space_id: space_id,
|
25
|
+
organization: @organization)
|
26
|
+
record.assign_attributes(cumulative: cumulative_value, quantity: quantity_value)
|
27
|
+
@registry << record
|
28
|
+
end
|
29
|
+
@registry.each(&:save!)
|
30
|
+
@registry
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
# Creates a Hashed structure with number of Participants grouped by
|
36
|
+
#
|
37
|
+
# - ParticipatorySpace (type & ID)
|
38
|
+
def query
|
39
|
+
return @query if @query
|
40
|
+
|
41
|
+
@query = retrieve_participatory_spaces.each_with_object({}) do |participatory_space, grouped_participants|
|
42
|
+
key = [participatory_space.class.name, participatory_space.id]
|
43
|
+
grouped_participants[key] = { cumulative_users: [], quantity_users: [] }
|
44
|
+
components = retrieve_components(participatory_space)
|
45
|
+
components.each do |component|
|
46
|
+
operation_manifest = Decidim.metrics_operation.for(:participants, component.manifest_name)
|
47
|
+
next grouped_participants unless operation_manifest
|
48
|
+
component_participants = operation_manifest.calculate(@day, component)
|
49
|
+
grouped_participants[key].merge!(component_participants || {}) do |_key, grouped_users, component_users|
|
50
|
+
grouped_users | component_users
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Special case for comments ONLY
|
55
|
+
operation_manifest = Decidim.metrics_operation.for(:participants, :comments)
|
56
|
+
next grouped_participants unless operation_manifest
|
57
|
+
comments_participants = operation_manifest.calculate(@day, participatory_space)
|
58
|
+
grouped_participants[key].merge!(comments_participants || {}) do |_key, grouped_users, comment_users|
|
59
|
+
grouped_users | comment_users
|
60
|
+
end
|
61
|
+
grouped_participants
|
62
|
+
end
|
63
|
+
@query
|
64
|
+
end
|
65
|
+
|
66
|
+
# Search for all components published, within a fixed list of available
|
67
|
+
def retrieve_components(participatory_space)
|
68
|
+
super.where(manifest_name: AVAILABLE_COMPONENTS)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|