decidim-participatory_processes 0.27.4 → 0.28.0.rc5
Sign up to get free protection for your applications and to get access to all the features.
- 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 +5 -5
- 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 +8 -8
- 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 +20 -5
- 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 -3
- 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/environment.rb +3 -0
- data/config/locales/ar.yml +0 -52
- data/config/locales/bg.yml +0 -6
- data/config/locales/ca.yml +48 -68
- data/config/locales/cs.yml +51 -71
- data/config/locales/de.yml +53 -69
- data/config/locales/el.yml +8 -70
- data/config/locales/en.yml +52 -72
- data/config/locales/es-MX.yml +49 -65
- data/config/locales/es-PY.yml +49 -65
- data/config/locales/es.yml +48 -68
- data/config/locales/eu.yml +170 -146
- data/config/locales/fi-plain.yml +49 -65
- data/config/locales/fi.yml +52 -68
- data/config/locales/fr-CA.yml +51 -67
- data/config/locales/fr.yml +52 -71
- data/config/locales/ga-IE.yml +0 -13
- data/config/locales/gl.yml +0 -69
- data/config/locales/hu.yml +6 -72
- data/config/locales/id-ID.yml +0 -52
- data/config/locales/is-IS.yml +0 -20
- data/config/locales/it.yml +0 -70
- data/config/locales/ja.yml +53 -69
- data/config/locales/lb.yml +1 -46
- data/config/locales/lt.yml +52 -67
- data/config/locales/lv.yml +0 -55
- data/config/locales/nl.yml +0 -70
- data/config/locales/no.yml +0 -70
- data/config/locales/pl.yml +0 -69
- data/config/locales/pt-BR.yml +0 -74
- data/config/locales/pt.yml +0 -70
- data/config/locales/ro-RO.yml +4 -70
- data/config/locales/ru.yml +0 -45
- data/config/locales/sk.yml +0 -53
- data/config/locales/sl.yml +0 -7
- data/config/locales/sq-AL.yml +1 -0
- data/config/locales/sv.yml +17 -72
- data/config/locales/th-TH.yml +1 -0
- data/config/locales/tr-TR.yml +6 -69
- data/config/locales/uk.yml +0 -45
- data/config/locales/zh-CN.yml +1 -61
- data/config/locales/zh-TW.yml +3 -69
- 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 +25 -9
- data/lib/decidim/participatory_processes/version.rb +1 -1
- data/lib/tasks/decidim_participatory_processes.rake +8 -0
- metadata +63 -64
- 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 -27
- 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/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
@@ -3,6 +3,7 @@
|
|
3
3
|
Decidim.register_participatory_space(:participatory_processes) do |participatory_space|
|
4
4
|
participatory_space.icon = "media/images/decidim_participatory_processes.svg"
|
5
5
|
participatory_space.model_class_name = "Decidim::ParticipatoryProcess"
|
6
|
+
participatory_space.content_blocks_scope_name = "participatory_process_homepage"
|
6
7
|
|
7
8
|
participatory_space.participatory_spaces do |organization|
|
8
9
|
Decidim::ParticipatoryProcesses::OrganizationParticipatoryProcesses.new(organization).query
|
@@ -14,6 +15,8 @@ Decidim.register_participatory_space(:participatory_processes) do |participatory
|
|
14
15
|
|
15
16
|
participatory_space.permissions_class_name = "Decidim::ParticipatoryProcesses::Permissions"
|
16
17
|
|
18
|
+
participatory_space.breadcrumb_cell = "decidim/participatory_processes/process_dropdown_metadata"
|
19
|
+
|
17
20
|
participatory_space.register_resource(:participatory_process) do |resource|
|
18
21
|
resource.model_class_name = "Decidim::ParticipatoryProcess"
|
19
22
|
resource.card = "decidim/participatory_processes/process"
|
@@ -23,6 +26,7 @@ Decidim.register_participatory_space(:participatory_processes) do |participatory
|
|
23
26
|
participatory_space.register_resource(:participatory_process_group) do |resource|
|
24
27
|
resource.model_class_name = "Decidim::ParticipatoryProcessGroup"
|
25
28
|
resource.card = "decidim/participatory_processes/process_group"
|
29
|
+
resource.content_blocks_scope_name = "participatory_process_group_homepage"
|
26
30
|
end
|
27
31
|
|
28
32
|
participatory_space.register_stat :followers_count, tag: :followers, priority: Decidim::StatsRegistry::LOW_PRIORITY do |spaces, _start_at, _end_at|
|
@@ -49,213 +53,12 @@ Decidim.register_participatory_space(:participatory_processes) do |participatory
|
|
49
53
|
end
|
50
54
|
|
51
55
|
participatory_space.register_on_destroy_account do |user|
|
52
|
-
Decidim::ParticipatoryProcessUserRole.where(user:
|
56
|
+
Decidim::ParticipatoryProcessUserRole.where(user:).destroy_all
|
53
57
|
end
|
54
58
|
|
55
59
|
participatory_space.seeds do
|
56
|
-
|
57
|
-
seeds_root = File.join(__dir__, "..", "..", "..", "db", "seeds")
|
58
|
-
|
59
|
-
Decidim::ContentBlock.create(
|
60
|
-
organization: organization,
|
61
|
-
weight: 31,
|
62
|
-
scope_name: :homepage,
|
63
|
-
manifest_name: :highlighted_processes,
|
64
|
-
published_at: Time.current
|
65
|
-
)
|
66
|
-
|
67
|
-
process_groups = []
|
68
|
-
2.times do
|
69
|
-
process_groups << Decidim::ParticipatoryProcessGroup.create!(
|
70
|
-
title: Decidim::Faker::Localized.sentence(word_count: 3),
|
71
|
-
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
72
|
-
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
73
|
-
end,
|
74
|
-
hashtag: Faker::Internet.slug,
|
75
|
-
group_url: Faker::Internet.url,
|
76
|
-
organization: organization,
|
77
|
-
hero_image: ActiveStorage::Blob.create_and_upload!(
|
78
|
-
io: File.open(File.join(seeds_root, "city.jpeg")),
|
79
|
-
filename: "hero_image.jpeg",
|
80
|
-
content_type: "image/jpeg",
|
81
|
-
metadata: nil
|
82
|
-
), # Keep after organization
|
83
|
-
developer_group: Decidim::Faker::Localized.sentence(word_count: 1),
|
84
|
-
local_area: Decidim::Faker::Localized.sentence(word_count: 2),
|
85
|
-
meta_scope: Decidim::Faker::Localized.word,
|
86
|
-
target: Decidim::Faker::Localized.sentence(word_count: 3),
|
87
|
-
participatory_scope: Decidim::Faker::Localized.sentence(word_count: 1),
|
88
|
-
participatory_structure: Decidim::Faker::Localized.sentence(word_count: 2)
|
89
|
-
)
|
90
|
-
end
|
91
|
-
|
92
|
-
landing_page_content_blocks = [:title, :metadata, :cta, :highlighted_proposals, :highlighted_results, :highlighted_meetings, :stats, :participatory_processes]
|
93
|
-
|
94
|
-
process_groups.each do |process_group|
|
95
|
-
landing_page_content_blocks.each.with_index(1) do |manifest_name, index|
|
96
|
-
Decidim::ContentBlock.create(
|
97
|
-
organization: organization,
|
98
|
-
scope_name: :participatory_process_group_homepage,
|
99
|
-
manifest_name: manifest_name,
|
100
|
-
weight: index,
|
101
|
-
scoped_resource_id: process_group.id,
|
102
|
-
published_at: Time.current
|
103
|
-
)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
process_types = []
|
108
|
-
2.times do
|
109
|
-
process_types << Decidim::ParticipatoryProcessType.create!(
|
110
|
-
title: Decidim::Faker::Localized.word,
|
111
|
-
organization: organization
|
112
|
-
)
|
113
|
-
end
|
114
|
-
|
115
|
-
2.times do |n|
|
116
|
-
params = {
|
117
|
-
title: Decidim::Faker::Localized.sentence(word_count: 5),
|
118
|
-
slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
|
119
|
-
subtitle: Decidim::Faker::Localized.sentence(word_count: 2),
|
120
|
-
hashtag: "##{Faker::Lorem.word}",
|
121
|
-
short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
122
|
-
Decidim::Faker::Localized.sentence(word_count: 3)
|
123
|
-
end,
|
124
|
-
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
125
|
-
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
126
|
-
end,
|
127
|
-
organization: organization,
|
128
|
-
hero_image: ActiveStorage::Blob.create_and_upload!(
|
129
|
-
io: File.open(File.join(seeds_root, "city.jpeg")),
|
130
|
-
filename: "hero_image.jpeg",
|
131
|
-
content_type: "image/jpeg",
|
132
|
-
metadata: nil
|
133
|
-
), # Keep after organization
|
134
|
-
banner_image: ActiveStorage::Blob.create_and_upload!(
|
135
|
-
io: File.open(File.join(seeds_root, "city2.jpeg")),
|
136
|
-
filename: "banner_image.jpeg",
|
137
|
-
content_type: "image/jpeg",
|
138
|
-
metadata: nil
|
139
|
-
), # Keep after organization
|
140
|
-
promoted: true,
|
141
|
-
published_at: 2.weeks.ago,
|
142
|
-
meta_scope: Decidim::Faker::Localized.word,
|
143
|
-
developer_group: Decidim::Faker::Localized.sentence(word_count: 1),
|
144
|
-
local_area: Decidim::Faker::Localized.sentence(word_count: 2),
|
145
|
-
target: Decidim::Faker::Localized.sentence(word_count: 3),
|
146
|
-
participatory_scope: Decidim::Faker::Localized.sentence(word_count: 1),
|
147
|
-
participatory_structure: Decidim::Faker::Localized.sentence(word_count: 2),
|
148
|
-
start_date: Date.current,
|
149
|
-
end_date: 2.months.from_now,
|
150
|
-
participatory_process_group: process_groups.sample,
|
151
|
-
participatory_process_type: process_types.sample,
|
152
|
-
scope: n.positive? ? nil : Decidim::Scope.reorder(Arel.sql("RANDOM()")).first
|
153
|
-
}
|
154
|
-
|
155
|
-
process = Decidim.traceability.perform_action!(
|
156
|
-
"publish",
|
157
|
-
Decidim::ParticipatoryProcess,
|
158
|
-
organization.users.first,
|
159
|
-
visibility: "all"
|
160
|
-
) do
|
161
|
-
Decidim::ParticipatoryProcess.create!(params)
|
162
|
-
end
|
163
|
-
process.add_to_index_as_search_resource
|
60
|
+
require "decidim/participatory_processes/seeds"
|
164
61
|
|
165
|
-
|
166
|
-
participatory_process: process,
|
167
|
-
active: true
|
168
|
-
).update!(
|
169
|
-
title: Decidim::Faker::Localized.sentence(word_count: 1, supplemental: false, random_words_to_add: 2),
|
170
|
-
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
171
|
-
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
172
|
-
end,
|
173
|
-
start_date: 1.month.ago,
|
174
|
-
end_date: 2.months.from_now
|
175
|
-
)
|
176
|
-
|
177
|
-
# Create users with specific roles
|
178
|
-
Decidim::ParticipatoryProcessUserRole::ROLES.each do |role|
|
179
|
-
email = "participatory_process_#{process.id}_#{role}@example.org"
|
180
|
-
|
181
|
-
user = Decidim::User.find_or_initialize_by(email: email)
|
182
|
-
user.update!(
|
183
|
-
name: Faker::Name.name,
|
184
|
-
nickname: Faker::Twitter.unique.screen_name,
|
185
|
-
password: "decidim123456789",
|
186
|
-
password_confirmation: "decidim123456789",
|
187
|
-
organization: organization,
|
188
|
-
confirmed_at: Time.current,
|
189
|
-
locale: I18n.default_locale,
|
190
|
-
tos_agreement: true
|
191
|
-
)
|
192
|
-
|
193
|
-
Decidim::ParticipatoryProcessUserRole.find_or_create_by!(
|
194
|
-
user: user,
|
195
|
-
participatory_process: process,
|
196
|
-
role: role
|
197
|
-
)
|
198
|
-
end
|
199
|
-
|
200
|
-
attachment_collection = Decidim::AttachmentCollection.create!(
|
201
|
-
name: Decidim::Faker::Localized.word,
|
202
|
-
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
203
|
-
collection_for: process
|
204
|
-
)
|
205
|
-
|
206
|
-
Decidim::Attachment.create!(
|
207
|
-
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
208
|
-
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
209
|
-
attachment_collection: attachment_collection,
|
210
|
-
content_type: "application/pdf",
|
211
|
-
attached_to: process,
|
212
|
-
file: ActiveStorage::Blob.create_and_upload!(
|
213
|
-
io: File.open(File.join(seeds_root, "Exampledocument.pdf")),
|
214
|
-
filename: "Exampledocument.pdf",
|
215
|
-
content_type: "application/pdf",
|
216
|
-
metadata: nil
|
217
|
-
) # Keep after attached_to
|
218
|
-
)
|
219
|
-
|
220
|
-
Decidim::Attachment.create!(
|
221
|
-
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
222
|
-
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
223
|
-
attached_to: process,
|
224
|
-
content_type: "image/jpeg",
|
225
|
-
file: ActiveStorage::Blob.create_and_upload!(
|
226
|
-
io: File.open(File.join(seeds_root, "city.jpeg")),
|
227
|
-
filename: "city.jpeg",
|
228
|
-
content_type: "image/jpeg",
|
229
|
-
metadata: nil
|
230
|
-
) # Keep after attached_to
|
231
|
-
)
|
232
|
-
|
233
|
-
Decidim::Attachment.create!(
|
234
|
-
title: Decidim::Faker::Localized.sentence(word_count: 2),
|
235
|
-
description: Decidim::Faker::Localized.sentence(word_count: 5),
|
236
|
-
attached_to: process,
|
237
|
-
content_type: "application/pdf",
|
238
|
-
file: ActiveStorage::Blob.create_and_upload!(
|
239
|
-
io: File.open(File.join(seeds_root, "Exampledocument.pdf")),
|
240
|
-
filename: "Exampledocument.pdf",
|
241
|
-
content_type: "application/pdf",
|
242
|
-
metadata: nil
|
243
|
-
) # Keep after attached_to
|
244
|
-
)
|
245
|
-
|
246
|
-
2.times do
|
247
|
-
Decidim::Category.create!(
|
248
|
-
name: Decidim::Faker::Localized.sentence(word_count: 5),
|
249
|
-
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
250
|
-
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
251
|
-
end,
|
252
|
-
participatory_space: process
|
253
|
-
)
|
254
|
-
end
|
255
|
-
|
256
|
-
Decidim.component_manifests.each do |manifest|
|
257
|
-
manifest.seed!(process.reload)
|
258
|
-
end
|
259
|
-
end
|
62
|
+
Decidim::ParticipatoryProcesses::Seeds.new.call
|
260
63
|
end
|
261
64
|
end
|
@@ -39,7 +39,7 @@ module Decidim
|
|
39
39
|
def participatory_process_group(id:)
|
40
40
|
Decidim::ParticipatoryProcessGroup.find_by(
|
41
41
|
organization: context[:current_organization],
|
42
|
-
id:
|
42
|
+
id:
|
43
43
|
)
|
44
44
|
end
|
45
45
|
|
@@ -52,7 +52,7 @@ module Decidim
|
|
52
52
|
def participatory_process_type(id:)
|
53
53
|
Decidim::ParticipatoryProcessType.find_by(
|
54
54
|
organization: context[:current_organization],
|
55
|
-
id:
|
55
|
+
id:
|
56
56
|
)
|
57
57
|
end
|
58
58
|
end
|
@@ -0,0 +1,164 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faker"
|
4
|
+
require "decidim/seeds"
|
5
|
+
|
6
|
+
module Decidim
|
7
|
+
module ParticipatoryProcesses
|
8
|
+
class Seeds < Decidim::Seeds
|
9
|
+
def call
|
10
|
+
create_content_block!
|
11
|
+
|
12
|
+
process_groups = []
|
13
|
+
2.times do
|
14
|
+
process_groups << create_process_group!
|
15
|
+
end
|
16
|
+
|
17
|
+
process_groups.each do |process_group|
|
18
|
+
Decidim::ContentBlocksCreator.new(process_group).create_default!
|
19
|
+
end
|
20
|
+
|
21
|
+
process_types = []
|
22
|
+
2.times do
|
23
|
+
process_types << create_process_type!
|
24
|
+
end
|
25
|
+
|
26
|
+
2.times do |_n|
|
27
|
+
process = create_process!(process_group: process_groups.sample, process_type: process_types.sample)
|
28
|
+
|
29
|
+
create_process_step!(process:)
|
30
|
+
|
31
|
+
create_process_user_roles!(process:)
|
32
|
+
|
33
|
+
Decidim::ContentBlocksCreator.new(process).create_default!
|
34
|
+
|
35
|
+
create_attachments!(attached_to: process)
|
36
|
+
|
37
|
+
2.times do
|
38
|
+
create_category!(participatory_space: process)
|
39
|
+
end
|
40
|
+
|
41
|
+
seed_components_manifests!(participatory_space: process)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def create_content_block!
|
46
|
+
Decidim::ContentBlock.create(
|
47
|
+
organization:,
|
48
|
+
weight: 31,
|
49
|
+
scope_name: :homepage,
|
50
|
+
manifest_name: :highlighted_processes,
|
51
|
+
published_at: Time.current
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
def create_process_group!
|
56
|
+
Decidim::ParticipatoryProcessGroup.create!(
|
57
|
+
title: Decidim::Faker::Localized.sentence(word_count: 3),
|
58
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
59
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
60
|
+
end,
|
61
|
+
hashtag: ::Faker::Internet.slug,
|
62
|
+
group_url: ::Faker::Internet.url,
|
63
|
+
organization:,
|
64
|
+
hero_image: ::Faker::Boolean.boolean(true_ratio: 0.5) ? hero_image : nil, # Keep after organization
|
65
|
+
developer_group: Decidim::Faker::Localized.sentence(word_count: 1),
|
66
|
+
local_area: Decidim::Faker::Localized.sentence(word_count: 2),
|
67
|
+
meta_scope: Decidim::Faker::Localized.word,
|
68
|
+
target: Decidim::Faker::Localized.sentence(word_count: 3),
|
69
|
+
participatory_scope: Decidim::Faker::Localized.sentence(word_count: 1),
|
70
|
+
participatory_structure: Decidim::Faker::Localized.sentence(word_count: 2)
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
def create_process_type!
|
75
|
+
Decidim::ParticipatoryProcessType.create!(
|
76
|
+
title: Decidim::Faker::Localized.word,
|
77
|
+
organization:
|
78
|
+
)
|
79
|
+
end
|
80
|
+
|
81
|
+
def create_process!(process_group: nil, process_type: nil)
|
82
|
+
n = rand(2)
|
83
|
+
params = {
|
84
|
+
title: Decidim::Faker::Localized.sentence(word_count: 5),
|
85
|
+
slug: Decidim::Faker::Internet.unique.slug(words: nil, glue: "-"),
|
86
|
+
subtitle: Decidim::Faker::Localized.sentence(word_count: 2),
|
87
|
+
hashtag: "##{::Faker::Lorem.word}",
|
88
|
+
short_description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
89
|
+
Decidim::Faker::Localized.sentence(word_count: 3)
|
90
|
+
end,
|
91
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
92
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
93
|
+
end,
|
94
|
+
organization:,
|
95
|
+
hero_image: ::Faker::Boolean.boolean(true_ratio: 0.5) ? hero_image : nil, # Keep after organization
|
96
|
+
banner_image: ::Faker::Boolean.boolean(true_ratio: 0.5) ? banner_image : nil, # Keep after organization
|
97
|
+
promoted: true,
|
98
|
+
published_at: 2.weeks.ago,
|
99
|
+
meta_scope: Decidim::Faker::Localized.word,
|
100
|
+
developer_group: Decidim::Faker::Localized.sentence(word_count: 1),
|
101
|
+
local_area: Decidim::Faker::Localized.sentence(word_count: 2),
|
102
|
+
target: Decidim::Faker::Localized.sentence(word_count: 3),
|
103
|
+
participatory_scope: Decidim::Faker::Localized.sentence(word_count: 1),
|
104
|
+
participatory_structure: Decidim::Faker::Localized.sentence(word_count: 2),
|
105
|
+
start_date: Date.current,
|
106
|
+
end_date: 2.months.from_now,
|
107
|
+
participatory_process_group: process_group,
|
108
|
+
participatory_process_type: process_type,
|
109
|
+
scope: n.positive? ? nil : Decidim::Scope.all.sample
|
110
|
+
}
|
111
|
+
|
112
|
+
process = Decidim.traceability.perform_action!(
|
113
|
+
"publish",
|
114
|
+
Decidim::ParticipatoryProcess,
|
115
|
+
organization.users.first,
|
116
|
+
visibility: "all"
|
117
|
+
) do
|
118
|
+
Decidim::ParticipatoryProcess.create!(params)
|
119
|
+
end
|
120
|
+
process.add_to_index_as_search_resource
|
121
|
+
|
122
|
+
process
|
123
|
+
end
|
124
|
+
|
125
|
+
def create_process_step!(process:)
|
126
|
+
Decidim::ParticipatoryProcessStep.find_or_initialize_by(
|
127
|
+
participatory_process: process,
|
128
|
+
active: true
|
129
|
+
).update!(
|
130
|
+
title: Decidim::Faker::Localized.sentence(word_count: 1, supplemental: false, random_words_to_add: 2),
|
131
|
+
description: Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
132
|
+
Decidim::Faker::Localized.paragraph(sentence_count: 3)
|
133
|
+
end,
|
134
|
+
start_date: 1.month.ago,
|
135
|
+
end_date: 2.months.from_now
|
136
|
+
)
|
137
|
+
end
|
138
|
+
|
139
|
+
def create_process_user_roles!(process:)
|
140
|
+
# Create users with specific roles
|
141
|
+
Decidim::ParticipatoryProcessUserRole::ROLES.each do |role|
|
142
|
+
email = "participatory_process_#{process.id}_#{role}@example.org"
|
143
|
+
|
144
|
+
user = Decidim::User.find_or_initialize_by(email:)
|
145
|
+
user.update!(
|
146
|
+
name: ::Faker::Name.name,
|
147
|
+
nickname: ::Faker::Twitter.unique.screen_name,
|
148
|
+
password: "decidim123456789",
|
149
|
+
organization:,
|
150
|
+
confirmed_at: Time.current,
|
151
|
+
locale: I18n.default_locale,
|
152
|
+
tos_agreement: true
|
153
|
+
)
|
154
|
+
|
155
|
+
Decidim::ParticipatoryProcessUserRole.find_or_create_by!(
|
156
|
+
user:,
|
157
|
+
participatory_process: process,
|
158
|
+
role:
|
159
|
+
)
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
@@ -58,7 +58,7 @@ FactoryBot.define do
|
|
58
58
|
create(:participatory_process_step,
|
59
59
|
active: true,
|
60
60
|
end_date: evaluator.current_step_ends,
|
61
|
-
participatory_process:
|
61
|
+
participatory_process:)
|
62
62
|
participatory_process.reload
|
63
63
|
participatory_process.steps.reload
|
64
64
|
end
|
@@ -81,7 +81,23 @@ FactoryBot.define do
|
|
81
81
|
|
82
82
|
trait :with_scope do
|
83
83
|
scopes_enabled { true }
|
84
|
-
scope { create :scope, organization:
|
84
|
+
scope { create :scope, organization: }
|
85
|
+
end
|
86
|
+
|
87
|
+
trait :with_content_blocks do
|
88
|
+
transient { blocks_manifests { [:process_hero] } }
|
89
|
+
|
90
|
+
after(:create) do |participatory_process, evaluator|
|
91
|
+
evaluator.blocks_manifests.each do |manifest_name|
|
92
|
+
create(
|
93
|
+
:content_block,
|
94
|
+
organization: participatory_process.organization,
|
95
|
+
scope_name: :participatory_process_homepage,
|
96
|
+
manifest_name:,
|
97
|
+
scoped_resource_id: participatory_process.id
|
98
|
+
)
|
99
|
+
end
|
100
|
+
end
|
85
101
|
end
|
86
102
|
end
|
87
103
|
|
@@ -105,7 +121,7 @@ FactoryBot.define do
|
|
105
121
|
|
106
122
|
trait :with_participatory_processes do
|
107
123
|
after(:create) do |participatory_process_group|
|
108
|
-
create_list(:participatory_process, 2, :published, organization: participatory_process_group.organization, participatory_process_group:
|
124
|
+
create_list(:participatory_process, 2, :published, organization: participatory_process_group.organization, participatory_process_group:)
|
109
125
|
end
|
110
126
|
end
|
111
127
|
end
|
@@ -134,13 +150,13 @@ FactoryBot.define do
|
|
134
150
|
|
135
151
|
trait :with_active_participatory_processes do
|
136
152
|
after(:create) do |participatory_process_type|
|
137
|
-
create_list(:participatory_process, 2, :active, :published, organization: participatory_process_type.organization, participatory_process_type:
|
153
|
+
create_list(:participatory_process, 2, :active, :published, organization: participatory_process_type.organization, participatory_process_type:)
|
138
154
|
end
|
139
155
|
end
|
140
156
|
|
141
157
|
trait :with_past_participatory_processes do
|
142
158
|
after(:create) do |participatory_process_type|
|
143
|
-
create_list(:participatory_process, 2, :past, :published, organization: participatory_process_type.organization, participatory_process_type:
|
159
|
+
create_list(:participatory_process, 2, :past, :published, organization: participatory_process_type.organization, participatory_process_type:)
|
144
160
|
end
|
145
161
|
end
|
146
162
|
end
|
@@ -155,7 +171,7 @@ FactoryBot.define do
|
|
155
171
|
|
156
172
|
after(:create) do |user, evaluator|
|
157
173
|
create :participatory_process_user_role,
|
158
|
-
user
|
174
|
+
user:,
|
159
175
|
participatory_process: evaluator.participatory_process,
|
160
176
|
role: :admin
|
161
177
|
end
|
@@ -171,7 +187,7 @@ FactoryBot.define do
|
|
171
187
|
|
172
188
|
after(:create) do |user, evaluator|
|
173
189
|
create :participatory_process_user_role,
|
174
|
-
user
|
190
|
+
user:,
|
175
191
|
participatory_process: evaluator.participatory_process,
|
176
192
|
role: :collaborator
|
177
193
|
end
|
@@ -187,7 +203,7 @@ FactoryBot.define do
|
|
187
203
|
|
188
204
|
after(:create) do |user, evaluator|
|
189
205
|
create :participatory_process_user_role,
|
190
|
-
user
|
206
|
+
user:,
|
191
207
|
participatory_process: evaluator.participatory_process,
|
192
208
|
role: :moderator
|
193
209
|
end
|
@@ -203,7 +219,7 @@ FactoryBot.define do
|
|
203
219
|
|
204
220
|
after(:create) do |user, evaluator|
|
205
221
|
create :participatory_process_user_role,
|
206
|
-
user
|
222
|
+
user:,
|
207
223
|
participatory_process: evaluator.participatory_process,
|
208
224
|
role: :valuator
|
209
225
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :decidim_participatory_processes do
|
4
|
+
desc "Change active step automatically in participatory processes"
|
5
|
+
task :change_active_step, [] => :environment do
|
6
|
+
Decidim::ParticipatoryProcesses::ChangeActiveStepJob.perform_later
|
7
|
+
end
|
8
|
+
end
|