decidim-participatory_processes 0.27.8 → 0.28.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (254) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/cells/decidim/participatory_process_groups/content_block_cell.rb +5 -1
  4. data/app/cells/decidim/participatory_process_groups/content_blocks/extra_data/recent_users.erb +1 -0
  5. data/app/cells/decidim/participatory_process_groups/content_blocks/extra_data_cell.rb +71 -0
  6. data/app/cells/decidim/participatory_process_groups/content_blocks/main_data/content.erb +30 -0
  7. data/app/cells/decidim/participatory_process_groups/content_blocks/main_data_cell.rb +77 -0
  8. data/app/cells/decidim/participatory_process_groups/content_blocks/related_processes_cell.rb +47 -0
  9. data/app/cells/decidim/participatory_process_groups/content_blocks/statistics_cell.rb +2 -2
  10. data/app/cells/decidim/participatory_process_groups/process_filters_cell.rb +4 -4
  11. data/app/cells/decidim/participatory_processes/content_block_cell.rb +21 -0
  12. data/app/cells/decidim/participatory_processes/content_blocks/extra_data/active_step.erb +1 -0
  13. data/app/cells/decidim/participatory_processes/content_blocks/extra_data_cell.rb +60 -0
  14. data/app/cells/decidim/participatory_processes/content_blocks/hero_cell.rb +29 -0
  15. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_cell.rb +14 -27
  16. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_settings_form/show.erb +1 -1
  17. data/app/cells/decidim/participatory_processes/content_blocks/main_data_cell.rb +34 -0
  18. data/app/cells/decidim/participatory_processes/content_blocks/metadata_cell.rb +23 -0
  19. data/app/cells/decidim/participatory_processes/content_blocks/metrics_cell.rb +25 -0
  20. data/app/cells/decidim/participatory_processes/content_blocks/processes_settings_form/show.erb +3 -0
  21. data/app/cells/decidim/participatory_processes/content_blocks/processes_settings_form_cell.rb +28 -0
  22. data/app/cells/decidim/participatory_processes/content_blocks/related_processes/content.erb +1 -0
  23. data/app/cells/decidim/participatory_processes/content_blocks/related_processes_cell.rb +53 -0
  24. data/app/cells/decidim/participatory_processes/content_blocks/stats_cell.rb +17 -0
  25. data/app/cells/decidim/participatory_processes/filtered_participatory_processes_cell.rb +1 -1
  26. data/app/cells/decidim/participatory_processes/process_cell.rb +2 -2
  27. data/app/cells/decidim/participatory_processes/process_dropdown_metadata/metadata.erb +22 -0
  28. data/app/cells/decidim/participatory_processes/process_dropdown_metadata_cell.rb +39 -0
  29. data/app/cells/decidim/participatory_processes/process_filters/show.erb +4 -5
  30. data/app/cells/decidim/participatory_processes/process_filters/type_filter.erb +1 -1
  31. data/app/cells/decidim/participatory_processes/process_filters_cell.rb +6 -6
  32. data/app/cells/decidim/participatory_processes/process_g_cell.rb +31 -0
  33. data/app/cells/decidim/participatory_processes/process_group_cell.rb +2 -2
  34. data/app/cells/decidim/participatory_processes/process_group_g_cell.rb +23 -0
  35. data/app/cells/decidim/participatory_processes/process_group_metadata_cell.rb +46 -0
  36. data/app/cells/decidim/participatory_processes/process_group_s_cell.rb +5 -13
  37. data/app/cells/decidim/participatory_processes/process_metadata_cell.rb +44 -0
  38. data/app/cells/decidim/participatory_processes/process_metadata_g_cell.rb +15 -0
  39. data/app/cells/decidim/participatory_processes/process_s_cell.rb +5 -25
  40. data/app/cells/decidim/participatory_processes/process_step/show.erb +48 -0
  41. data/app/cells/decidim/participatory_processes/process_step_cell.rb +30 -0
  42. data/app/cells/decidim/participatory_processes/processes/show.erb +16 -0
  43. data/app/cells/decidim/participatory_processes/processes_cell.rb +24 -0
  44. data/app/commands/decidim/participatory_processes/admin/activate_participatory_process_step.rb +1 -1
  45. data/app/commands/decidim/participatory_processes/admin/copy_participatory_process.rb +2 -2
  46. data/app/commands/decidim/participatory_processes/admin/create_participatory_process.rb +3 -1
  47. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb +4 -2
  48. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_step.rb +1 -1
  49. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_type.rb +1 -1
  50. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_group.rb +1 -1
  51. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_step.rb +1 -1
  52. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_type.rb +1 -1
  53. data/app/commands/decidim/participatory_processes/admin/import_participatory_process.rb +1 -1
  54. data/app/commands/decidim/participatory_processes/admin/reorder_participatory_process_steps.rb +1 -1
  55. data/app/commands/decidim/participatory_processes/admin/update_participatory_process.rb +1 -1
  56. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_group.rb +2 -2
  57. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_step.rb +1 -1
  58. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_type.rb +1 -1
  59. data/app/constraints/decidim/participatory_processes/current_participatory_process.rb +1 -1
  60. data/app/controllers/decidim/participatory_processes/admin/application_controller.rb +29 -0
  61. data/app/controllers/decidim/participatory_processes/admin/categories_controller.rb +2 -0
  62. data/app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb +3 -1
  63. data/app/controllers/decidim/participatory_processes/admin/moderations/reports_controller.rb +1 -1
  64. data/app/controllers/decidim/participatory_processes/admin/moderations_controller.rb +1 -1
  65. data/app/controllers/decidim/participatory_processes/admin/participatory_process_attachment_collections_controller.rb +5 -0
  66. data/app/controllers/decidim/participatory_processes/admin/participatory_process_attachments_controller.rb +5 -0
  67. data/app/controllers/decidim/participatory_processes/admin/participatory_process_group_landing_page_content_blocks_controller.rb +1 -5
  68. data/app/controllers/decidim/participatory_processes/admin/participatory_process_group_landing_page_controller.rb +24 -7
  69. data/app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb +16 -0
  70. data/app/controllers/decidim/participatory_processes/admin/participatory_process_imports_controller.rb +14 -0
  71. data/app/controllers/decidim/participatory_processes/admin/participatory_process_landing_page_content_blocks_controller.rb +37 -0
  72. data/app/controllers/decidim/participatory_processes/admin/participatory_process_landing_page_controller.rb +37 -0
  73. data/app/controllers/decidim/participatory_processes/admin/participatory_process_publications_controller.rb +9 -29
  74. data/app/controllers/decidim/participatory_processes/admin/participatory_process_step_activations_controller.rb +1 -1
  75. data/app/controllers/decidim/participatory_processes/admin/participatory_process_steps_controller.rb +16 -4
  76. data/app/controllers/decidim/participatory_processes/admin/participatory_process_types_controller.rb +19 -0
  77. data/app/controllers/decidim/participatory_processes/admin/participatory_process_user_roles_controller.rb +8 -91
  78. data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb +3 -0
  79. data/app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb +14 -1
  80. data/app/controllers/decidim/participatory_processes/participatory_processes_controller.rb +19 -4
  81. data/app/events/decidim/participatory_process_role_assigned_event.rb +6 -6
  82. data/app/events/decidim/participatory_process_step_activated_event.rb +5 -4
  83. data/app/events/decidim/participatory_process_step_changed_event.rb +5 -4
  84. data/app/forms/decidim/participatory_processes/admin/participatory_process_copy_form.rb +1 -1
  85. data/app/forms/decidim/participatory_processes/admin/participatory_process_form.rb +1 -1
  86. data/app/forms/decidim/participatory_processes/admin/participatory_process_import_form.rb +1 -1
  87. data/app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb +2 -2
  88. data/app/forms/decidim/participatory_processes/admin/participatory_process_user_role_form.rb +2 -18
  89. data/app/helpers/decidim/participatory_processes/admin/participatory_process_helper.rb +1 -0
  90. data/app/helpers/decidim/participatory_processes/application_helper.rb +5 -0
  91. data/app/helpers/decidim/participatory_processes/participatory_process_helper.rb +37 -9
  92. data/app/helpers/decidim/participatory_processes/participatory_space_content_blocks_helper.rb +17 -0
  93. data/app/jobs/decidim/participatory_processes/change_active_step_job.rb +35 -0
  94. data/app/models/decidim/participatory_process.rb +5 -5
  95. data/app/models/decidim/participatory_process_group.rb +4 -0
  96. data/app/models/decidim/participatory_process_user_role.rb +5 -34
  97. data/app/packs/entrypoints/decidim_participatory_processes.js +0 -2
  98. data/app/packs/src/decidim/participatory_processes/admin/participatory_processes.js +2 -2
  99. data/app/permissions/decidim/participatory_processes/permissions.rb +11 -15
  100. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_group_presenter.rb +2 -2
  101. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb +2 -2
  102. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_type_presenter.rb +2 -2
  103. data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_user_role_presenter.rb +2 -2
  104. data/app/presenters/decidim/participatory_processes/admin_log/step_presenter.rb +2 -2
  105. data/app/presenters/decidim/participatory_processes/participatory_process_group_stats_presenter.rb +4 -40
  106. data/app/presenters/decidim/participatory_processes/participatory_process_metric_charts_presenter.rb +0 -68
  107. data/app/presenters/decidim/participatory_processes/participatory_process_presenter.rb +6 -0
  108. data/app/presenters/decidim/participatory_processes/participatory_process_stats_presenter.rb +3 -42
  109. data/app/queries/decidim/participatory_processes/admin/admin_users.rb +1 -1
  110. data/app/queries/decidim/participatory_processes/admin/moderators.rb +1 -1
  111. data/app/serializers/decidim/participatory_processes/participatory_process_importer.rb +4 -4
  112. data/app/views/decidim/participatory_processes/admin/participatory_process_copies/_form.html.erb +24 -29
  113. data/app/views/decidim/participatory_processes/admin/participatory_process_copies/new.html.erb +16 -5
  114. data/app/views/decidim/participatory_processes/admin/participatory_process_groups/_form.html.erb +72 -50
  115. data/app/views/decidim/participatory_processes/admin/participatory_process_groups/edit.html.erb +15 -9
  116. data/app/views/decidim/participatory_processes/admin/participatory_process_groups/index.html.erb +49 -54
  117. data/app/views/decidim/participatory_processes/admin/participatory_process_groups/new.html.erb +28 -5
  118. data/app/views/decidim/participatory_processes/admin/participatory_process_imports/_form.html.erb +33 -39
  119. data/app/views/decidim/participatory_processes/admin/participatory_process_imports/new.html.erb +18 -5
  120. data/app/views/decidim/participatory_processes/admin/participatory_process_steps/_form.html.erb +18 -25
  121. data/app/views/decidim/participatory_processes/admin/participatory_process_steps/edit.html.erb +16 -5
  122. data/app/views/decidim/participatory_processes/admin/participatory_process_steps/index.html.erb +54 -54
  123. data/app/views/decidim/participatory_processes/admin/participatory_process_steps/new.html.erb +18 -5
  124. data/app/views/decidim/participatory_processes/admin/participatory_process_steps/show.html.erb +2 -2
  125. data/app/views/decidim/participatory_processes/admin/participatory_process_types/_form.html.erb +6 -8
  126. data/app/views/decidim/participatory_processes/admin/participatory_process_types/edit.html.erb +14 -6
  127. data/app/views/decidim/participatory_processes/admin/participatory_process_types/index.html.erb +47 -50
  128. data/app/views/decidim/participatory_processes/admin/participatory_process_types/new.html.erb +14 -6
  129. data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/_form.html.erb +14 -18
  130. data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/edit.html.erb +17 -6
  131. data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/index.html.erb +59 -60
  132. data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/new.html.erb +16 -5
  133. data/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb +193 -146
  134. data/app/views/decidim/participatory_processes/admin/participatory_processes/edit.html.erb +25 -11
  135. data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +111 -128
  136. data/app/views/decidim/participatory_processes/admin/participatory_processes/new.html.erb +16 -9
  137. data/app/views/decidim/participatory_processes/participatory_process_groups/show.html.erb +6 -10
  138. data/app/views/decidim/participatory_processes/participatory_processes/_collection.html.erb +8 -0
  139. data/app/views/decidim/participatory_processes/participatory_processes/all_metrics.html.erb +21 -8
  140. data/app/views/decidim/participatory_processes/participatory_processes/index.html.erb +19 -17
  141. data/app/views/decidim/participatory_processes/participatory_processes/index.js.erb +1 -8
  142. data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +14 -128
  143. data/app/views/layouts/decidim/_process_header.html.erb +15 -26
  144. data/app/views/layouts/decidim/_process_nav_item.html.erb +6 -0
  145. data/app/views/layouts/decidim/admin/_manage_processes.html.erb +36 -0
  146. data/app/views/layouts/decidim/admin/participatory_process.html.erb +12 -14
  147. data/app/views/layouts/decidim/admin/participatory_process_group.html.erb +23 -13
  148. data/app/views/layouts/decidim/admin/participatory_process_groups.html.erb +13 -0
  149. data/app/views/layouts/decidim/admin/participatory_process_type.html.erb +13 -11
  150. data/app/views/layouts/decidim/admin/participatory_processes.html.erb +14 -8
  151. data/app/views/layouts/decidim/participatory_process.html.erb +7 -14
  152. data/config/locales/ar.yml +1 -55
  153. data/config/locales/bg.yml +0 -518
  154. data/config/locales/ca.yml +50 -70
  155. data/config/locales/cs.yml +51 -71
  156. data/config/locales/de.yml +52 -72
  157. data/config/locales/el.yml +8 -64
  158. data/config/locales/en.yml +52 -72
  159. data/config/locales/es-MX.yml +49 -69
  160. data/config/locales/es-PY.yml +49 -69
  161. data/config/locales/es.yml +49 -69
  162. data/config/locales/eu.yml +89 -112
  163. data/config/locales/fi-plain.yml +50 -70
  164. data/config/locales/fi.yml +51 -71
  165. data/config/locales/fr-CA.yml +51 -71
  166. data/config/locales/fr.yml +52 -72
  167. data/config/locales/ga-IE.yml +0 -16
  168. data/config/locales/gl.yml +0 -67
  169. data/config/locales/hu.yml +6 -66
  170. data/config/locales/id-ID.yml +1 -55
  171. data/config/locales/is-IS.yml +0 -24
  172. data/config/locales/it.yml +0 -67
  173. data/config/locales/ja.yml +51 -71
  174. data/config/locales/lb.yml +1 -153
  175. data/config/locales/lt.yml +39 -65
  176. data/config/locales/lv.yml +1 -59
  177. data/config/locales/nl.yml +0 -67
  178. data/config/locales/no.yml +0 -92
  179. data/config/locales/pl.yml +0 -124
  180. data/config/locales/pt-BR.yml +1 -113
  181. data/config/locales/pt.yml +0 -67
  182. data/config/locales/ro-RO.yml +4 -64
  183. data/config/locales/ru.yml +0 -49
  184. data/config/locales/sk.yml +1 -56
  185. data/config/locales/sl.yml +0 -7
  186. data/config/locales/sr-CS.yml +0 -4
  187. data/config/locales/sv.yml +15 -66
  188. data/config/locales/tr-TR.yml +7 -68
  189. data/config/locales/uk.yml +0 -49
  190. data/config/locales/zh-CN.yml +2 -63
  191. data/config/locales/zh-TW.yml +3 -63
  192. data/db/migrate/20220315100140_change_steps_dates_to_datetime.rb +8 -0
  193. data/lib/decidim/api/participatory_process_step_type.rb +2 -2
  194. data/lib/decidim/participatory_processes/admin_engine.rb +20 -139
  195. data/lib/decidim/participatory_processes/content_blocks/registry_manager.rb +278 -0
  196. data/lib/decidim/participatory_processes/engine.rb +13 -103
  197. data/lib/decidim/participatory_processes/menu.rb +190 -0
  198. data/lib/decidim/participatory_processes/participatory_space.rb +7 -204
  199. data/lib/decidim/participatory_processes/query_extensions.rb +2 -2
  200. data/lib/decidim/participatory_processes/seeds.rb +164 -0
  201. data/lib/decidim/participatory_processes/test/factories.rb +58 -66
  202. data/lib/decidim/participatory_processes/version.rb +1 -1
  203. data/lib/tasks/decidim_participatory_processes.rake +8 -0
  204. metadata +62 -67
  205. data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/filters.erb +0 -21
  206. data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/filters_small_view.erb +0 -18
  207. data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/participatory_space_filters.erb +0 -6
  208. data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/show.erb +0 -8
  209. data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/title_filter_order.erb +0 -8
  210. data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes_cell.rb +0 -60
  211. data/app/cells/decidim/participatory_process_groups/content_blocks/html/show.erb +0 -3
  212. data/app/cells/decidim/participatory_process_groups/content_blocks/html_cell.rb +0 -13
  213. data/app/cells/decidim/participatory_process_groups/content_blocks/metadata/show.erb +0 -28
  214. data/app/cells/decidim/participatory_process_groups/content_blocks/metadata_cell.rb +0 -15
  215. data/app/cells/decidim/participatory_process_groups/content_blocks/title/show.erb +0 -43
  216. data/app/cells/decidim/participatory_process_groups/content_blocks/title_cell.rb +0 -64
  217. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/_all_processes.erb +0 -9
  218. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/show.erb +0 -14
  219. data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/single_process.erb +0 -48
  220. data/app/cells/decidim/participatory_processes/process_group_m/footer.erb +0 -8
  221. data/app/cells/decidim/participatory_processes/process_group_m_cell.rb +0 -60
  222. data/app/cells/decidim/participatory_processes/process_group_s/image.erb +0 -1
  223. data/app/cells/decidim/participatory_processes/process_group_s/show.erb +0 -8
  224. data/app/cells/decidim/participatory_processes/process_m/data.erb +0 -21
  225. data/app/cells/decidim/participatory_processes/process_m/footer.erb +0 -14
  226. data/app/cells/decidim/participatory_processes/process_m/tags.erb +0 -8
  227. data/app/cells/decidim/participatory_processes/process_m_cell.rb +0 -87
  228. data/app/cells/decidim/participatory_processes/process_s/image.erb +0 -1
  229. data/app/cells/decidim/participatory_processes/process_s/show.erb +0 -14
  230. data/app/commands/decidim/participatory_processes/admin/create_participatory_process_admin.rb +0 -58
  231. data/app/commands/decidim/participatory_processes/admin/destroy_participatory_process_admin.rb +0 -58
  232. data/app/commands/decidim/participatory_processes/admin/notify_role_assigned_to_participatory_process.rb +0 -22
  233. data/app/commands/decidim/participatory_processes/admin/publish_participatory_process.rb +0 -40
  234. data/app/commands/decidim/participatory_processes/admin/unpublish_participatory_process.rb +0 -40
  235. data/app/commands/decidim/participatory_processes/admin/update_participatory_process_admin.rb +0 -56
  236. data/app/controllers/decidim/participatory_processes/participatory_process_steps_controller.rb +0 -28
  237. data/app/controllers/decidim/participatory_processes/widgets_controller.rb +0 -37
  238. data/app/packs/src/decidim/participatory_processes/filters.js +0 -28
  239. data/app/views/decidim/participatory_process_steps/_participatory_process_step.html.erb +0 -16
  240. data/app/views/decidim/participatory_processes/participatory_process_steps/_timeline.html.erb +0 -7
  241. data/app/views/decidim/participatory_processes/participatory_process_steps/index.html.erb +0 -18
  242. data/app/views/decidim/participatory_processes/participatory_processes/_metrics.html.erb +0 -10
  243. data/app/views/decidim/participatory_processes/participatory_processes/_order_by_processes.html.erb +0 -1
  244. data/app/views/decidim/participatory_processes/participatory_processes/_participatory_process_group.html.erb +0 -4
  245. data/app/views/decidim/participatory_processes/participatory_processes/_promoted_process.html.erb +0 -39
  246. data/app/views/decidim/participatory_processes/participatory_processes/_promoted_process_group.html.erb +0 -31
  247. data/app/views/layouts/decidim/_process_header_steps.html.erb +0 -37
  248. data/app/views/layouts/decidim/_process_navigation.html.erb +0 -20
  249. data/config/locales/he-IL.yml +0 -1
  250. data/db/seeds/Exampledocument.pdf +0 -0
  251. data/db/seeds/city.jpeg +0 -0
  252. data/db/seeds/city2.jpeg +0 -0
  253. data/db/seeds/homepage_image.jpg +0 -0
  254. data/decidim-participatory_processes.gemspec +0 -31
@@ -5,105 +5,22 @@ module Decidim
5
5
  module Admin
6
6
  # Controller that allows managing participatory process user roles.
7
7
  #
8
- class ParticipatoryProcessUserRolesController < Decidim::Admin::ApplicationController
8
+ class ParticipatoryProcessUserRolesController < Decidim::Admin::ParticipatorySpace::UserRoleController
9
9
  include Concerns::ParticipatoryProcessAdmin
10
- include Decidim::Admin::Officializations::Filterable
11
10
 
12
- def index
13
- enforce_permission_to :read, :process_user_role
14
- @participatory_process_user_roles = filtered_collection
15
- end
11
+ def authorization_scope = :process_user_role
16
12
 
17
- def new
18
- enforce_permission_to :create, :process_user_role
19
- @form = form(ParticipatoryProcessUserRoleForm).instance
20
- end
13
+ def resource_form = form(ParticipatoryProcessUserRoleForm)
21
14
 
22
- def create
23
- enforce_permission_to :create, :process_user_role
24
- @form = form(ParticipatoryProcessUserRoleForm).from_params(params)
15
+ def space_index_path = participatory_process_user_roles_path(current_participatory_space)
25
16
 
26
- CreateParticipatoryProcessAdmin.call(@form, current_user, current_participatory_process) do
27
- on(:ok) do
28
- flash[:notice] = I18n.t("participatory_process_user_roles.create.success", scope: "decidim.admin")
29
- redirect_to participatory_process_user_roles_path(current_participatory_process)
30
- end
17
+ def i18n_scope = "decidim.admin.participatory_process_user_roles"
31
18
 
32
- on(:invalid) do
33
- flash[:alert] = I18n.t("participatory_process_user_roles.create.error", scope: "decidim.admin")
34
- render :new
35
- end
36
- end
37
- end
19
+ def role_class = Decidim::ParticipatoryProcessUserRole
38
20
 
39
- def edit
40
- @user_role = collection.find(params[:id])
41
- enforce_permission_to :update, :process_user_role, process_user_role: @user_role
42
- @form = form(ParticipatoryProcessUserRoleForm).from_model(@user_role.user)
43
- end
21
+ def event = "decidim.events.participatory_process.role_assigned"
44
22
 
45
- def update
46
- @user_role = collection.find(params[:id])
47
- enforce_permission_to :update, :process_user_role, process_user_role: @user_role
48
- @form = form(ParticipatoryProcessUserRoleForm).from_params(params)
49
-
50
- UpdateParticipatoryProcessAdmin.call(@form, @user_role) do
51
- on(:ok) do
52
- flash[:notice] = I18n.t("participatory_process_user_roles.update.success", scope: "decidim.admin")
53
- redirect_to participatory_process_user_roles_path(current_participatory_process)
54
- end
55
-
56
- on(:invalid) do
57
- flash.now[:alert] = I18n.t("participatory_process_user_roles.update.error", scope: "decidim.admin")
58
- render :edit
59
- end
60
- end
61
- end
62
-
63
- def destroy
64
- @participatory_process_user_role = collection.find(params[:id])
65
- enforce_permission_to :destroy, :process_user_role, process_user_role: @participatory_process_user_role
66
-
67
- DestroyParticipatoryProcessAdmin.call(@participatory_process_user_role, current_user) do
68
- on(:ok) do
69
- flash[:notice] = I18n.t("participatory_process_user_roles.destroy.success", scope: "decidim.admin")
70
- redirect_to participatory_process_user_roles_path(current_participatory_process)
71
- end
72
- end
73
- end
74
-
75
- def resend_invitation
76
- @user_role = collection.find(params[:id])
77
- enforce_permission_to :invite, :process_user_role, process_user_role: @user_role
78
-
79
- InviteUserAgain.call(@user_role.user, "invite_admin") do
80
- on(:ok) do
81
- flash[:notice] = I18n.t("users.resend_invitation.success", scope: "decidim.admin")
82
- end
83
-
84
- on(:invalid) do
85
- flash[:alert] = I18n.t("users.resend_invitation.error", scope: "decidim.admin")
86
- end
87
- end
88
-
89
- redirect_to participatory_process_user_roles_path(current_participatory_process)
90
- end
91
-
92
- private
93
-
94
- def search_field_predicate
95
- :name_or_nickname_or_email_cont
96
- end
97
-
98
- def filters
99
- [:invitation_accepted_at_present, :last_sign_in_at_present]
100
- end
101
-
102
- def collection
103
- @collection ||= Decidim::ParticipatoryProcessUserRole
104
- .joins(:user)
105
- .where(participatory_process: current_participatory_process) # .order(:role, "decidim_users.name")
106
- end
23
+ def event_class = Decidim::ParticipatoryProcessRoleAssignedEvent
107
24
  end
108
25
  end
109
26
  end
@@ -8,6 +8,9 @@ module Decidim
8
8
  class ParticipatoryProcessesController < Decidim::ParticipatoryProcesses::Admin::ApplicationController
9
9
  include Decidim::Admin::ParticipatorySpaceAdminContext
10
10
  include Decidim::ParticipatoryProcesses::Admin::Filterable
11
+
12
+ add_breadcrumb_item_from_menu :admin_participatory_process_menu, only: :show
13
+
11
14
  participatory_space_admin_layout only: [:edit]
12
15
 
13
16
  helper ProcessGroupsForSelectHelper
@@ -4,7 +4,7 @@ module Decidim
4
4
  module ParticipatoryProcesses
5
5
  class ParticipatoryProcessGroupsController < Decidim::ParticipatoryProcesses::ApplicationController
6
6
  helper Decidim::SanitizeHelper
7
- helper_method :participatory_processes, :group
7
+ helper_method :participatory_processes, :group, :active_content_blocks
8
8
 
9
9
  before_action :set_group
10
10
 
@@ -32,6 +32,19 @@ module Decidim
32
32
  @group = Decidim::ParticipatoryProcessGroup.where(organization: current_organization).find(params[:id])
33
33
  end
34
34
 
35
+ def active_content_blocks
36
+ @active_content_blocks ||= if group.present?
37
+ Decidim::ContentBlock.published.for_scope(
38
+ :participatory_process_group_homepage,
39
+ organization: current_organization
40
+ ).where(
41
+ scoped_resource_id: group.id
42
+ )
43
+ else
44
+ Decidim::ContentBlock.none
45
+ end
46
+ end
47
+
35
48
  attr_reader :group
36
49
  end
37
50
  end
@@ -8,6 +8,8 @@ module Decidim
8
8
  include ParticipatorySpaceContext
9
9
  participatory_space_layout only: [:show, :all_metrics]
10
10
  include FilterResource
11
+ include Paginable
12
+ include HasParticipatorySpaceContentBlocks
11
13
 
12
14
  helper_method :collection,
13
15
  :promoted_collection,
@@ -47,8 +49,8 @@ module Decidim
47
49
  def default_filter_params
48
50
  {
49
51
  with_any_scope: nil,
50
- with_area: nil,
51
- with_type: nil,
52
+ with_any_area: nil,
53
+ with_any_type: nil,
52
54
  with_date: default_date_filter
53
55
  }
54
56
  end
@@ -65,6 +67,19 @@ module Decidim
65
67
  ).first!
66
68
  end
67
69
 
70
+ def active_content_blocks
71
+ @active_content_blocks ||= if current_participatory_space.present?
72
+ Decidim::ContentBlock.published.for_scope(
73
+ :participatory_process_homepage,
74
+ organization: current_organization
75
+ ).where(
76
+ scoped_resource_id: current_participatory_space.id
77
+ )
78
+ else
79
+ Decidim::ContentBlock.none
80
+ end
81
+ end
82
+
68
83
  def published_processes
69
84
  @published_processes ||= OrganizationPublishedParticipatoryProcesses.new(current_organization, current_user)
70
85
  end
@@ -82,7 +97,7 @@ module Decidim
82
97
  end
83
98
 
84
99
  def collection
85
- @collection ||= participatory_processes + participatory_process_groups
100
+ @collection ||= paginate(Kaminari.paginate_array(participatory_processes + participatory_process_groups))
86
101
  end
87
102
 
88
103
  def filtered_processes
@@ -103,7 +118,7 @@ module Decidim
103
118
  end
104
119
 
105
120
  def metrics
106
- @metrics ||= ParticipatoryProcessMetricChartsPresenter.new(participatory_process: current_participatory_space, view_context: view_context)
121
+ @metrics ||= ParticipatoryProcessMetricChartsPresenter.new(participatory_process: current_participatory_space, view_context:)
107
122
  end
108
123
 
109
124
  def participatory_process_group
@@ -1,4 +1,4 @@
1
- # frozen-string_literal: true
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Decidim
4
4
  class ParticipatoryProcessRoleAssignedEvent < Decidim::Events::SimpleEvent
@@ -15,12 +15,12 @@ module Decidim
15
15
 
16
16
  def i18n_options
17
17
  {
18
- resource_path: resource_path,
19
- resource_title: resource_title,
20
- resource_url: resource_url,
18
+ resource_path:,
19
+ resource_title:,
20
+ resource_url:,
21
21
  scope: event_name,
22
- participatory_space_title: participatory_space_title,
23
- participatory_space_url: participatory_space_url,
22
+ participatory_space_title:,
23
+ participatory_space_url:,
24
24
  role: i18n_role
25
25
  }
26
26
  end
@@ -1,17 +1,18 @@
1
- # frozen-string_literal: true
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Decidim
4
4
  class ParticipatoryProcessStepActivatedEvent < Decidim::Events::SimpleEvent
5
5
  include Rails.application.routes.mounted_helpers
6
6
 
7
7
  def resource_path
8
- @resource_path ||= decidim_participatory_processes.participatory_process_participatory_process_steps_path(participatory_process_slug: participatory_space.slug)
8
+ @resource_path ||= decidim_participatory_processes.participatory_process_path(participatory_space, display_steps: true)
9
9
  end
10
10
 
11
11
  def resource_url
12
12
  @resource_url ||= decidim_participatory_processes
13
- .participatory_process_participatory_process_steps_url(
14
- participatory_process_slug: participatory_space.slug,
13
+ .participatory_process_url(
14
+ participatory_space,
15
+ display_steps: true,
15
16
  host: participatory_space.organization.host
16
17
  )
17
18
  end
@@ -1,17 +1,18 @@
1
- # frozen-string_literal: true
1
+ # frozen_string_literal: true
2
2
 
3
3
  module Decidim
4
4
  class ParticipatoryProcessStepChangedEvent < Decidim::Events::SimpleEvent
5
5
  include Rails.application.routes.mounted_helpers
6
6
 
7
7
  def resource_path
8
- @resource_path ||= decidim_participatory_processes.participatory_process_participatory_process_steps_path(participatory_process_slug: participatory_space.slug)
8
+ @resource_path ||= decidim_participatory_processes.participatory_process_path(participatory_space, display_steps: true)
9
9
  end
10
10
 
11
11
  def resource_url
12
12
  @resource_url ||= decidim_participatory_processes
13
- .participatory_process_participatory_process_steps_url(
14
- participatory_process_slug: participatory_space.slug,
13
+ .participatory_process_url(
14
+ participatory_space,
15
+ display_steps: true,
15
16
  host: participatory_space.organization.host
16
17
  )
17
18
  end
@@ -25,7 +25,7 @@ module Decidim
25
25
  private
26
26
 
27
27
  def slug_uniqueness
28
- return unless OrganizationParticipatoryProcesses.new(current_organization).query.where(slug: slug).where.not(id: id).any?
28
+ return unless OrganizationParticipatoryProcesses.new(current_organization).query.where(slug:).where.not(id:).any?
29
29
 
30
30
  errors.add(:slug, :taken)
31
31
  end
@@ -114,7 +114,7 @@ module Decidim
114
114
 
115
115
  def slug_uniqueness
116
116
  return unless organization_participatory_processes
117
- .where(slug: slug)
117
+ .where(slug:)
118
118
  .where.not(id: context[:process_id])
119
119
  .any?
120
120
 
@@ -72,7 +72,7 @@ module Decidim
72
72
  private
73
73
 
74
74
  def slug_uniqueness
75
- return unless OrganizationParticipatoryProcesses.new(current_organization).query.where(slug: slug).where.not(id: id).any?
75
+ return unless OrganizationParticipatoryProcesses.new(current_organization).query.where(slug:).where.not(id:).any?
76
76
 
77
77
  errors.add(:slug, :taken)
78
78
  end
@@ -15,8 +15,8 @@ module Decidim
15
15
 
16
16
  mimic :participatory_process_step
17
17
 
18
- attribute :start_date, Decidim::Attributes::LocalizedDate
19
- attribute :end_date, Decidim::Attributes::LocalizedDate
18
+ attribute :start_date, Decidim::Attributes::TimeWithZone
19
+ attribute :end_date, Decidim::Attributes::TimeWithZone
20
20
  attribute :cta_path, String
21
21
 
22
22
  validates :title, translatable_presence: true
@@ -6,26 +6,10 @@ module Decidim
6
6
  # A form object used to create participatory process user roles from the
7
7
  # admin dashboard.
8
8
  #
9
- class ParticipatoryProcessUserRoleForm < Form
9
+ class ParticipatoryProcessUserRoleForm < Decidim::Admin::ParticipatorySpaceAdminUserForm
10
10
  mimic :participatory_process_user_role
11
11
 
12
- attribute :name, String
13
- attribute :email, String
14
- attribute :role, String
15
-
16
- validates :name, :email, :role, presence: true
17
- validates :role, inclusion: { in: Decidim::ParticipatoryProcessUserRole::ROLES }
18
-
19
- validates :name, format: { with: UserBaseEntity::REGEXP_NAME }
20
-
21
- def roles
22
- Decidim::ParticipatoryProcessUserRole::ROLES.map do |role|
23
- [
24
- I18n.t(role, scope: "decidim.admin.models.participatory_process_user_role.roles"),
25
- role
26
- ]
27
- end
28
- end
12
+ def scope = "decidim.admin.models.participatory_process_user_role.roles"
29
13
  end
30
14
  end
31
15
  end
@@ -8,6 +8,7 @@ module Decidim
8
8
  def scope_type_depth_select_options
9
9
  {
10
10
  include_blank: true,
11
+ help_text: t("scope_type_max_depth_help", scope: "decidim.participatory_processes.admin.participatory_processes.form"),
11
12
  selected: current_participatory_process.try(:decidim_scope_type_id)
12
13
  }
13
14
  end
@@ -6,6 +6,11 @@ module Decidim
6
6
  #
7
7
  module ApplicationHelper
8
8
  include Decidim::ResourceHelper
9
+ include PaginateHelper
10
+
11
+ def component_name
12
+ (defined?(current_component) && translated_attribute(current_component&.name).presence) || t("decidim.menu.processes")
13
+ end
9
14
  end
10
15
  end
11
16
  end
@@ -7,9 +7,9 @@ module Decidim
7
7
  include Decidim::FiltersHelper
8
8
  include Decidim::AttachmentsHelper
9
9
  include Decidim::IconHelper
10
- include Decidim::WidgetUrlsHelper
11
10
  include Decidim::SanitizeHelper
12
11
  include Decidim::ResourceReferenceHelper
12
+ include Decidim::CheckBoxesTreeHelper
13
13
 
14
14
  # Public: Returns the dates for a step in a readable format like
15
15
  # "01/01/2016 - 05/02/2016".
@@ -57,15 +57,43 @@ module Decidim
57
57
  )
58
58
  end
59
59
 
60
- # Public: Invokes the appropriate partial for a promoted
61
- # participatory process or group based on the type name
62
- #
63
- # promoted_item - Can be a Decidim::ParticipatoryProcess or
64
- # Decidim::ParticipatoryProcessGroup
65
- def render_highlighted_partial_for(promoted_item)
66
- name = promoted_item.class.name.demodulize.underscore.gsub("participatory_", "promoted_")
60
+ # Items to display in the navigation of a process
61
+ def process_nav_items(participatory_space)
62
+ components = participatory_space.components.published.or(Decidim::Component.where(id: try(:current_component)))
63
+
64
+ components.map do |component|
65
+ {
66
+ name: translated_attribute(component.name),
67
+ url: main_component_path(component),
68
+ active: is_active_link?(main_component_path(component), :inclusive)
69
+ }
70
+ end
71
+ end
72
+
73
+ def filter_sections
74
+ [
75
+ { method: :with_date, collection: filter_dates_values, label_scope: "decidim.participatory_processes.participatory_processes.filters", id: "date" },
76
+ { method: :with_any_scope, collection: filter_global_scopes_values, label_scope: "decidim.shared.participatory_space_filters.filters", id: "scope" },
77
+ { method: :with_any_area, collection: filter_areas_values, label_scope: "decidim.shared.participatory_space_filters.filters", id: "area" },
78
+ { method: :with_any_type, collection: filter_types_values, label_scope: "decidim.participatory_processes.participatory_processes.filters", id: "type" }
79
+ ].reject { |item| item[:collection].blank? }
80
+ end
81
+
82
+ def process_types
83
+ @process_types ||= Decidim::ParticipatoryProcessType.joins(:processes).distinct
84
+ end
85
+
86
+ def filter_types_values
87
+ return if process_types.blank?
88
+
89
+ type_values = process_types.map { |type| [type.id.to_s, translated_attribute(type.title)] }
90
+ type_values.prepend(["", t("decidim.participatory_processes.participatory_processes.filters.names.all")])
91
+
92
+ filter_tree_from_array(type_values)
93
+ end
67
94
 
68
- render partial: name, locals: { name => promoted_item }.symbolize_keys
95
+ def filter_dates_values
96
+ flat_filter_values(:all, :upcoming, :past, :active, scope: "decidim.participatory_processes.participatory_processes.filters.names")
69
97
  end
70
98
  end
71
99
  end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ParticipatoryProcesses
5
+ # Method shared by different content blocks for the process
6
+ #
7
+ module ParticipatorySpaceContentBlocksHelper
8
+ def base_model
9
+ Decidim::ParticipatoryProcess
10
+ end
11
+
12
+ def decidim_participatory_processes
13
+ Decidim::ParticipatoryProcesses::Engine.routes.url_helpers
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ParticipatoryProcesses
5
+ class ChangeActiveStepJob < ApplicationJob
6
+ queue_as :default
7
+
8
+ def perform
9
+ participatory_processes = Decidim::ParticipatoryProcess.published.where("start_date <= ? AND end_date >= ?", Time.zone.now.to_date, Time.zone.now.to_date)
10
+
11
+ participatory_processes.each do |process|
12
+ steps = Decidim::ParticipatoryProcessStep.unscoped
13
+ .where(decidim_participatory_process_id: process.id)
14
+ .where("start_date <= ? AND end_date >= ?", Time.zone.now, Time.zone.now).order("end_date ASC", :position)
15
+
16
+ active_step = process.steps.find_by(active: true)
17
+ if steps.empty? && active_step
18
+ next_position = active_step.position + 1
19
+ next_step = process.steps.where("start_date <= ?", Time.zone.now.to_date).find_by(position: next_position)
20
+ if next_step.present?
21
+ active_step.update(active: false)
22
+ next_step.update(active: true)
23
+ end
24
+ else
25
+ step_to_activate = steps.first
26
+ if active_step != step_to_activate
27
+ active_step&.update(active: false)
28
+ step_to_activate.update(active: true)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  # Interaction between a user and an organization is done via a
5
- # ParticipatoryProcess. It's a unit of action from the Organization point of
5
+ # ParticipatoryProcess. It is a unit of action from the Organization point of
6
6
  # view that groups several components (proposals, debates...) distributed in
7
7
  # steps that get enabled or disabled depending on which step is currently
8
8
  # active.
@@ -93,7 +93,7 @@ module Decidim
93
93
  sanitize_sql_array(
94
94
  [
95
95
  "ABS(start_date - (CURRENT_DATE at time zone :timezone)::date)",
96
- { timezone: timezone }
96
+ { timezone: }
97
97
  ]
98
98
  )
99
99
  )
@@ -101,7 +101,7 @@ module Decidim
101
101
  end
102
102
  }
103
103
 
104
- scope :with_type, ->(type_id) { where(decidim_participatory_process_type_id: type_id) }
104
+ scope :with_any_type, ->(*type_ids) { where(decidim_participatory_process_type_id: type_ids) }
105
105
 
106
106
  searchable_fields({
107
107
  scope_id: :decidim_scope_id,
@@ -122,7 +122,7 @@ module Decidim
122
122
  where(promoted: true)
123
123
  end
124
124
 
125
- # Return processes that DON'T belong to a process group.
125
+ # Return processes that DO NOT belong to a process group.
126
126
  def self.groupless
127
127
  where(decidim_participatory_process_group_id: nil)
128
128
  end
@@ -207,7 +207,7 @@ module Decidim
207
207
  ransacker_i18n :title
208
208
 
209
209
  def self.ransackable_scopes(_auth_object = nil)
210
- [:with_date, :with_area, :with_any_scope, :with_type]
210
+ [:with_date, :with_any_area, :with_any_scope, :with_any_type]
211
211
  end
212
212
  end
213
213
  end
@@ -33,5 +33,9 @@ module Decidim
33
33
  def self.log_presenter_class_for(_log)
34
34
  Decidim::ParticipatoryProcesses::AdminLog::ParticipatoryProcessGroupPresenter
35
35
  end
36
+
37
+ def self.participatory_spaces(group_id)
38
+ find(group_id).participatory_processes
39
+ end
36
40
  end
37
41
  end
@@ -6,47 +6,18 @@ module Decidim
6
6
  class ParticipatoryProcessUserRole < ApplicationRecord
7
7
  include Traceable
8
8
  include Loggable
9
+ include ParticipatorySpaceUser
9
10
 
10
- belongs_to :user, foreign_key: "decidim_user_id", class_name: "Decidim::User", optional: true
11
11
  belongs_to :participatory_process, foreign_key: "decidim_participatory_process_id", class_name: "Decidim::ParticipatoryProcess", optional: true
12
-
13
12
  alias participatory_space participatory_process
14
13
 
15
- ROLES = %w(admin collaborator moderator valuator).freeze
16
- validates :role, inclusion: { in: ROLES }, uniqueness: { scope: [:user, :participatory_process] }
17
- validate :user_and_participatory_process_same_organization
14
+ scope :for_space, ->(participatory_space) { where(participatory_process: participatory_space) }
15
+
16
+ validates :role, inclusion: { in: ParticipatorySpaceUser::ROLES }, uniqueness: { scope: [:user, :participatory_process] }
17
+ def target_space_association = :participatory_process
18
18
 
19
19
  def self.log_presenter_class_for(_log)
20
20
  Decidim::ParticipatoryProcesses::AdminLog::ParticipatoryProcessUserRolePresenter
21
21
  end
22
-
23
- ransacker :name do
24
- Arel.sql(%{("decidim_users"."name")::text})
25
- end
26
-
27
- ransacker :nickname do
28
- Arel.sql(%{("decidim_users"."nickname")::text})
29
- end
30
-
31
- ransacker :email do
32
- Arel.sql(%{("decidim_users"."email")::text})
33
- end
34
-
35
- ransacker :invitation_accepted_at do
36
- Arel.sql(%{("decidim_users"."invitation_accepted_at")::text})
37
- end
38
-
39
- ransacker :last_sign_in_at do
40
- Arel.sql(%{("decidim_users"."last_sign_in_at")::text})
41
- end
42
-
43
- private
44
-
45
- # Private: check if the process and the user have the same organization
46
- def user_and_participatory_process_same_organization
47
- return if !participatory_process || !user
48
-
49
- errors.add(:participatory_process, :invalid) unless user.organization == participatory_process.organization
50
- end
51
22
  end
52
23
  end
@@ -1,4 +1,2 @@
1
- import "src/decidim/participatory_processes/filters"
2
-
3
1
  // Images
4
2
  require.context("../images", true)
@@ -6,13 +6,13 @@ $(() => {
6
6
  if ($(".edit_participatory_process, .new_participatory_process").length > 0) {
7
7
  $participatoryProcessScopeEnabled.on("change", (event) => {
8
8
  const checked = event.target.checked;
9
- window.theDataPicker.enabled($participatoryProcessScopeId, checked);
9
+ $participatoryProcessScopeId.attr("disabled", !checked);
10
10
  if (checked === true) {
11
11
  $participatoryProcessScopeTypeId.removeAttr("disabled");
12
12
  } else {
13
13
  $participatoryProcessScopeTypeId.attr("disabled", true)
14
14
  }
15
+ $participatoryProcessScopeId.attr("disabled", !$participatoryProcessScopeEnabled.prop("checked"));
15
16
  })
16
- window.theDataPicker.enabled($participatoryProcessScopeId, $participatoryProcessScopeEnabled.prop("checked"));
17
17
  }
18
18
  });