decidim-decidim_awesome 0.10.1 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim-decidim_awesome might be problematic. Click here for more details.

Files changed (263) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +177 -60
  4. data/app/cells/concerns/decidim/decidim_awesome/global_menu_cell_override.rb +20 -0
  5. data/app/cells/concerns/decidim/decidim_awesome/{proposal_m_cell_override.rb → proposal_l_cell_override.rb} +10 -4
  6. data/app/cells/decidim/decidim_awesome/content_blocks/map/show.erb +5 -12
  7. data/app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb +9 -5
  8. data/app/cells/decidim/decidim_awesome/voting/proposal_metadata_cell.rb +54 -0
  9. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/modal.erb +18 -0
  10. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/show.erb +37 -32
  11. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_cell.rb +9 -4
  12. data/app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb +2 -2
  13. data/app/commands/concerns/decidim/decidim_awesome/proposals/admin/update_proposal_override.rb +31 -0
  14. data/app/commands/concerns/decidim/decidim_awesome/proposals/create_collaborative_draft_override.rb +27 -0
  15. data/app/commands/concerns/decidim/decidim_awesome/proposals/create_proposal_override.rb +27 -0
  16. data/app/commands/concerns/decidim/decidim_awesome/proposals/update_collaborative_draft_override.rb +27 -0
  17. data/app/commands/concerns/decidim/decidim_awesome/proposals/update_proposal_override.rb +26 -0
  18. data/app/commands/decidim/decidim_awesome/admin/create_constraint.rb +1 -1
  19. data/app/commands/decidim/decidim_awesome/admin/create_proposal_custom_field.rb +4 -3
  20. data/app/commands/decidim/decidim_awesome/admin/destroy_custom_redirect.rb +1 -1
  21. data/app/commands/decidim/decidim_awesome/admin/destroy_menu_hack.rb +1 -1
  22. data/app/commands/decidim/decidim_awesome/admin/destroy_proposal_custom_field.rb +6 -3
  23. data/app/commands/decidim/decidim_awesome/admin/rename_scope_label.rb +1 -1
  24. data/app/commands/decidim/decidim_awesome/admin/update_constraint.rb +1 -1
  25. data/app/commands/decidim/decidim_awesome/admin/update_custom_redirect.rb +2 -2
  26. data/app/commands/decidim/decidim_awesome/command.rb +1 -7
  27. data/app/controllers/concerns/decidim/decidim_awesome/admin/maintenance_context.rb +43 -0
  28. data/app/controllers/concerns/decidim/decidim_awesome/admin_accountability/admin/filterable_helper.rb +1 -1
  29. data/app/controllers/concerns/decidim/decidim_awesome/content_security_policy.rb +34 -0
  30. data/app/controllers/concerns/decidim/decidim_awesome/limit_pending_amendments.rb +35 -0
  31. data/app/controllers/concerns/decidim/decidim_awesome/not_found_redirect.rb +1 -1
  32. data/app/controllers/concerns/decidim/decidim_awesome/proposals/proposal_votes_controller_override.rb +3 -3
  33. data/app/controllers/decidim/decidim_awesome/admin/application_controller.rb +2 -0
  34. data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +14 -10
  35. data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +10 -9
  36. data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +23 -20
  37. data/app/controllers/decidim/decidim_awesome/admin/custom_redirects_controller.rb +6 -10
  38. data/app/controllers/decidim/decidim_awesome/admin/maintenance_controller.rb +76 -0
  39. data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +6 -10
  40. data/app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb +14 -6
  41. data/app/controllers/decidim/decidim_awesome/admin/scoped_admins_controller.rb +2 -2
  42. data/app/controllers/decidim/decidim_awesome/admin/scoped_styles_controller.rb +2 -2
  43. data/app/controllers/decidim/decidim_awesome/blank_component_controller.rb +8 -3
  44. data/app/controllers/decidim/decidim_awesome/editor_images_controller.rb +3 -3
  45. data/app/controllers/decidim/decidim_awesome/iframe_component/iframe_controller.rb +18 -5
  46. data/app/forms/concerns/decidim/decidim_awesome/proposals/proposal_form_override.rb +21 -0
  47. data/app/forms/{decidim → concerns/decidim}/decidim_awesome/proposals/proposal_wizard_create_step_form_override.rb +2 -1
  48. data/app/forms/decidim/decidim_awesome/admin/config_form.rb +28 -14
  49. data/app/forms/decidim/decidim_awesome/admin/custom_redirect_form.rb +2 -2
  50. data/app/forms/decidim/decidim_awesome/admin/intergram_form.rb +4 -0
  51. data/app/forms/decidim/decidim_awesome/admin/menu_form.rb +4 -4
  52. data/app/helpers/concerns/decidim/decidim_awesome/amendments_helper_override.rb +65 -0
  53. data/app/helpers/concerns/decidim/decidim_awesome/breadcrumb_helper_override.rb +23 -0
  54. data/app/helpers/concerns/decidim/decidim_awesome/proposals/application_helper_override.rb +110 -0
  55. data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +6 -27
  56. data/app/helpers/decidim/decidim_awesome/map_helper.rb +8 -27
  57. data/app/jobs/decidim/decidim_awesome/destroy_private_data_job.rb +22 -0
  58. data/app/jobs/decidim/decidim_awesome/migrate_legacy_images_job.rb +5 -4
  59. data/app/middleware/decidim/decidim_awesome/current_config.rb +3 -5
  60. data/app/models/concerns/decidim/decidim_awesome/has_proposal_extra_fields.rb +39 -10
  61. data/app/models/decidim/decidim_awesome/awesome_config.rb +1 -1
  62. data/app/models/decidim/decidim_awesome/paper_trail_version.rb +3 -3
  63. data/app/models/decidim/decidim_awesome/proposal_extra_field.rb +35 -1
  64. data/app/models/decidim/decidim_awesome/vote_weight.rb +2 -2
  65. data/app/overrides/decidim/proposals/admin/proposals/show/add_private_body.html.erb.deface +7 -0
  66. data/app/overrides/decidim/proposals/admin/proposals/show/replace_body.html.erb.deface +5 -0
  67. data/app/overrides/decidim/proposals/proposals/_proposal_aside/limit_amendments_modal.html.erb.deface +5 -0
  68. data/app/overrides/decidim/proposals/proposals/_vote_button/replace_vote_button.html.erb.deface +1 -1
  69. data/app/overrides/layouts/decidim/_decidim_javascript/add_awesome_tags.html.erb.deface +6 -0
  70. data/app/overrides/layouts/decidim/_head/add_awesome_tags.html.erb.deface +4 -11
  71. data/app/overrides/layouts/decidim/admin/_header/add_awesome_tags.html.erb.deface +9 -0
  72. data/app/packs/entrypoints/decidim_admin_decidim_awesome.js +1 -2
  73. data/app/packs/entrypoints/decidim_admin_decidim_awesome_global.js +4 -0
  74. data/app/packs/entrypoints/decidim_admin_decidim_awesome_global.scss +1 -0
  75. data/app/packs/entrypoints/decidim_decidim_awesome.js +2 -2
  76. data/app/packs/entrypoints/decidim_decidim_awesome_map.scss +1 -1
  77. data/app/packs/entrypoints/decidim_editor.js +14 -0
  78. data/app/packs/src/decidim/decidim_awesome/admin/auto_edit.js +96 -69
  79. data/app/packs/src/decidim/decidim_awesome/admin/check_redirections.js +46 -41
  80. data/app/packs/src/decidim/decidim_awesome/admin/codemirror.js +3 -3
  81. data/app/packs/src/decidim/decidim_awesome/admin/constraint_form_events.js +115 -0
  82. data/app/packs/src/decidim/decidim_awesome/admin/custom_fields_builder.js +9 -5
  83. data/app/packs/src/decidim/decidim_awesome/admin/form_exit_warn.js +22 -11
  84. data/app/packs/src/decidim/decidim_awesome/admin/proposal_sortings.js +26 -8
  85. data/app/packs/src/decidim/decidim_awesome/admin/tabs_change.js +31 -0
  86. data/app/packs/src/decidim/decidim_awesome/admin/user_picker.js +34 -21
  87. data/app/packs/src/decidim/decidim_awesome/amendments/show_modal_on_limits.js +28 -0
  88. data/app/packs/src/decidim/decidim_awesome/awesome_admin.js +5 -16
  89. data/app/packs/src/decidim/decidim_awesome/awesome_admin_global.js +1 -0
  90. data/app/packs/src/decidim/decidim_awesome/awesome_application.js +1 -15
  91. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/fetcher.js +33 -11
  92. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/meetings_fetcher.js +9 -12
  93. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/proposals_fetcher.js +28 -0
  94. data/app/packs/src/decidim/decidim_awesome/awesome_map/awesome_map.js +3 -4
  95. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/controller.js +12 -12
  96. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/meetings_controller.js +11 -7
  97. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/proposals_controller.js +6 -13
  98. data/app/packs/src/decidim/decidim_awesome/awesome_map/controls_ui.js +51 -20
  99. data/app/packs/src/decidim/decidim_awesome/awesome_map/load_map.js +27 -18
  100. data/app/packs/src/decidim/decidim_awesome/editor/index.js +94 -0
  101. data/app/packs/src/decidim/decidim_awesome/forms/autosave.js +28 -23
  102. data/app/packs/src/decidim/decidim_awesome/forms/custom_fields_renderer.js +29 -25
  103. data/app/packs/src/decidim/decidim_awesome/forms/rich_text_plugin.js +27 -32
  104. data/app/packs/src/decidim/decidim_awesome/proposals/custom_fields.js +31 -15
  105. data/app/packs/src/decidim/decidim_awesome/proposals/images.js +16 -10
  106. data/app/packs/src/decidim/decidim_awesome/voting/voting_cards.js +47 -38
  107. data/app/packs/stylesheets/decidim/decidim_awesome/admin/auto_edits.scss +11 -12
  108. data/app/packs/stylesheets/decidim/decidim_awesome/admin/check_redirections.scss +15 -0
  109. data/app/packs/stylesheets/decidim/decidim_awesome/admin/codemirror.scss +24 -12
  110. data/app/packs/stylesheets/decidim/decidim_awesome/admin/constraints.scss +49 -29
  111. data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_fields.scss +28 -71
  112. data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_styles.scss +48 -0
  113. data/app/packs/stylesheets/decidim/decidim_awesome/admin/intergram_fixes.scss +11 -0
  114. data/app/packs/stylesheets/decidim/decidim_awesome/admin/user_picker.scss +17 -26
  115. data/app/packs/stylesheets/decidim/decidim_awesome/amendments/modal.scss +5 -0
  116. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin.scss +11 -49
  117. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss +19 -0
  118. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_application.scss +4 -19
  119. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_iframe/iframe.scss +1 -1
  120. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_map/map.scss +41 -35
  121. data/app/packs/stylesheets/decidim/decidim_awesome/forms/autosave.scss +6 -6
  122. data/app/packs/stylesheets/decidim/decidim_awesome/forms/custom_fields.scss +118 -0
  123. data/app/packs/stylesheets/decidim/decidim_awesome/shared/spinner.scss +26 -0
  124. data/app/packs/stylesheets/decidim/decidim_awesome/voting/voting_cards.scss +41 -59
  125. data/app/permissions/decidim/decidim_awesome/admin/permissions.rb +14 -3
  126. data/app/permissions/decidim/decidim_awesome/permissions.rb +3 -4
  127. data/app/presenters/concerns/decidim/decidim_awesome/breadcrumb_root_menu_item_presenter_override.rb +23 -0
  128. data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_item_presenter_override.rb +10 -2
  129. data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_presenter_override.rb +8 -0
  130. data/app/presenters/concerns/decidim/decidim_awesome/proposals/proposal_presenter_override.rb +20 -0
  131. data/app/presenters/decidim/decidim_awesome/admin_log/component_presenter_override.rb +30 -0
  132. data/app/presenters/decidim/decidim_awesome/participatory_space_role_presenter.rb +1 -1
  133. data/app/presenters/decidim/decidim_awesome/private_data_presenter.rb +70 -0
  134. data/app/presenters/decidim/decidim_awesome/user_entity_presenter.rb +1 -1
  135. data/app/queries/decidim/decidim_awesome/private_data_finder.rb +19 -0
  136. data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_methods.rb +72 -0
  137. data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_override.rb +38 -0
  138. data/app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb +34 -0
  139. data/app/types/concerns/decidim/decidim_awesome/add_proposal_type_custom_fields.rb +59 -0
  140. data/app/types/concerns/decidim/decidim_awesome/{proposal_type_override.rb → add_proposal_type_vote_weights.rb} +3 -1
  141. data/app/views/decidim/decidim_awesome/admin/admin_accountability/index.html.erb +23 -17
  142. data/app/views/decidim/decidim_awesome/admin/checks/index.html.erb +50 -48
  143. data/app/views/decidim/decidim_awesome/admin/config/_autoedit_box_label.html.erb +7 -2
  144. data/app/views/decidim/decidim_awesome/admin/config/_constraints.html.erb +25 -18
  145. data/app/views/decidim/decidim_awesome/admin/config/_form_admins.html.erb +7 -6
  146. data/app/views/decidim/decidim_awesome/admin/config/_form_editors.html.erb +12 -16
  147. data/app/views/decidim/decidim_awesome/admin/config/_form_livechat.html.erb +39 -23
  148. data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_custom_fields.html.erb +35 -17
  149. data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_private_custom_fields.html.erb +1 -0
  150. data/app/views/decidim/decidim_awesome/admin/config/_form_proposals.html.erb +68 -80
  151. data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +16 -12
  152. data/app/views/decidim/decidim_awesome/admin/config/_form_surveys.html.erb +8 -6
  153. data/app/views/decidim/decidim_awesome/admin/config/show.html.erb +22 -12
  154. data/app/views/decidim/decidim_awesome/admin/constraints/_form.html.erb +1 -49
  155. data/app/views/decidim/decidim_awesome/admin/constraints/new.html.erb +14 -9
  156. data/app/views/decidim/decidim_awesome/admin/constraints/show.html.erb +14 -9
  157. data/app/views/decidim/decidim_awesome/admin/custom_redirects/_form.html.erb +20 -5
  158. data/app/views/decidim/decidim_awesome/admin/custom_redirects/edit.html.erb +5 -5
  159. data/app/views/decidim/decidim_awesome/admin/custom_redirects/index.html.erb +14 -13
  160. data/app/views/decidim/decidim_awesome/admin/custom_redirects/new.html.erb +5 -5
  161. data/app/views/decidim/decidim_awesome/admin/maintenance/_private_data.html.erb +44 -0
  162. data/app/views/decidim/decidim_awesome/admin/maintenance/show.html.erb +44 -0
  163. data/app/views/decidim/decidim_awesome/admin/menu_hacks/_form.html.erb +6 -6
  164. data/app/views/decidim/decidim_awesome/admin/menu_hacks/edit.html.erb +21 -12
  165. data/app/views/decidim/decidim_awesome/admin/menu_hacks/index.html.erb +39 -42
  166. data/app/views/decidim/decidim_awesome/admin/menu_hacks/new.html.erb +21 -12
  167. data/app/views/decidim/decidim_awesome/admin/proposals/_editor.html.erb +8 -5
  168. data/app/views/decidim/decidim_awesome/admin/proposals/_private_body.html.erb +20 -0
  169. data/app/views/decidim/decidim_awesome/admin/shared/_filters_with_date.html.erb +14 -18
  170. data/app/views/decidim/decidim_awesome/amendments/_modal.html.erb +23 -0
  171. data/app/views/decidim/decidim_awesome/custom_fields/_form_render.html.erb +8 -2
  172. data/app/views/decidim/decidim_awesome/iframe_component/iframe/show.html.erb +7 -12
  173. data/app/views/decidim/decidim_awesome/map_component/map/_map_template.html.erb +53 -37
  174. data/app/views/decidim/decidim_awesome/map_component/map/show.html.erb +14 -5
  175. data/app/views/decidim/decidim_awesome/voting/voting_cards/_show_vote_button.html.erb +0 -3
  176. data/app/views/layouts/decidim/decidim_awesome/_awesome_config.html.erb +9 -7
  177. data/app/views/layouts/decidim/decidim_awesome/_intergram_widget.html.erb +9 -6
  178. data/app/views/layouts/decidim/decidim_awesome/admin/_base.html.erb +12 -0
  179. data/app/views/layouts/decidim/decidim_awesome/admin/application.html.erb +1 -73
  180. data/app/views/layouts/decidim/decidim_awesome/admin/maintenance.html.erb +19 -0
  181. data/config/assets.rb +3 -33
  182. data/config/i18n-tasks.yml +23 -3
  183. data/config/locales/ca.yml +28 -17
  184. data/config/locales/cs.yml +39 -14
  185. data/config/locales/de.yml +25 -15
  186. data/config/locales/en.yml +125 -35
  187. data/config/locales/es.yml +26 -16
  188. data/config/locales/eu.yml +7 -3
  189. data/config/locales/fr.yml +25 -16
  190. data/config/locales/hu.yml +43 -8
  191. data/config/locales/it.yml +8 -15
  192. data/config/locales/ja.yml +26 -15
  193. data/config/locales/lt.yml +0 -4
  194. data/config/locales/nl.yml +9 -14
  195. data/config/locales/pt-BR.yml +9 -14
  196. data/config/locales/ro-RO.yml +0 -3
  197. data/config/locales/sv.yml +9 -9
  198. data/config/rubocop/disabled.yml +11 -0
  199. data/config/rubocop/faker.yml +480 -0
  200. data/config/rubocop/rails.yml +88 -0
  201. data/config/rubocop/rspec.yml +65 -0
  202. data/config/rubocop/ruby.yml +1210 -0
  203. data/db/migrate/20240306175331_rename_editor_images_awesome_config.rb +18 -0
  204. data/db/migrate/20240531224204_add_decidim_awesome_proposal_private_fields.rb +29 -0
  205. data/db/migrate/20240729164227_add_decidim_awesome_proposal_private_fields_date.rb +20 -0
  206. data/db/seeds.rb +3 -3
  207. data/lib/decidim/decidim_awesome/admin_engine.rb +26 -7
  208. data/lib/decidim/decidim_awesome/api/types/localized_custom_fields_type.rb +22 -0
  209. data/lib/decidim/decidim_awesome/api/types/translated_custom_fields_type.rb +51 -0
  210. data/lib/decidim/decidim_awesome/awesome.rb +70 -19
  211. data/lib/decidim/decidim_awesome/awesome_helpers.rb +6 -2
  212. data/lib/decidim/decidim_awesome/checksums.yml +46 -44
  213. data/lib/decidim/decidim_awesome/config.rb +1 -1
  214. data/lib/decidim/decidim_awesome/custom_fields.rb +13 -5
  215. data/lib/decidim/decidim_awesome/engine.rb +165 -56
  216. data/lib/decidim/decidim_awesome/iframe_component/component.rb +1 -2
  217. data/lib/decidim/decidim_awesome/lock.rb +47 -0
  218. data/lib/decidim/decidim_awesome/map_component/component.rb +1 -1
  219. data/lib/decidim/decidim_awesome/menu.rb +165 -0
  220. data/lib/decidim/decidim_awesome/menu_hacker.rb +4 -8
  221. data/lib/decidim/decidim_awesome/system_checker.rb +2 -4
  222. data/lib/decidim/decidim_awesome/test/factories.rb +10 -10
  223. data/lib/decidim/decidim_awesome/test/initializer.rb +7 -12
  224. data/lib/decidim/decidim_awesome/test/layouts/decidim/_head.html.erb +2 -2
  225. data/lib/decidim/decidim_awesome/test/layouts/decidim/admin/_header.html.erb +2 -2
  226. data/lib/decidim/decidim_awesome/test/shared_examples/{box_label_editor.rb → box_label_editor_examples.rb} +17 -17
  227. data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +23 -5
  228. data/lib/decidim/decidim_awesome/test/shared_examples/custom_fields_examples.rb +155 -0
  229. data/lib/decidim/decidim_awesome/test/shared_examples/custom_redirects_contexts.rb +7 -7
  230. data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +42 -58
  231. data/lib/decidim/decidim_awesome/test/shared_examples/menu_hack_contexts.rb +9 -8
  232. data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +32 -24
  233. data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +97 -22
  234. data/lib/decidim/decidim_awesome/version.rb +2 -2
  235. data/lib/decidim/decidim_awesome/voting_manifest.rb +5 -10
  236. data/lib/decidim/decidim_awesome.rb +1 -2
  237. data/lib/tasks/decidim_awesome_active_storage_migrations_tasks.rake +1 -1
  238. data/lib/tasks/decidim_awesome_upgrade_tasks.rake +4 -0
  239. data/package.json +21 -30
  240. metadata +83 -61
  241. data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter/show.erb +0 -15
  242. data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter/vote_button.erb +0 -15
  243. data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter_cell.rb +0 -21
  244. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_modal/show.erb +0 -16
  245. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_modal_cell.rb +0 -20
  246. data/app/cells/decidim/proposals/proposal_m/footer.erb +0 -13
  247. data/app/helpers/decidim/decidim_awesome/amendments_helper_override.rb +0 -48
  248. data/app/helpers/decidim/decidim_awesome/proposals/application_helper_override.rb +0 -78
  249. data/app/overrides/layouts/decidim/_head/add_awesome_legacy_scripts.rb +0 -14
  250. data/app/overrides/layouts/decidim/admin/_application/add_intergram.html.erb.deface +0 -5
  251. data/app/overrides/layouts/decidim/admin/_header/replace_scripts.html.erb.deface +0 -6
  252. data/app/overrides/layouts/decidim/admin/_header/replace_styles.html.erb.deface +0 -3
  253. data/app/packs/entrypoints/decidim_admin_decidim_awesome_custom_fields.js +0 -2
  254. data/app/packs/entrypoints/decidim_decidim_awesome_admin_form_exit_warn.js +0 -1
  255. data/app/packs/src/decidim/decidim_awesome/admin/constraints.js +0 -55
  256. data/app/packs/src/decidim/decidim_awesome/editors/editor.js +0 -218
  257. data/app/packs/src/decidim/decidim_awesome/editors/tabs_focus.js +0 -22
  258. data/app/packs/stylesheets/decidim/decidim_awesome/editors/markdown_editor.scss +0 -19
  259. data/app/packs/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss +0 -58
  260. data/app/packs/stylesheets/vendor/select2-foundation-theme.scss +0 -348
  261. data/app/serializers/concerns/decidim/decidim_awesome/proposal_serializer_override.rb +0 -64
  262. data/app/views/decidim/decidim_awesome/admin/config/_modal.html.erb +0 -11
  263. data/app/views/decidim/decidim_awesome/voting/voting_cards/_proposal_m_cell_footer.erb +0 -15
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module Voting
6
+ # This cell renders metadata for an instance of a Proposal
7
+ class ProposalMetadataCell < ::Decidim::Proposals::ProposalMetadataCell
8
+ private
9
+
10
+ def proposal_items
11
+ [coauthors_item, comments_count_item, endorsements_count_item, weight_count_item, state_item, emendation_item]
12
+ end
13
+
14
+ def current_vote
15
+ @current_vote ||= Decidim::Proposals::ProposalVote.find_by(author: current_user, proposal: resource)
16
+ end
17
+
18
+ def user_voted_weight
19
+ current_vote&.weight
20
+ end
21
+
22
+ def all_weights
23
+ @all_weights ||= begin
24
+ weights = [3, 2, 1]
25
+ weights << 0 if resource.component.settings.voting_cards_show_abstain
26
+ weights.index_with do |weight|
27
+ resource.weight_count(weight)
28
+ end
29
+ end
30
+ end
31
+
32
+ def weight_tags
33
+ @weight_tags ||= all_weights.map do |num, weight|
34
+ content_tag "span", title: resource.manifest.label_for(num), class: "voting-weight_#{num}" do
35
+ "#{t("decidim.decidim_awesome.voting.voting_cards.weights.weight_#{num}_short")} #{weight}"
36
+ end.html_safe
37
+ end
38
+ end
39
+
40
+ def weight_count_item
41
+ return unless resource.respond_to?(:weight_count)
42
+ return if resource.component.current_settings.votes_hidden?
43
+ return if resource&.rejected? || resource&.withdrawn?
44
+
45
+ {
46
+ text: weight_tags.join(" | ").html_safe,
47
+ icon: "#{user_voted_weight ? "checkbox" : "close"}-circle-line",
48
+ data_attributes: all_weights.transform_keys { |num| "weight-#{num}" }
49
+ }
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,18 @@
1
+ <%= decidim_modal id: "voting-cards-modal-help", class:"reveal vote_proposal_modal voting-voting_cards" do %>
2
+ <div data-dialog-container>
3
+ <div class="reveal__content">
4
+ <div class="instructions mb-4"><%= vote_instructions %></div>
5
+ <div class="current-choice voting-voting_cards mb-4">
6
+ <div class="vote-card"></div>
7
+ </div>
8
+ <div class="future-dismiss">
9
+ <%= check_box_tag "voting_cards-skip_help", current_component.id, false %>
10
+ <%= label_tag "voting_cards-skip_help", t("decidim.decidim_awesome.voting.voting_cards.modal.skip") %>
11
+ </div>
12
+ </div>
13
+ </div>
14
+ <div data-dialog-actions>
15
+ <button type="button" class="button button__lg button__primary hover:bg-secondary vote-action" style="background-color: #e02d2d;"><%= t("decidim.decidim_awesome.voting.voting_cards.modal.proceed") %></button>
16
+ <button type="button" class="button button__lg button__transparent-secondary cancel-action hollow secondary" data-dialog-close="voting-cards-modal-help"><%= t("decidim.decidim_awesome.voting.voting_cards.modal.cancel") %></button>
17
+ </div>
18
+ <% end %>
@@ -1,35 +1,40 @@
1
- <h4 class="heading4 vote-title"><%= title %></h4>
1
+ <div class="flex flex-col justify-center awesome-voting-card">
2
+ <h4 class="heading4 vote-title mb-2" style="font-size:1.375rem;"><%= title %></h4>
2
3
 
3
- <div class="flex--sbc">
4
- <%= vote_block_for(proposal, 3) %>
5
- <%= vote_block_for(proposal, 2) %>
6
- <%= vote_block_for(proposal, 1) %>
7
- </div>
4
+ <div class="flex flex-row gap-1.5 mt-4">
5
+ <%= vote_block_for(proposal, 3) %>
6
+ <%= vote_block_for(proposal, 2) %>
7
+ <%= vote_block_for(proposal, 1) %>
8
+ </div>
9
+
10
+ <% if component_settings.voting_cards_show_abstain? %>
11
+ <%= action_authorized_link_to :vote,
12
+ voted_for?(0) ? t("decidim.decidim_awesome.voting.voting_cards.abstained") : proposal.manifest.label_for(0),
13
+ proposal_vote_path(0),
14
+ link_options(0).merge({
15
+ title: t("decidim.decidim_awesome.voting.voting_cards.voting_for", proposal: sanitized_title, type: proposal.manifest.label_for(0)),
16
+ class: "button button__sm button__transparent-secondary mb-4 vote-action abstain-button #{classes_for(0)}"
17
+ }) %>
18
+ <% end %>
8
19
 
9
- <% if component_settings.voting_cards_show_abstain? %>
10
- <%= action_authorized_link_to :vote,
11
- voted_for?(0) ? t("decidim.decidim_awesome.voting.voting_cards.abstained") : proposal.manifest.label_for(0),
12
- proposal_vote_path(0),
13
- link_options(0).merge({
14
- title: t("decidim.decidim_awesome.voting.voting_cards.voting_for", proposal: sanitized_title, type: proposal.manifest.label_for(0)),
15
- class: "button expanded vote-action abstain-button small #{classes_for(0)}"
16
- }) %>
17
- <% end %>
20
+ <% if voted_for_any? && !current_settings.votes_blocked? %>
21
+ <p class="text-center" style="margin-bottom:1rem;">
22
+ <%= action_authorized_link_to :unvote,
23
+ t("decidim.decidim_awesome.voting.voting_cards.change_vote"),
24
+ proposal_vote_path(current_vote&.weight),
25
+ remote: true,
26
+ method: :delete,
27
+ id: "change-vote",
28
+ class: "change-vote-button vote-action font-semibold" %>
29
+ </p>
30
+ <% elsif proposal.maximum_votes_reached? && !proposal.can_accumulate_supports_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %>
31
+ <p class="text-center"><%= t("decidim.proposals.proposals.vote_button.maximum_votes_reached") %></p>
32
+ <% elsif vote_limit_enabled? && remaining_votes_count_for(current_user) <= 0 %>
33
+ <p class="text-center"><%= t("decidim.proposals.proposals.vote_button.no_votes_remaining") %></p>
34
+ <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %>
35
+ <p class="text-center"><%= t("decidim.proposals.proposals.vote_button.votes_blocked") %></p>
36
+ <% end %>
37
+
38
+ </div>
18
39
 
19
- <% if voted_for_any? && !current_settings.votes_blocked? %>
20
- <p class="text-center">
21
- <%= action_authorized_link_to :unvote,
22
- t("decidim.decidim_awesome.voting.voting_cards.change_vote"),
23
- proposal_vote_path(current_vote&.weight),
24
- remote: true,
25
- method: :delete,
26
- id: "change-vote",
27
- class: "change-vote-button vote-action" %>
28
- </p>
29
- <% elsif proposal.maximum_votes_reached? && !proposal.can_accumulate_supports_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %>
30
- <p class="text-center"><%= t("decidim.proposals.proposals.vote_button.maximum_votes_reached") %></p>
31
- <% elsif vote_limit_enabled? && remaining_votes_count_for(current_user) <= 0 %>
32
- <p class="text-center"><%= t("decidim.proposals.proposals.vote_button.no_votes_remaining") %></p>
33
- <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %>
34
- <p class="text-center"><%= t("decidim.proposals.proposals.vote_button.votes_blocked") %></p>
35
- <% end %>
40
+ <%= render :modal if current_component.settings.voting_cards_show_modal_help %>
@@ -12,11 +12,16 @@ module Decidim
12
12
 
13
13
  def vote_block_for(proposal, weight)
14
14
  render partial: "vote_block", locals: {
15
- proposal: proposal,
16
- weight: weight
15
+ proposal:,
16
+ weight:
17
17
  }
18
18
  end
19
19
 
20
+ def vote_instructions
21
+ translated_attribute(current_component.settings.voting_cards_instructions).presence || t("decidim.decidim_awesome.voting.voting_cards.default_instructions_html",
22
+ organization: current_organization.name)
23
+ end
24
+
20
25
  def proposal_votes(weight)
21
26
  model.weight_count(weight)
22
27
  end
@@ -30,7 +35,7 @@ module Decidim
30
35
  end
31
36
 
32
37
  def proposal_vote_path(weight)
33
- proposal_proposal_vote_path(proposal_id: proposal.id, from_proposals_list: from_proposals_list, weight: weight)
38
+ proposal_proposal_vote_path(proposal_id: proposal.id, from_proposals_list:, weight:)
34
39
  end
35
40
 
36
41
  def link_options(weight)
@@ -68,7 +73,7 @@ module Decidim
68
73
  return true
69
74
  end
70
75
 
71
- return true if vote_limit_enabled? && remaining_votes_count_for(current_user) <= 0
76
+ true if vote_limit_enabled? && remaining_votes_count_for(current_user) <= 0
72
77
  end
73
78
 
74
79
  def voted_for_any?
@@ -11,7 +11,7 @@ module Decidim
11
11
  subconfig = AwesomeConfig.find_or_initialize_by(var: "#{var}_#{@ident}", organization: @organization)
12
12
  @constraint = ConfigConstraint.create!(
13
13
  awesome_config: subconfig,
14
- settings: settings
14
+ settings:
15
15
  )
16
16
  end
17
17
 
@@ -20,7 +20,7 @@ module Decidim
20
20
  return true if constraint.awesome_config.constraints.count > 1
21
21
 
22
22
  case constraint.awesome_config.var.to_s
23
- when /^proposal_custom_field/
23
+ when /^proposal_(private_)?custom_field/
24
24
  false
25
25
  else
26
26
  true
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module Proposals
6
+ module Admin
7
+ ##
8
+ # Decorates update draft and update proposal
9
+ # to avoid private field to be logged in PaperTrail.
10
+ module UpdateProposalOverride
11
+ extend ActiveSupport::Concern
12
+
13
+ included do
14
+ private
15
+
16
+ alias_method :decidim_original_update_proposal, :update_proposal
17
+
18
+ def update_proposal
19
+ decidim_original_update_proposal
20
+ update_private_field!
21
+ end
22
+
23
+ def update_private_field!
24
+ @proposal.update_private_body!(form.private_body) if form.private_body.present?
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module Proposals
6
+ ##
7
+ # Decorate create_collaborative_draft to avoid
8
+ # private data to be in PaperTrail
9
+ module CreateCollaborativeDraftOverride
10
+ extend ActiveSupport::Concern
11
+
12
+ included do
13
+ private
14
+
15
+ alias_method :decidim_original_create_collaborative_draft, :create_collaborative_draft
16
+
17
+ def create_collaborative_draft
18
+ created_draft = decidim_original_create_collaborative_draft
19
+ # Update the proposal with the private body, to
20
+ # avoid tracebility on private fields.
21
+ created_draft.update_private_body!(form.private_body) if form.private_body.present?
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module Proposals
6
+ ##
7
+ # Decorate create_proposal to avoid
8
+ # private data to be in PaperTrail
9
+ module CreateProposalOverride
10
+ extend ActiveSupport::Concern
11
+
12
+ included do
13
+ private
14
+
15
+ alias_method :decidim_original_create_proposal, :create_proposal
16
+
17
+ def create_proposal
18
+ created_proposal = decidim_original_create_proposal
19
+ # Update the proposal with the private body, to
20
+ # avoid tracebility on private fields.
21
+ created_proposal.update_private_body!(form.private_body) if form.private_body.present?
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module Proposals
6
+ ##
7
+ # Decorates update draft and update proposal
8
+ # to avoid private field to be logged in PaperTrail.
9
+ module UpdateCollaborativeDraftOverride
10
+ extend ActiveSupport::Concern
11
+
12
+ included do
13
+ private
14
+
15
+ alias_method :decidim_original_update_collaborative_draft, :update_collaborative_draft
16
+
17
+ def update_collaborative_draft
18
+ decidim_original_update_collaborative_draft
19
+ # Update the proposal with the private body, to
20
+ # avoid tracebility on private fields.
21
+ @collaborative_draft.update_private_body!(form.private_body) if form.private_body.present?
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,26 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module Proposals
6
+ ##
7
+ # Decorates update draft and update proposal
8
+ # to avoid private field to be logged in PaperTrail.
9
+ module UpdateProposalOverride
10
+ extend ActiveSupport::Concern
11
+ include Admin::UpdateProposalOverride
12
+
13
+ included do
14
+ private
15
+
16
+ alias_method :decidim_original_update_draft, :update_draft
17
+
18
+ def update_proposal
19
+ decidim_original_update_proposal
20
+ update_private_field!
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -18,7 +18,7 @@ module Decidim
18
18
  #
19
19
  # Returns nothing.
20
20
  def call
21
- return broadcast(:invalid) if form.invalid?
21
+ return broadcast(:invalid, form.errors.full_messages.join(". ")) if form.invalid?
22
22
  return broadcast(:invalid) if attributes.blank?
23
23
 
24
24
  begin
@@ -8,9 +8,10 @@ module Decidim
8
8
 
9
9
  # Public: Initializes the command.
10
10
  #
11
- def initialize(organization)
11
+ def initialize(organization, config_var = :proposal_custom_fields)
12
12
  @organization = organization
13
13
  @ident = rand(36**8).to_s(36)
14
+ @config_var = config_var
14
15
  end
15
16
 
16
17
  # Executes the command. Broadcasts these events:
@@ -20,13 +21,13 @@ module Decidim
20
21
  #
21
22
  # Returns nothing.
22
23
  def call
23
- fields = AwesomeConfig.find_or_initialize_by(var: :proposal_custom_fields, organization: @organization)
24
+ fields = AwesomeConfig.find_or_initialize_by(var: @config_var, organization: @organization)
24
25
  fields.value = {} unless fields.value.is_a? Hash
25
26
  # TODO: prevent (unlikely) colisions with exisiting values
26
27
  fields.value[@ident] = default_definition
27
28
  fields.save!
28
29
 
29
- create_constraint_never(:proposal_custom_field)
30
+ create_constraint_never(@config_var == :proposal_custom_fields ? :proposal_custom_field : :proposal_private_custom_field)
30
31
 
31
32
  broadcast(:ok, @ident)
32
33
  rescue StandardError => e
@@ -11,7 +11,7 @@ module Decidim
11
11
  def initialize(item, organization)
12
12
  @item = item
13
13
  @organization = organization
14
- @redirections = AwesomeConfig.find_by(var: :custom_redirects, organization: organization)
14
+ @redirections = AwesomeConfig.find_by(var: :custom_redirects, organization:)
15
15
  end
16
16
 
17
17
  # Executes the command. Broadcasts these events:
@@ -11,7 +11,7 @@ module Decidim
11
11
  def initialize(item, menu_name, organization)
12
12
  @item = item
13
13
  @organization = organization
14
- @menu = AwesomeConfig.find_by(var: menu_name, organization: organization)
14
+ @menu = AwesomeConfig.find_by(var: menu_name, organization:)
15
15
  end
16
16
 
17
17
  # Executes the command. Broadcasts these events:
@@ -8,9 +8,10 @@ module Decidim
8
8
  #
9
9
  # key - the key to destroy inise proposal_custom_fields
10
10
  # organization
11
- def initialize(key, organization)
11
+ def initialize(key, organization, config_var = :proposal_custom_fields)
12
12
  @key = key
13
13
  @organization = organization
14
+ @config_var = config_var
14
15
  end
15
16
 
16
17
  # Executes the command. Broadcasts these events:
@@ -20,14 +21,16 @@ module Decidim
20
21
  #
21
22
  # Returns nothing.
22
23
  def call
23
- fields = AwesomeConfig.find_by(var: :proposal_custom_fields, organization: @organization)
24
+ fields = AwesomeConfig.find_by(var: @config_var, organization: @organization)
24
25
  return broadcast(:invalid, "Not a hash") unless fields&.value.is_a? Hash
25
26
  return broadcast(:invalid, "#{key} key invalid") unless fields.value.has_key?(@key)
26
27
 
27
28
  fields.value.except!(@key)
28
29
  fields.save!
30
+
29
31
  # remove constrains associated (a new config var is generated automatically, by removing it, it will trigger destroy on dependents)
30
- constraint = AwesomeConfig.find_by(var: "proposal_custom_field_#{@key}", organization: @organization)
32
+ constraint = @config_var == :proposal_custom_fields ? :proposal_custom_field : :proposal_private_custom_field
33
+ constraint = AwesomeConfig.find_by(var: "#{constraint}_#{@key}", organization: @organization)
31
34
  constraint.destroy! if constraint.present?
32
35
 
33
36
  broadcast(:ok, @key)
@@ -34,7 +34,7 @@ module Decidim
34
34
  end
35
35
  end
36
36
 
37
- broadcast(:ok, { scope: scope, key: @text })
37
+ broadcast(:ok, { scope:, key: @text })
38
38
  rescue StandardError => e
39
39
  broadcast(:invalid, e.message)
40
40
  end
@@ -18,7 +18,7 @@ module Decidim
18
18
  #
19
19
  # Returns nothing.
20
20
  def call
21
- return broadcast(:invalid) if form.invalid?
21
+ return broadcast(:invalid, form.errors.full_messages.join(". ")) if form.invalid?
22
22
  return broadcast(:invalid) if attributes.blank?
23
23
 
24
24
  begin
@@ -38,8 +38,8 @@ module Decidim
38
38
  delegate :to_params, to: :form
39
39
 
40
40
  def url_exists?
41
- return unless redirects
42
- return unless redirects.value.is_a? Hash
41
+ return false unless redirects
42
+ return false unless redirects.value.is_a? Hash
43
43
 
44
44
  redirects.value[item.origin].present?
45
45
  end
@@ -2,13 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module DecidimAwesome
5
- # maintains compatibility with v0.26 which uses Rectify
6
- if defined? ::Decidim::Command
7
- class Command < ::Decidim::Command
8
- end
9
- else
10
- class Command < ::Rectify::Command
11
- end
5
+ class Command < ::Decidim::Command
12
6
  end
13
7
  end
14
8
  end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module Admin
6
+ module MaintenanceContext
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+ layout "decidim/decidim_awesome/admin/maintenance"
11
+ helper_method :current_view, :available_views, :present_private_data
12
+
13
+ private
14
+
15
+ def present_private_data(model)
16
+ PrivateDataPresenter.new(model)
17
+ end
18
+
19
+ def current_view
20
+ return params[:id] if available_views.include?(params[:id])
21
+
22
+ available_views.keys.first
23
+ end
24
+
25
+ def available_views
26
+ {
27
+ "private_data" => {
28
+ title: I18n.t("private_data", scope: "decidim.decidim_awesome.admin.menu.maintenance"),
29
+ icon: "spy-line",
30
+ path: decidim_admin_decidim_awesome.maintenance_path("private_data")
31
+ },
32
+ "checks" => {
33
+ title: I18n.t("checks", scope: "decidim.decidim_awesome.admin.menu.maintenance"),
34
+ icon: "pulse",
35
+ path: decidim_admin_decidim_awesome.checks_maintenance_index_path
36
+ }
37
+ }
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -18,7 +18,7 @@ module Decidim
18
18
  concat "#{i18n_filter_label(:admin_role_type, filterable_i18n_scope_from_ctx(i18n_ctx))}: "
19
19
  concat t("decidim.decidim_awesome.admin.admin_accountability.admin_roles.#{params[:admin_role_type]}", default: params[:admin_role_type])
20
20
  concat icon_link_to(
21
- "circle-x",
21
+ "close-circle-line",
22
22
  url_for(export_params.except(:admin_role_type)),
23
23
  t("decidim.admin.actions.cancel"),
24
24
  class: "action-icon--remove"
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module ContentSecurityPolicy
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ after_action :append_awesome_csp_directives
10
+ end
11
+
12
+ private
13
+
14
+ def append_awesome_csp_directives
15
+ # this is necessary for custom fields
16
+ content_security_policy.append_csp_directive("font-src", "data:") if DecidimAwesome.enabled?(:proposal_custom_fields)
17
+ append_awesome_intergram_directives
18
+ end
19
+
20
+ def append_awesome_intergram_directives
21
+ return unless DecidimAwesome.enabled?(:intergram_for_admins) || DecidimAwesome.enabled?(:intergram_for_public)
22
+
23
+ intergram = URI.parse(DecidimAwesome.intergram_url)
24
+ if intergram.host && intergram.scheme
25
+ content_security_policy.append_csp_directive("script-src", "#{intergram.scheme}://#{intergram.host}")
26
+ content_security_policy.append_csp_directive("frame-src", "#{intergram.scheme}://#{intergram.host}")
27
+ # this script is in the intergram code, but does not look necessary to work
28
+ # content_security_policy.append_csp_directive("frame-src", "http://www.loadmill.com")
29
+ # content_security_policy.append_csp_directive("frame-src", "http://app.loadmill.com")
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module LimitPendingAmendments
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ # rubocop:disable Rails/LexicallyScopedActionFilter
10
+ before_action :limit_pending_amendments, only: [:new, :create]
11
+ # rubocop:enable Rails/LexicallyScopedActionFilter
12
+
13
+ private
14
+
15
+ def limit_pending_amendments
16
+ return unless amendable&.amendments && amendable&.component&.settings.try(:limit_pending_amendments)
17
+ return unless amendable.component.settings.try(:amendments_enabled)
18
+ return unless amendable.component.current_settings.try(:amendment_creation_enabled)
19
+
20
+ return unless existing_emendations.any?
21
+
22
+ flash[:alert] = t("pending_limit_reached", scope: "decidim.decidim_awesome.amendments", emendation: translated_attribute(existing_emendations.first.title))
23
+ redirect_back(fallback_location: Decidim::ResourceLocatorPresenter.new(amendable).path)
24
+ end
25
+
26
+ def existing_emendations
27
+ @existing_emendations ||= begin
28
+ existing = amendable.amendments.where(state: :evaluating)
29
+ existing.filter_map { |amendment| !amendment.emendation&.hidden? && amendment.emendation }
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -50,7 +50,7 @@ module Decidim
50
50
  destination = "#{destination}#{union}#{query}"
51
51
  end
52
52
 
53
- return destination.strip if destination.present?
53
+ destination.strip if destination.present?
54
54
  end
55
55
  end
56
56
  end
@@ -13,7 +13,7 @@ module Decidim
13
13
  # rubocop:enable Rails/LexicallyScopedActionFilter
14
14
 
15
15
  def create
16
- enforce_permission_to :vote, :proposal, proposal: proposal
16
+ enforce_permission_to(:vote, :proposal, proposal:)
17
17
  @from_proposals_list = params[:from_proposals_list] == "true"
18
18
 
19
19
  Decidim::Proposals::VoteProposal.call(proposal, current_user) do
@@ -27,7 +27,7 @@ module Decidim
27
27
  proposal: Decidim::Proposals::Proposal.where(component: current_component)
28
28
  ).map(&:proposal)
29
29
 
30
- expose(proposals: proposals)
30
+ expose(proposals:)
31
31
  render :update_buttons_and_counters
32
32
  end
33
33
 
@@ -47,7 +47,7 @@ module Decidim
47
47
  end
48
48
 
49
49
  def current_vote
50
- @current_vote ||= Decidim::Proposals::ProposalVote.find_by(author: current_user, proposal: proposal)
50
+ @current_vote ||= Decidim::Proposals::ProposalVote.find_by(author: current_user, proposal:)
51
51
  end
52
52
 
53
53
  def vote_manifest
@@ -9,6 +9,8 @@ module Decidim
9
9
  # Note that it inherits from `Decidim::Admin::Components::BaseController`, which
10
10
  # override its layout and provide all kinds of useful methods.
11
11
  class ApplicationController < Decidim::Admin::ApplicationController
12
+ layout "decidim/decidim_awesome/admin/application"
13
+
12
14
  def permission_class_chain
13
15
  [::Decidim::DecidimAwesome::Admin::Permissions] + super
14
16
  end