decidim-participatory_processes 0.27.10 → 0.28.0.rc4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/cells/decidim/participatory_process_groups/content_block_cell.rb +5 -1
- data/app/cells/decidim/participatory_process_groups/content_blocks/extra_data/recent_users.erb +1 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/extra_data_cell.rb +71 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/main_data/content.erb +30 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/main_data_cell.rb +77 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/related_processes_cell.rb +47 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/statistics_cell.rb +2 -2
- data/app/cells/decidim/participatory_process_groups/process_filters_cell.rb +4 -4
- data/app/cells/decidim/participatory_processes/content_block_cell.rb +21 -0
- data/app/cells/decidim/participatory_processes/content_blocks/extra_data/active_step.erb +1 -0
- data/app/cells/decidim/participatory_processes/content_blocks/extra_data_cell.rb +60 -0
- data/app/cells/decidim/participatory_processes/content_blocks/hero_cell.rb +29 -0
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_cell.rb +14 -27
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_settings_form/show.erb +1 -1
- data/app/cells/decidim/participatory_processes/content_blocks/main_data_cell.rb +34 -0
- data/app/cells/decidim/participatory_processes/content_blocks/metadata_cell.rb +23 -0
- data/app/cells/decidim/participatory_processes/content_blocks/metrics_cell.rb +25 -0
- data/app/cells/decidim/participatory_processes/content_blocks/processes_settings_form/show.erb +3 -0
- data/app/cells/decidim/participatory_processes/content_blocks/processes_settings_form_cell.rb +28 -0
- data/app/cells/decidim/participatory_processes/content_blocks/related_processes/content.erb +1 -0
- data/app/cells/decidim/participatory_processes/content_blocks/related_processes_cell.rb +53 -0
- data/app/cells/decidim/participatory_processes/content_blocks/stats_cell.rb +17 -0
- data/app/cells/decidim/participatory_processes/filtered_participatory_processes_cell.rb +1 -1
- data/app/cells/decidim/participatory_processes/process_cell.rb +2 -2
- data/app/cells/decidim/participatory_processes/process_dropdown_metadata/metadata.erb +22 -0
- data/app/cells/decidim/participatory_processes/process_dropdown_metadata_cell.rb +39 -0
- data/app/cells/decidim/participatory_processes/process_filters/show.erb +4 -5
- data/app/cells/decidim/participatory_processes/process_filters/type_filter.erb +1 -1
- data/app/cells/decidim/participatory_processes/process_filters_cell.rb +6 -6
- data/app/cells/decidim/participatory_processes/process_g_cell.rb +31 -0
- data/app/cells/decidim/participatory_processes/process_group_cell.rb +2 -2
- data/app/cells/decidim/participatory_processes/process_group_g_cell.rb +23 -0
- data/app/cells/decidim/participatory_processes/process_group_metadata_cell.rb +46 -0
- data/app/cells/decidim/participatory_processes/process_group_s_cell.rb +5 -13
- data/app/cells/decidim/participatory_processes/process_metadata_cell.rb +44 -0
- data/app/cells/decidim/participatory_processes/process_metadata_g_cell.rb +15 -0
- data/app/cells/decidim/participatory_processes/process_s_cell.rb +5 -25
- data/app/cells/decidim/participatory_processes/process_step/show.erb +48 -0
- data/app/cells/decidim/participatory_processes/process_step_cell.rb +30 -0
- data/app/cells/decidim/participatory_processes/processes/show.erb +16 -0
- data/app/cells/decidim/participatory_processes/processes_cell.rb +24 -0
- data/app/commands/decidim/participatory_processes/admin/activate_participatory_process_step.rb +1 -1
- data/app/commands/decidim/participatory_processes/admin/copy_participatory_process.rb +2 -2
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process.rb +3 -1
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb +4 -2
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process_step.rb +1 -1
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process_type.rb +1 -1
- data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_group.rb +1 -1
- data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_step.rb +1 -1
- data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_type.rb +1 -1
- data/app/commands/decidim/participatory_processes/admin/import_participatory_process.rb +1 -1
- data/app/commands/decidim/participatory_processes/admin/reorder_participatory_process_steps.rb +1 -1
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process.rb +1 -1
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process_group.rb +2 -2
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process_step.rb +1 -1
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process_type.rb +1 -1
- data/app/constraints/decidim/participatory_processes/current_participatory_process.rb +1 -1
- data/app/controllers/decidim/participatory_processes/admin/application_controller.rb +29 -0
- data/app/controllers/decidim/participatory_processes/admin/categories_controller.rb +2 -0
- data/app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb +3 -1
- data/app/controllers/decidim/participatory_processes/admin/moderations/reports_controller.rb +1 -1
- data/app/controllers/decidim/participatory_processes/admin/moderations_controller.rb +1 -1
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_attachment_collections_controller.rb +5 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_attachments_controller.rb +5 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_group_landing_page_content_blocks_controller.rb +1 -5
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_group_landing_page_controller.rb +24 -7
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb +16 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_imports_controller.rb +14 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_landing_page_content_blocks_controller.rb +37 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_landing_page_controller.rb +37 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_publications_controller.rb +9 -29
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_step_activations_controller.rb +1 -1
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_steps_controller.rb +16 -4
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_types_controller.rb +19 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_user_roles_controller.rb +8 -91
- data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb +3 -0
- data/app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb +14 -1
- data/app/controllers/decidim/participatory_processes/participatory_processes_controller.rb +19 -4
- data/app/events/decidim/participatory_process_role_assigned_event.rb +6 -6
- data/app/events/decidim/participatory_process_step_activated_event.rb +5 -4
- data/app/events/decidim/participatory_process_step_changed_event.rb +5 -4
- data/app/forms/decidim/participatory_processes/admin/participatory_process_copy_form.rb +1 -1
- data/app/forms/decidim/participatory_processes/admin/participatory_process_form.rb +1 -1
- data/app/forms/decidim/participatory_processes/admin/participatory_process_import_form.rb +1 -1
- data/app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb +2 -2
- data/app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb +2 -18
- data/app/helpers/decidim/participatory_processes/admin/participatory_process_helper.rb +1 -0
- data/app/helpers/decidim/participatory_processes/application_helper.rb +5 -0
- data/app/helpers/decidim/participatory_processes/participatory_process_helper.rb +37 -9
- data/app/helpers/decidim/participatory_processes/participatory_space_content_blocks_helper.rb +17 -0
- data/app/jobs/decidim/participatory_processes/change_active_step_job.rb +35 -0
- data/app/models/decidim/participatory_process.rb +5 -5
- data/app/models/decidim/participatory_process_group.rb +4 -0
- data/app/models/decidim/participatory_process_user_role.rb +5 -34
- data/app/packs/entrypoints/decidim_participatory_processes.js +0 -2
- data/app/packs/src/decidim/participatory_processes/admin/participatory_processes.js +2 -2
- data/app/permissions/decidim/participatory_processes/permissions.rb +11 -15
- data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_group_presenter.rb +2 -2
- data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb +2 -2
- data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_type_presenter.rb +2 -2
- data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_user_role_presenter.rb +2 -2
- data/app/presenters/decidim/participatory_processes/admin_log/step_presenter.rb +2 -2
- data/app/presenters/decidim/participatory_processes/participatory_process_group_stats_presenter.rb +4 -40
- data/app/presenters/decidim/participatory_processes/participatory_process_metric_charts_presenter.rb +0 -68
- data/app/presenters/decidim/participatory_processes/participatory_process_presenter.rb +6 -0
- data/app/presenters/decidim/participatory_processes/participatory_process_stats_presenter.rb +3 -42
- data/app/queries/decidim/participatory_processes/admin/admin_users.rb +1 -1
- data/app/queries/decidim/participatory_processes/admin/moderators.rb +1 -1
- data/app/serializers/decidim/participatory_processes/participatory_process_importer.rb +4 -4
- data/app/views/decidim/participatory_processes/admin/participatory_process_copies/_form.html.erb +24 -29
- data/app/views/decidim/participatory_processes/admin/participatory_process_copies/new.html.erb +16 -5
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/_form.html.erb +72 -50
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/edit.html.erb +15 -9
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/index.html.erb +49 -54
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/new.html.erb +28 -5
- data/app/views/decidim/participatory_processes/admin/participatory_process_imports/_form.html.erb +33 -39
- data/app/views/decidim/participatory_processes/admin/participatory_process_imports/new.html.erb +18 -5
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/_form.html.erb +18 -25
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/edit.html.erb +16 -5
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/index.html.erb +54 -54
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/new.html.erb +18 -5
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/show.html.erb +2 -2
- data/app/views/decidim/participatory_processes/admin/participatory_process_types/_form.html.erb +6 -8
- data/app/views/decidim/participatory_processes/admin/participatory_process_types/edit.html.erb +14 -6
- data/app/views/decidim/participatory_processes/admin/participatory_process_types/index.html.erb +47 -50
- data/app/views/decidim/participatory_processes/admin/participatory_process_types/new.html.erb +14 -6
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/_form.html.erb +14 -18
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/edit.html.erb +17 -6
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/index.html.erb +59 -60
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/new.html.erb +16 -5
- data/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb +193 -146
- data/app/views/decidim/participatory_processes/admin/participatory_processes/edit.html.erb +25 -11
- data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +111 -128
- data/app/views/decidim/participatory_processes/admin/participatory_processes/new.html.erb +16 -9
- data/app/views/decidim/participatory_processes/participatory_process_groups/show.html.erb +6 -10
- data/app/views/decidim/participatory_processes/participatory_processes/_collection.html.erb +8 -0
- data/app/views/decidim/participatory_processes/participatory_processes/all_metrics.html.erb +21 -8
- data/app/views/decidim/participatory_processes/participatory_processes/index.html.erb +19 -17
- data/app/views/decidim/participatory_processes/participatory_processes/index.js.erb +1 -8
- data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +14 -128
- data/app/views/layouts/decidim/_process_header.html.erb +15 -26
- data/app/views/layouts/decidim/_process_nav_item.html.erb +6 -0
- data/app/views/layouts/decidim/admin/_manage_processes.html.erb +36 -0
- data/app/views/layouts/decidim/admin/participatory_process.html.erb +12 -14
- data/app/views/layouts/decidim/admin/participatory_process_group.html.erb +23 -13
- data/app/views/layouts/decidim/admin/participatory_process_groups.html.erb +13 -0
- data/app/views/layouts/decidim/admin/participatory_process_type.html.erb +13 -11
- data/app/views/layouts/decidim/admin/participatory_processes.html.erb +14 -8
- data/app/views/layouts/decidim/participatory_process.html.erb +7 -14
- data/config/locales/ar.yml +1 -55
- data/config/locales/bg.yml +0 -518
- data/config/locales/ca.yml +50 -70
- data/config/locales/cs.yml +51 -71
- data/config/locales/de.yml +52 -72
- data/config/locales/el.yml +8 -64
- data/config/locales/en.yml +52 -72
- data/config/locales/es-MX.yml +49 -69
- data/config/locales/es-PY.yml +49 -69
- data/config/locales/es.yml +49 -69
- data/config/locales/eu.yml +89 -112
- data/config/locales/fi-plain.yml +50 -70
- data/config/locales/fi.yml +57 -77
- data/config/locales/fr-CA.yml +51 -71
- data/config/locales/fr.yml +52 -72
- data/config/locales/ga-IE.yml +0 -16
- data/config/locales/gl.yml +0 -67
- data/config/locales/hu.yml +6 -66
- data/config/locales/id-ID.yml +1 -55
- data/config/locales/is-IS.yml +0 -24
- data/config/locales/it.yml +0 -67
- data/config/locales/ja.yml +51 -71
- data/config/locales/lb.yml +1 -153
- data/config/locales/lt.yml +39 -65
- data/config/locales/lv.yml +1 -59
- data/config/locales/nl.yml +0 -67
- data/config/locales/no.yml +0 -92
- data/config/locales/pl.yml +0 -124
- data/config/locales/pt-BR.yml +1 -113
- data/config/locales/pt.yml +0 -67
- data/config/locales/ro-RO.yml +4 -64
- data/config/locales/ru.yml +0 -49
- data/config/locales/sk.yml +1 -56
- data/config/locales/sl.yml +0 -7
- data/config/locales/sr-CS.yml +0 -4
- data/config/locales/sv.yml +148 -240
- data/config/locales/tr-TR.yml +7 -68
- data/config/locales/uk.yml +0 -49
- data/config/locales/zh-CN.yml +2 -63
- data/config/locales/zh-TW.yml +3 -63
- data/db/migrate/20220315100140_change_steps_dates_to_datetime.rb +8 -0
- data/lib/decidim/api/participatory_process_step_type.rb +2 -2
- data/lib/decidim/participatory_processes/admin_engine.rb +20 -139
- data/lib/decidim/participatory_processes/content_blocks/registry_manager.rb +278 -0
- data/lib/decidim/participatory_processes/engine.rb +13 -103
- data/lib/decidim/participatory_processes/menu.rb +190 -0
- data/lib/decidim/participatory_processes/participatory_space.rb +7 -204
- data/lib/decidim/participatory_processes/query_extensions.rb +2 -2
- data/lib/decidim/participatory_processes/seeds.rb +164 -0
- data/lib/decidim/participatory_processes/test/factories.rb +58 -66
- data/lib/decidim/participatory_processes/version.rb +1 -1
- data/lib/tasks/decidim_participatory_processes.rake +8 -0
- metadata +62 -67
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/filters.erb +0 -21
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/filters_small_view.erb +0 -18
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/participatory_space_filters.erb +0 -6
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/show.erb +0 -8
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/title_filter_order.erb +0 -8
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes_cell.rb +0 -60
- data/app/cells/decidim/participatory_process_groups/content_blocks/html/show.erb +0 -3
- data/app/cells/decidim/participatory_process_groups/content_blocks/html_cell.rb +0 -13
- data/app/cells/decidim/participatory_process_groups/content_blocks/metadata/show.erb +0 -28
- data/app/cells/decidim/participatory_process_groups/content_blocks/metadata_cell.rb +0 -15
- data/app/cells/decidim/participatory_process_groups/content_blocks/title/show.erb +0 -43
- data/app/cells/decidim/participatory_process_groups/content_blocks/title_cell.rb +0 -64
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/_all_processes.erb +0 -9
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/show.erb +0 -14
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/single_process.erb +0 -48
- data/app/cells/decidim/participatory_processes/process_group_m/footer.erb +0 -8
- data/app/cells/decidim/participatory_processes/process_group_m_cell.rb +0 -60
- data/app/cells/decidim/participatory_processes/process_group_s/image.erb +0 -1
- data/app/cells/decidim/participatory_processes/process_group_s/show.erb +0 -8
- data/app/cells/decidim/participatory_processes/process_m/data.erb +0 -21
- data/app/cells/decidim/participatory_processes/process_m/footer.erb +0 -14
- data/app/cells/decidim/participatory_processes/process_m/tags.erb +0 -8
- data/app/cells/decidim/participatory_processes/process_m_cell.rb +0 -87
- data/app/cells/decidim/participatory_processes/process_s/image.erb +0 -1
- data/app/cells/decidim/participatory_processes/process_s/show.erb +0 -14
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process_admin.rb +0 -58
- data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_admin.rb +0 -58
- data/app/commands/decidim/participatory_processes/admin/notify_role_assigned_to_participatory_process.rb +0 -22
- data/app/commands/decidim/participatory_processes/admin/publish_participatory_process.rb +0 -40
- data/app/commands/decidim/participatory_processes/admin/unpublish_participatory_process.rb +0 -40
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process_admin.rb +0 -56
- data/app/controllers/decidim/participatory_processes/participatory_process_steps_controller.rb +0 -28
- data/app/controllers/decidim/participatory_processes/widgets_controller.rb +0 -37
- data/app/packs/src/decidim/participatory_processes/filters.js +0 -28
- data/app/views/decidim/participatory_process_steps/_participatory_process_step.html.erb +0 -16
- data/app/views/decidim/participatory_processes/participatory_process_steps/_timeline.html.erb +0 -7
- data/app/views/decidim/participatory_processes/participatory_process_steps/index.html.erb +0 -18
- data/app/views/decidim/participatory_processes/participatory_processes/_metrics.html.erb +0 -10
- data/app/views/decidim/participatory_processes/participatory_processes/_order_by_processes.html.erb +0 -1
- data/app/views/decidim/participatory_processes/participatory_processes/_participatory_process_group.html.erb +0 -4
- data/app/views/decidim/participatory_processes/participatory_processes/_promoted_process.html.erb +0 -39
- data/app/views/decidim/participatory_processes/participatory_processes/_promoted_process_group.html.erb +0 -31
- data/app/views/layouts/decidim/_process_header_steps.html.erb +0 -37
- data/app/views/layouts/decidim/_process_navigation.html.erb +0 -20
- data/config/locales/he-IL.yml +0 -1
- data/db/seeds/Exampledocument.pdf +0 -0
- data/db/seeds/city.jpeg +0 -0
- data/db/seeds/city2.jpeg +0 -0
- data/db/seeds/homepage_image.jpg +0 -0
- data/decidim-participatory_processes.gemspec +0 -31
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module ParticipatoryProcessGroups
|
5
|
-
module ContentBlocks
|
6
|
-
class HighlightedParticipatoryProcessesCell < Decidim::ViewModel
|
7
|
-
include Decidim::CardHelper
|
8
|
-
include Decidim::IconHelper
|
9
|
-
include ActionView::Helpers::FormOptionsHelper
|
10
|
-
include Decidim::FiltersHelper
|
11
|
-
include Decidim::FilterResource
|
12
|
-
|
13
|
-
def participatory_process_group
|
14
|
-
@participatory_process_group ||= Decidim::ParticipatoryProcessGroup.find(model.scoped_resource_id)
|
15
|
-
end
|
16
|
-
|
17
|
-
def decidim_participatory_processes
|
18
|
-
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers
|
19
|
-
end
|
20
|
-
|
21
|
-
def block_id
|
22
|
-
"processes-grid"
|
23
|
-
end
|
24
|
-
|
25
|
-
def filtered_relation
|
26
|
-
@filtered_relation ||= search.result
|
27
|
-
end
|
28
|
-
|
29
|
-
def default_date_filter
|
30
|
-
return "active" if filtered_relation.any?(&:active?)
|
31
|
-
return "upcoming" if filtered_relation.any?(&:upcoming?)
|
32
|
-
return "past" if filtered_relation.any?(&:past?)
|
33
|
-
|
34
|
-
"all"
|
35
|
-
end
|
36
|
-
|
37
|
-
private
|
38
|
-
|
39
|
-
def search_collection
|
40
|
-
base_relation
|
41
|
-
end
|
42
|
-
|
43
|
-
def default_filter_params
|
44
|
-
{
|
45
|
-
with_any_scope: nil,
|
46
|
-
with_area: nil,
|
47
|
-
with_type: nil
|
48
|
-
}
|
49
|
-
end
|
50
|
-
|
51
|
-
def base_relation
|
52
|
-
@base_relation ||= Decidim::ParticipatoryProcesses::GroupPublishedParticipatoryProcesses.new(
|
53
|
-
participatory_process_group,
|
54
|
-
current_user
|
55
|
-
).query
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module ParticipatoryProcessGroups
|
5
|
-
module ContentBlocks
|
6
|
-
class HtmlCell < Decidim::ContentBlocks::HtmlCell
|
7
|
-
def block_id
|
8
|
-
model.manifest_name.parameterize.gsub("_", "-")
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
@@ -1,28 +0,0 @@
|
|
1
|
-
<section class="section" id="participatory_process_group-metadata">
|
2
|
-
<article class="card card__row">
|
3
|
-
<div>
|
4
|
-
<div class="mb-xs"><strong><%= t("decidim.participatory_process_groups.content_blocks.metadata.developer_group") %></strong></div>
|
5
|
-
<div class="text-small">
|
6
|
-
<%= decidim_sanitize translated_attribute(participatory_process_group.developer_group) %>
|
7
|
-
</div>
|
8
|
-
</div>
|
9
|
-
<div>
|
10
|
-
<div class="mb-xs"><strong><%= t("decidim.participatory_process_groups.content_blocks.metadata.target") %></strong></div>
|
11
|
-
<div class="text-small">
|
12
|
-
<%= decidim_sanitize translated_attribute(participatory_process_group.target) %>
|
13
|
-
</div>
|
14
|
-
</div>
|
15
|
-
<div>
|
16
|
-
<div class="mb-xs"><strong><%= t("decidim.participatory_process_groups.content_blocks.metadata.participatory_scope") %></strong></div>
|
17
|
-
<div class="text-small">
|
18
|
-
<%= decidim_sanitize translated_attribute(participatory_process_group.participatory_scope) %>
|
19
|
-
</div>
|
20
|
-
</div>
|
21
|
-
<div>
|
22
|
-
<div class="mb-xs"><strong><%= t("decidim.participatory_process_groups.content_blocks.metadata.participatory_structure") %></strong></div>
|
23
|
-
<div class="text-small">
|
24
|
-
<%= decidim_sanitize translated_attribute(participatory_process_group.participatory_structure) %>
|
25
|
-
</div>
|
26
|
-
</div>
|
27
|
-
</article>
|
28
|
-
</section>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module ParticipatoryProcessGroups
|
5
|
-
module ContentBlocks
|
6
|
-
class MetadataCell < Decidim::ViewModel
|
7
|
-
include Decidim::SanitizeHelper
|
8
|
-
|
9
|
-
def participatory_process_group
|
10
|
-
@participatory_process_group ||= Decidim::ParticipatoryProcessGroup.find(model.scoped_resource_id)
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
<section class="section">
|
2
|
-
<h2 class="heading2"><%= decidim_escape_translated(participatory_process_group.title) %></h2>
|
3
|
-
<div class="row">
|
4
|
-
<div class="columns medium-9">
|
5
|
-
<%= decidim_sanitize_editor_admin translated_attribute(participatory_process_group.description) %>
|
6
|
-
<div class="row">
|
7
|
-
<div class="column medium-6 text-muted">
|
8
|
-
<%= icon "grid-three-up", role: "img", "aria-hidden": true, class: "mr-xs" %>
|
9
|
-
<%= t("decidim.participatory_process_groups.content_blocks.title.participatory_processes", count: participatory_processes_count) %>
|
10
|
-
</div>
|
11
|
-
<% if has_meta_scope? %>
|
12
|
-
<div class="column medium-6 end text-muted">
|
13
|
-
<%= icon "globe", class: "mr-xs" %>
|
14
|
-
<strong><%= t("decidim.participatory_process_groups.content_blocks.title.meta_scope") %></strong>
|
15
|
-
<%= translated_attribute(meta_scope) %>
|
16
|
-
</div>
|
17
|
-
<% end %>
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
<div class="columns medium-3">
|
21
|
-
<% if has_hashtag? %>
|
22
|
-
<div class="mb-s text-muted">
|
23
|
-
<%= icon "twitter", role: "img", aria_label: "Twitter", class: "mr-xs" %>
|
24
|
-
<%= link_to(
|
25
|
-
"##{hashtag_text}",
|
26
|
-
twitter_hashtag_url(hashtag_text),
|
27
|
-
target: "_blank"
|
28
|
-
) %>
|
29
|
-
</div>
|
30
|
-
<% end %>
|
31
|
-
<% if has_group_url? %>
|
32
|
-
<div class="text-muted">
|
33
|
-
<%= icon "external-link", class: "mr-xs" %>
|
34
|
-
<%= link_to(
|
35
|
-
group_url_text,
|
36
|
-
group_url,
|
37
|
-
target: "_blank"
|
38
|
-
) %>
|
39
|
-
</div>
|
40
|
-
<% end %>
|
41
|
-
</div>
|
42
|
-
</div>
|
43
|
-
</section>
|
@@ -1,64 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module ParticipatoryProcessGroups
|
5
|
-
module ContentBlocks
|
6
|
-
class TitleCell < Decidim::ViewModel
|
7
|
-
include Decidim::SanitizeHelper
|
8
|
-
include Decidim::IconHelper
|
9
|
-
include Decidim::TwitterSearchHelper
|
10
|
-
|
11
|
-
delegate :group_url, to: :participatory_process_group
|
12
|
-
|
13
|
-
def participatory_process_group
|
14
|
-
@participatory_process_group ||= Decidim::ParticipatoryProcessGroup.find(model.scoped_resource_id)
|
15
|
-
end
|
16
|
-
|
17
|
-
def hashtag_text
|
18
|
-
@hashtag_text ||= decidim_html_escape(participatory_process_group.hashtag || "")
|
19
|
-
end
|
20
|
-
|
21
|
-
def has_hashtag?
|
22
|
-
hashtag_text.present?
|
23
|
-
end
|
24
|
-
|
25
|
-
def has_group_url?
|
26
|
-
group_url.present?
|
27
|
-
end
|
28
|
-
|
29
|
-
def meta_scope
|
30
|
-
@meta_scope ||= translated_attribute(participatory_process_group.meta_scope)
|
31
|
-
end
|
32
|
-
|
33
|
-
def has_meta_scope?
|
34
|
-
meta_scope.present?
|
35
|
-
end
|
36
|
-
|
37
|
-
def group_url_text
|
38
|
-
group_uri.host + group_uri.path
|
39
|
-
end
|
40
|
-
|
41
|
-
def decidim_participatory_processes
|
42
|
-
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers
|
43
|
-
end
|
44
|
-
|
45
|
-
def participatory_processes_count
|
46
|
-
@participatory_processes_count ||= processes.count
|
47
|
-
end
|
48
|
-
|
49
|
-
private
|
50
|
-
|
51
|
-
def processes
|
52
|
-
@processes ||= Decidim::ParticipatoryProcesses::GroupPublishedParticipatoryProcesses.new(
|
53
|
-
participatory_process_group,
|
54
|
-
current_user
|
55
|
-
).query
|
56
|
-
end
|
57
|
-
|
58
|
-
def group_uri
|
59
|
-
@group_uri = URI.parse(group_url)
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
<div class="row" id="see-all-processes">
|
2
|
-
<div class="columns small-centered small-12
|
3
|
-
smallmedium-8 medium-6 large-4">
|
4
|
-
<%= link_to t("see_all_processes", scope: i18n_scope),
|
5
|
-
decidim_participatory_processes.participatory_processes_path,
|
6
|
-
class: "button expanded hollow button--sc home-section__cta",
|
7
|
-
title: t("processes_button_title", scope: i18n_scope) %>
|
8
|
-
</div>
|
9
|
-
</div>
|
data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/show.erb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
<section id="highlighted_processes" class="wrapper-home home-section">
|
2
|
-
<div class="row" id="highlighted-processes">
|
3
|
-
<h3 class="section-heading"><%= t("active_processes", scope: i18n_scope) %></h3>
|
4
|
-
<div class="row collapse">
|
5
|
-
<div class="row small-up-1 smallmedium-up-2 mediumlarge-up-3
|
6
|
-
large-up-4 card-grid">
|
7
|
-
<% highlighted_items.each do |item| %>
|
8
|
-
<%= card_for item, size: :s %>
|
9
|
-
<% end %>
|
10
|
-
</div>
|
11
|
-
</div>
|
12
|
-
</div>
|
13
|
-
<%= render "_all_processes" %>
|
14
|
-
</section>
|
@@ -1,48 +0,0 @@
|
|
1
|
-
<% process = highlighted_items.first %>
|
2
|
-
<% title_id = "process_title" %>
|
3
|
-
<section class="wrapper-home home-section">
|
4
|
-
<div class="row" id="highlighted-processes">
|
5
|
-
<h3 class="section-heading"><%= t("active_processes", scope: i18n_scope) %></h3>
|
6
|
-
<div class="row collapse">
|
7
|
-
<% if process.is_a? Decidim::ParticipatoryProcessGroup %>
|
8
|
-
<%= render partial: "decidim/participatory_processes/participatory_processes/promoted_process_group.html", locals: { promoted_process_group: process } %>
|
9
|
-
<% else %>
|
10
|
-
<div class="card card--full card--process">
|
11
|
-
<div class="row collapse card--process__row">
|
12
|
-
<div class="column large-6 card--process__column">
|
13
|
-
<div class="card__content">
|
14
|
-
<%= link_to decidim_participatory_processes.participatory_process_path(process), class: "card__link" do %>
|
15
|
-
<h2 class="card__title" id="<%= title_id %>"><%= decidim_html_escape(translated_attribute(process.title)) %></h2>
|
16
|
-
<% end %>
|
17
|
-
<%= decidim_sanitize_editor translated_attribute(process.short_description) %>
|
18
|
-
<%= link_to decidim_participatory_processes.participatory_process_path(process), class: "button small hollow" do %>
|
19
|
-
<span class="show-for-sr"><%= decidim_html_escape(translated_attribute(process.title)) %></span>
|
20
|
-
<%= t("more_information", scope: i18n_scope) %>
|
21
|
-
<% end %>
|
22
|
-
</div>
|
23
|
-
</div>
|
24
|
-
<div class="column large-6 card--process__column">
|
25
|
-
<div class="card--full__image" style="background-image:url('<%= process.attached_uploader(:hero_image).path %>')">
|
26
|
-
<div class="card__content row collapse">
|
27
|
-
<div class="large-6 large-offset-6 columns">
|
28
|
-
<%= link_to decidim_participatory_processes.participatory_process_path(process), class: "button expanded button--sc" do %>
|
29
|
-
<span class="show-for-sr"><%= t("participate_in", resource_name: translated_attribute(process.title), scope: i18n_scope) %></span>
|
30
|
-
<span aria-hidden="true"><%= t("participate", scope: i18n_scope) %></span>
|
31
|
-
<% if process.active_step %>
|
32
|
-
<span class="button__info">
|
33
|
-
<%= t("active_step", scope: i18n_scope) %>
|
34
|
-
<strong><%= translated_attribute process.active_step.title %></strong>
|
35
|
-
</span>
|
36
|
-
<% end %>
|
37
|
-
<% end %>
|
38
|
-
</div>
|
39
|
-
</div>
|
40
|
-
</div>
|
41
|
-
</div>
|
42
|
-
</div>
|
43
|
-
</div>
|
44
|
-
<% end %>
|
45
|
-
</div>
|
46
|
-
</div>
|
47
|
-
<%= render "_all_processes" %>
|
48
|
-
</section>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<div class="card__footer card__footer--spaces">
|
2
|
-
<div class="card__support">
|
3
|
-
<%= link_to(resource_path, class: "card__button button button--sc small") do %>
|
4
|
-
<span class="show-for-sr"><%= t("browse_resource", resource_name: title, scope: "layouts.decidim.participatory_process_groups.participatory_process_group") %></span>
|
5
|
-
<%= t("layouts.decidim.participatory_process_groups.participatory_process_group.browse") %>
|
6
|
-
<% end %>
|
7
|
-
</div>
|
8
|
-
</div>
|
@@ -1,60 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module ParticipatoryProcesses
|
5
|
-
# This cell renders the Medium (:m) process group card
|
6
|
-
# for an given instance of a ProcessGroup
|
7
|
-
class ProcessGroupMCell < Decidim::CardMCell
|
8
|
-
private
|
9
|
-
|
10
|
-
def has_image?
|
11
|
-
true
|
12
|
-
end
|
13
|
-
|
14
|
-
def resource_image_path
|
15
|
-
model.attached_uploader(:hero_image).path
|
16
|
-
end
|
17
|
-
|
18
|
-
def title
|
19
|
-
decidim_escape_translated model.title
|
20
|
-
end
|
21
|
-
|
22
|
-
def resource_path
|
23
|
-
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers.participatory_process_group_path(model)
|
24
|
-
end
|
25
|
-
|
26
|
-
def step_title
|
27
|
-
translated_attribute model.active_step.title
|
28
|
-
end
|
29
|
-
|
30
|
-
def card_classes
|
31
|
-
["card--process", "card--stack"].join(" ")
|
32
|
-
end
|
33
|
-
|
34
|
-
def statuses
|
35
|
-
super << :processes_count
|
36
|
-
end
|
37
|
-
|
38
|
-
def processes_count_status
|
39
|
-
# rubocop: disable Style/StringConcatenation
|
40
|
-
content_tag(
|
41
|
-
:strong,
|
42
|
-
t("layouts.decidim.participatory_process_groups.participatory_process_group.processes_count")
|
43
|
-
) + " " + processes_visible_for_user
|
44
|
-
# rubocop: enable Style/StringConcatenation
|
45
|
-
end
|
46
|
-
|
47
|
-
def processes_visible_for_user
|
48
|
-
processes = model.participatory_processes.published
|
49
|
-
|
50
|
-
if current_user
|
51
|
-
return processes.count.to_s if current_user.admin
|
52
|
-
|
53
|
-
processes.visible_for(current_user).count.to_s
|
54
|
-
else
|
55
|
-
processes.public_spaces.count.to_s
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<div aria-hidden="true" class="card__image-top" style="background-image:url('<%= resource_image_path %>')"></div>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<div class="column" id="<%= dom_id(model) %>">
|
2
|
-
<%= link_to resource_path, class: "card card--process card--stack card--mini" do %>
|
3
|
-
<%= render :image if has_image? %>
|
4
|
-
<div class="card__content">
|
5
|
-
<span class="card__title card__link"><%= title %></span>
|
6
|
-
</div>
|
7
|
-
<% end %>
|
8
|
-
</div>
|
@@ -1,21 +0,0 @@
|
|
1
|
-
<div class="card__icondata">
|
2
|
-
<ul class="card-data">
|
3
|
-
<li class="card-data__item">
|
4
|
-
<%= icon "datetime", class: "icon--big", role: "img", aria_label: t("decidim.participatory_processes.show.dates") %>
|
5
|
-
</li>
|
6
|
-
<li class="card-data__item">
|
7
|
-
<div class="card-data__item--centerblock">
|
8
|
-
<strong><%= t("activemodel.attributes.participatory_process.start_date") %></strong>
|
9
|
-
<br>
|
10
|
-
<%= start_date ? l(start_date, format: :decidim_short) : t("decidim.participatory_processes.show.unspecified") %>
|
11
|
-
</div>
|
12
|
-
</li>
|
13
|
-
<li class="card-data__item">
|
14
|
-
<div class="card-data__item--centerblock">
|
15
|
-
<strong><%= t("activemodel.attributes.participatory_process.end_date") %></strong>
|
16
|
-
<br>
|
17
|
-
<%= end_date ? l(end_date, format: :decidim_short) : t("decidim.participatory_processes.show.unspecified") %>
|
18
|
-
</div>
|
19
|
-
</li>
|
20
|
-
</ul>
|
21
|
-
</div>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<div class="card__footer card__footer--spaces">
|
2
|
-
<div class="card__support">
|
3
|
-
<% if has_step? %>
|
4
|
-
<div class="card__support__data--left">
|
5
|
-
<div><%= t("layouts.decidim.participatory_processes.participatory_process.active_step") %></div>
|
6
|
-
<div class="text-ellipsis"><strong><%= step_title %></strong></div>
|
7
|
-
</div>
|
8
|
-
<% end %>
|
9
|
-
<%= link_to(step_cta_path, class: "card__button button button--sc small") do %>
|
10
|
-
<span class="show-for-sr"><%= step_cta_text %></span>
|
11
|
-
<%= step_cta_text %>
|
12
|
-
<% end %>
|
13
|
-
</div>
|
14
|
-
</div>
|
@@ -1,87 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module ParticipatoryProcesses
|
5
|
-
# This cell renders the Medium (:m) process card
|
6
|
-
# for an given instance of a Process
|
7
|
-
class ProcessMCell < Decidim::CardMCell
|
8
|
-
include Decidim::SanitizeHelper
|
9
|
-
include Decidim::TranslationsHelper
|
10
|
-
include Decidim::TwitterSearchHelper
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
def has_image?
|
15
|
-
true
|
16
|
-
end
|
17
|
-
|
18
|
-
def has_state?
|
19
|
-
model.past?
|
20
|
-
end
|
21
|
-
|
22
|
-
def has_badge?
|
23
|
-
false
|
24
|
-
end
|
25
|
-
|
26
|
-
def has_step?
|
27
|
-
model.active_step.present?
|
28
|
-
end
|
29
|
-
|
30
|
-
def state_classes
|
31
|
-
return unless model.past?
|
32
|
-
|
33
|
-
["alert"]
|
34
|
-
end
|
35
|
-
|
36
|
-
def resource_path
|
37
|
-
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers.participatory_process_path(model)
|
38
|
-
end
|
39
|
-
|
40
|
-
def resource_image_path
|
41
|
-
model.attached_uploader(:hero_image).path
|
42
|
-
end
|
43
|
-
|
44
|
-
def step_cta_text
|
45
|
-
if translated_in_current_locale?(model.active_step&.cta_text)
|
46
|
-
decidim_escape_translated(model.active_step.cta_text)
|
47
|
-
else
|
48
|
-
t(model.cta_button_text_key_accessible, resource_name: title, scope: "layouts.decidim.participatory_processes.participatory_process")
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
def step_cta_path
|
53
|
-
if model.active_step&.cta_path.present?
|
54
|
-
path, params = resource_path.split("?")
|
55
|
-
|
56
|
-
"#{path}/#{model.active_step.cta_path}" + (params.present? ? "?#{params}" : "")
|
57
|
-
else
|
58
|
-
resource_path
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def step_title
|
63
|
-
translated_attribute model.active_step.title
|
64
|
-
end
|
65
|
-
|
66
|
-
def base_card_class
|
67
|
-
"card--process"
|
68
|
-
end
|
69
|
-
|
70
|
-
def statuses
|
71
|
-
[:creation_date, :follow]
|
72
|
-
end
|
73
|
-
|
74
|
-
def resource_icon
|
75
|
-
icon "processes", class: "icon--big"
|
76
|
-
end
|
77
|
-
|
78
|
-
def start_date
|
79
|
-
model.start_date
|
80
|
-
end
|
81
|
-
|
82
|
-
def end_date
|
83
|
-
model.end_date
|
84
|
-
end
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
@@ -1 +0,0 @@
|
|
1
|
-
<div aria-hidden="true" class="card__image-top" style="background-image:url('<%= resource_image_path %>')"></div>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<div class="column" id="<%= dom_id(model) %>">
|
2
|
-
<%= link_to resource_path, class: "card card--process card--mini" do %>
|
3
|
-
<%= render :image if has_image? %>
|
4
|
-
<div class="card__content">
|
5
|
-
<span class="card__title card__link"><%= title %></span>
|
6
|
-
<% if has_step? %>
|
7
|
-
<span class="card--process__small">
|
8
|
-
<%= t("active_step", scope: i18n_scope) %>
|
9
|
-
<strong><%= step_title %></strong>
|
10
|
-
</span>
|
11
|
-
<% end %>
|
12
|
-
</div>
|
13
|
-
<% end %>
|
14
|
-
</div>
|
data/app/commands/decidim/participatory_processes/admin/create_participatory_process_admin.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module ParticipatoryProcesses
|
5
|
-
module Admin
|
6
|
-
# A command with all the business logic when creating a new participatory
|
7
|
-
# process admin in the system.
|
8
|
-
class CreateParticipatoryProcessAdmin < NotifyRoleAssignedToParticipatoryProcess
|
9
|
-
include ::Decidim::Admin::CreateParticipatorySpaceAdminUserActions
|
10
|
-
|
11
|
-
# Public: Initializes the command.
|
12
|
-
#
|
13
|
-
# form - A form object with the params.
|
14
|
-
# current_user - the user performing this action
|
15
|
-
# participatory_process - The ParticipatoryProcess that will hold the
|
16
|
-
# user role
|
17
|
-
def initialize(form, current_user, participatory_process)
|
18
|
-
@form = form
|
19
|
-
@current_user = current_user
|
20
|
-
@participatory_space = participatory_process
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
attr_reader :form, :participatory_space, :current_user, :user
|
26
|
-
|
27
|
-
def create_role
|
28
|
-
extra_info = {
|
29
|
-
resource: {
|
30
|
-
title: user.name
|
31
|
-
}
|
32
|
-
}
|
33
|
-
role_params = {
|
34
|
-
role: form.role.to_sym,
|
35
|
-
user: user,
|
36
|
-
participatory_process: participatory_space
|
37
|
-
}
|
38
|
-
|
39
|
-
Decidim.traceability.create!(
|
40
|
-
Decidim::ParticipatoryProcessUserRole,
|
41
|
-
current_user,
|
42
|
-
role_params,
|
43
|
-
extra_info
|
44
|
-
)
|
45
|
-
send_notification user
|
46
|
-
end
|
47
|
-
|
48
|
-
def existing_role
|
49
|
-
Decidim::ParticipatoryProcessUserRole.exists?(
|
50
|
-
role: form.role.to_sym,
|
51
|
-
user: user,
|
52
|
-
participatory_process: participatory_space
|
53
|
-
)
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_admin.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module ParticipatoryProcesses
|
5
|
-
module Admin
|
6
|
-
# A command with all the business logic when destroying a participatory
|
7
|
-
# process admin in the system.
|
8
|
-
class DestroyParticipatoryProcessAdmin < Decidim::Command
|
9
|
-
# Public: Initializes the command.
|
10
|
-
#
|
11
|
-
# role - the ParticipatoryProcessUserRole to destroy
|
12
|
-
# current_user - the user performing this action
|
13
|
-
def initialize(role, current_user)
|
14
|
-
@role = role
|
15
|
-
@current_user = current_user
|
16
|
-
end
|
17
|
-
|
18
|
-
# Executes the command. Broadcasts these events:
|
19
|
-
#
|
20
|
-
# - :ok when everything is valid.
|
21
|
-
# - :invalid if the form wasn't valid and we couldn't proceed.
|
22
|
-
#
|
23
|
-
# Returns nothing.
|
24
|
-
def call
|
25
|
-
destroy_role!
|
26
|
-
dispatch_system_event
|
27
|
-
broadcast(:ok)
|
28
|
-
end
|
29
|
-
|
30
|
-
private
|
31
|
-
|
32
|
-
attr_reader :role, :current_user
|
33
|
-
|
34
|
-
def dispatch_system_event
|
35
|
-
ActiveSupport::Notifications.publish("decidim.system.participatory_space.admin.destroyed", role.class.name, role.id)
|
36
|
-
end
|
37
|
-
|
38
|
-
def destroy_role!
|
39
|
-
extra_info = {
|
40
|
-
resource: {
|
41
|
-
title: role.user.name
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
Decidim.traceability.perform_action!(
|
46
|
-
"delete",
|
47
|
-
role,
|
48
|
-
current_user,
|
49
|
-
extra_info
|
50
|
-
) do
|
51
|
-
role.destroy!
|
52
|
-
role
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|