decidim-decidim_awesome 0.10.2 → 0.11.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (265) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +34 -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_l_cell_override.rb +24 -0
  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 +4 -3
  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/orderable_override.rb +9 -22
  33. data/app/controllers/concerns/decidim/decidim_awesome/proposals/proposal_votes_controller_override.rb +3 -3
  34. data/app/controllers/decidim/decidim_awesome/admin/admin_accountability_controller.rb +7 -7
  35. data/app/controllers/decidim/decidim_awesome/admin/application_controller.rb +2 -0
  36. data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +14 -10
  37. data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +10 -9
  38. data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +23 -20
  39. data/app/controllers/decidim/decidim_awesome/admin/custom_redirects_controller.rb +6 -10
  40. data/app/controllers/decidim/decidim_awesome/admin/maintenance_controller.rb +76 -0
  41. data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +6 -10
  42. data/app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb +14 -6
  43. data/app/controllers/decidim/decidim_awesome/admin/scoped_admins_controller.rb +2 -2
  44. data/app/controllers/decidim/decidim_awesome/admin/scoped_styles_controller.rb +2 -2
  45. data/app/controllers/decidim/decidim_awesome/blank_component_controller.rb +8 -3
  46. data/app/controllers/decidim/decidim_awesome/editor_images_controller.rb +3 -3
  47. data/app/controllers/decidim/decidim_awesome/iframe_component/iframe_controller.rb +18 -5
  48. data/app/forms/concerns/decidim/decidim_awesome/proposals/proposal_form_override.rb +21 -0
  49. data/app/forms/{decidim → concerns/decidim}/decidim_awesome/proposals/proposal_wizard_create_step_form_override.rb +2 -1
  50. data/app/forms/decidim/decidim_awesome/admin/config_form.rb +28 -14
  51. data/app/forms/decidim/decidim_awesome/admin/custom_redirect_form.rb +2 -2
  52. data/app/forms/decidim/decidim_awesome/admin/intergram_form.rb +4 -0
  53. data/app/forms/decidim/decidim_awesome/admin/menu_form.rb +4 -4
  54. data/app/helpers/concerns/decidim/decidim_awesome/amendments_helper_override.rb +65 -0
  55. data/app/helpers/concerns/decidim/decidim_awesome/breadcrumb_helper_override.rb +23 -0
  56. data/app/helpers/concerns/decidim/decidim_awesome/proposals/application_helper_override.rb +110 -0
  57. data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +6 -27
  58. data/app/helpers/decidim/decidim_awesome/map_helper.rb +8 -27
  59. data/app/jobs/decidim/decidim_awesome/destroy_private_data_job.rb +22 -0
  60. data/app/jobs/decidim/decidim_awesome/migrate_legacy_images_job.rb +5 -4
  61. data/app/middleware/decidim/decidim_awesome/current_config.rb +3 -5
  62. data/app/models/concerns/decidim/decidim_awesome/has_proposal_extra_fields.rb +39 -10
  63. data/app/models/decidim/decidim_awesome/awesome_config.rb +1 -1
  64. data/app/models/decidim/decidim_awesome/paper_trail_version.rb +8 -4
  65. data/app/models/decidim/decidim_awesome/proposal_extra_field.rb +35 -1
  66. data/app/models/decidim/decidim_awesome/vote_weight.rb +2 -2
  67. data/app/overrides/decidim/proposals/admin/proposals/show/add_private_body.html.erb.deface +7 -0
  68. data/app/overrides/decidim/proposals/admin/proposals/show/replace_body.html.erb.deface +5 -0
  69. data/app/overrides/decidim/proposals/proposals/_proposal_aside/limit_amendments_modal.html.erb.deface +5 -0
  70. data/app/overrides/decidim/proposals/proposals/_vote_button/replace_vote_button.html.erb.deface +1 -1
  71. data/app/overrides/layouts/decidim/_decidim_javascript/add_awesome_tags.html.erb.deface +6 -0
  72. data/app/overrides/layouts/decidim/_head/add_awesome_tags.html.erb.deface +4 -11
  73. data/app/overrides/layouts/decidim/admin/_header/{replace_scripts.html.erb.deface → add_awesome_tags.html.erb.deface} +4 -4
  74. data/app/packs/entrypoints/decidim_admin_decidim_awesome.js +1 -2
  75. data/app/packs/entrypoints/decidim_admin_decidim_awesome_global.js +4 -0
  76. data/app/packs/entrypoints/decidim_admin_decidim_awesome_global.scss +1 -0
  77. data/app/packs/entrypoints/decidim_decidim_awesome.js +2 -2
  78. data/app/packs/entrypoints/decidim_decidim_awesome_map.scss +1 -1
  79. data/app/packs/entrypoints/decidim_editor.js +14 -0
  80. data/app/packs/src/decidim/decidim_awesome/admin/auto_edit.js +96 -69
  81. data/app/packs/src/decidim/decidim_awesome/admin/check_redirections.js +46 -41
  82. data/app/packs/src/decidim/decidim_awesome/admin/codemirror.js +3 -3
  83. data/app/packs/src/decidim/decidim_awesome/admin/constraint_form_events.js +115 -0
  84. data/app/packs/src/decidim/decidim_awesome/admin/custom_fields_builder.js +9 -5
  85. data/app/packs/src/decidim/decidim_awesome/admin/form_exit_warn.js +22 -11
  86. data/app/packs/src/decidim/decidim_awesome/admin/proposal_sortings.js +26 -8
  87. data/app/packs/src/decidim/decidim_awesome/admin/tabs_change.js +31 -0
  88. data/app/packs/src/decidim/decidim_awesome/admin/user_picker.js +34 -21
  89. data/app/packs/src/decidim/decidim_awesome/amendments/show_modal_on_limits.js +28 -0
  90. data/app/packs/src/decidim/decidim_awesome/awesome_admin.js +5 -16
  91. data/app/packs/src/decidim/decidim_awesome/awesome_admin_global.js +1 -0
  92. data/app/packs/src/decidim/decidim_awesome/awesome_application.js +1 -15
  93. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/fetcher.js +33 -11
  94. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/meetings_fetcher.js +9 -12
  95. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/proposals_fetcher.js +28 -0
  96. data/app/packs/src/decidim/decidim_awesome/awesome_map/awesome_map.js +3 -4
  97. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/controller.js +12 -12
  98. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/meetings_controller.js +11 -7
  99. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/proposals_controller.js +6 -13
  100. data/app/packs/src/decidim/decidim_awesome/awesome_map/controls_ui.js +51 -20
  101. data/app/packs/src/decidim/decidim_awesome/awesome_map/load_map.js +27 -18
  102. data/app/packs/src/decidim/decidim_awesome/editor/index.js +94 -0
  103. data/app/packs/src/decidim/decidim_awesome/forms/autosave.js +28 -23
  104. data/app/packs/src/decidim/decidim_awesome/forms/custom_fields_renderer.js +29 -25
  105. data/app/packs/src/decidim/decidim_awesome/forms/rich_text_plugin.js +27 -32
  106. data/app/packs/src/decidim/decidim_awesome/proposals/custom_fields.js +31 -15
  107. data/app/packs/src/decidim/decidim_awesome/proposals/images.js +16 -10
  108. data/app/packs/src/decidim/decidim_awesome/voting/voting_cards.js +47 -38
  109. data/app/packs/stylesheets/decidim/decidim_awesome/admin/auto_edits.scss +11 -12
  110. data/app/packs/stylesheets/decidim/decidim_awesome/admin/check_redirections.scss +15 -0
  111. data/app/packs/stylesheets/decidim/decidim_awesome/admin/codemirror.scss +24 -12
  112. data/app/packs/stylesheets/decidim/decidim_awesome/admin/constraints.scss +49 -29
  113. data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_fields.scss +28 -71
  114. data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_styles.scss +48 -0
  115. data/app/packs/stylesheets/decidim/decidim_awesome/admin/intergram_fixes.scss +11 -0
  116. data/app/packs/stylesheets/decidim/decidim_awesome/admin/user_picker.scss +17 -26
  117. data/app/packs/stylesheets/decidim/decidim_awesome/amendments/modal.scss +5 -0
  118. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin.scss +11 -49
  119. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss +19 -0
  120. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_application.scss +4 -19
  121. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_iframe/iframe.scss +1 -1
  122. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_map/map.scss +41 -35
  123. data/app/packs/stylesheets/decidim/decidim_awesome/forms/autosave.scss +6 -6
  124. data/app/packs/stylesheets/decidim/decidim_awesome/forms/custom_fields.scss +118 -0
  125. data/app/packs/stylesheets/decidim/decidim_awesome/shared/spinner.scss +26 -0
  126. data/app/packs/stylesheets/decidim/decidim_awesome/voting/voting_cards.scss +41 -59
  127. data/app/permissions/decidim/decidim_awesome/admin/permissions.rb +14 -3
  128. data/app/permissions/decidim/decidim_awesome/permissions.rb +3 -4
  129. data/app/presenters/concerns/decidim/decidim_awesome/breadcrumb_root_menu_item_presenter_override.rb +23 -0
  130. data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_item_presenter_override.rb +10 -2
  131. data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_presenter_override.rb +8 -0
  132. data/app/presenters/concerns/decidim/decidim_awesome/proposals/proposal_presenter_override.rb +20 -0
  133. data/app/presenters/decidim/decidim_awesome/admin_log/component_presenter_override.rb +30 -0
  134. data/app/presenters/decidim/decidim_awesome/participatory_space_role_presenter.rb +1 -1
  135. data/app/presenters/decidim/decidim_awesome/private_data_presenter.rb +70 -0
  136. data/app/presenters/decidim/decidim_awesome/user_entity_presenter.rb +1 -1
  137. data/app/queries/decidim/decidim_awesome/private_data_finder.rb +19 -0
  138. data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_methods.rb +72 -0
  139. data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_override.rb +38 -0
  140. data/app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb +34 -0
  141. data/app/types/concerns/decidim/decidim_awesome/add_proposal_type_custom_fields.rb +59 -0
  142. data/app/types/concerns/decidim/decidim_awesome/{proposal_type_override.rb → add_proposal_type_vote_weights.rb} +3 -1
  143. data/app/views/decidim/decidim_awesome/admin/admin_accountability/index.html.erb +23 -17
  144. data/app/views/decidim/decidim_awesome/admin/checks/index.html.erb +50 -48
  145. data/app/views/decidim/decidim_awesome/admin/config/_autoedit_box_label.html.erb +7 -2
  146. data/app/views/decidim/decidim_awesome/admin/config/_constraints.html.erb +25 -18
  147. data/app/views/decidim/decidim_awesome/admin/config/_form_admins.html.erb +7 -6
  148. data/app/views/decidim/decidim_awesome/admin/config/_form_editors.html.erb +12 -16
  149. data/app/views/decidim/decidim_awesome/admin/config/_form_livechat.html.erb +39 -23
  150. data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_custom_fields.html.erb +35 -17
  151. data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_private_custom_fields.html.erb +1 -0
  152. data/app/views/decidim/decidim_awesome/admin/config/_form_proposals.html.erb +68 -80
  153. data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +16 -12
  154. data/app/views/decidim/decidim_awesome/admin/config/_form_surveys.html.erb +8 -6
  155. data/app/views/decidim/decidim_awesome/admin/config/show.html.erb +22 -12
  156. data/app/views/decidim/decidim_awesome/admin/constraints/_form.html.erb +1 -49
  157. data/app/views/decidim/decidim_awesome/admin/constraints/new.html.erb +14 -9
  158. data/app/views/decidim/decidim_awesome/admin/constraints/show.html.erb +14 -9
  159. data/app/views/decidim/decidim_awesome/admin/custom_redirects/_form.html.erb +20 -5
  160. data/app/views/decidim/decidim_awesome/admin/custom_redirects/edit.html.erb +5 -5
  161. data/app/views/decidim/decidim_awesome/admin/custom_redirects/index.html.erb +14 -13
  162. data/app/views/decidim/decidim_awesome/admin/custom_redirects/new.html.erb +5 -5
  163. data/app/views/decidim/decidim_awesome/admin/maintenance/_private_data.html.erb +44 -0
  164. data/app/views/decidim/decidim_awesome/admin/maintenance/show.html.erb +44 -0
  165. data/app/views/decidim/decidim_awesome/admin/menu_hacks/_form.html.erb +6 -6
  166. data/app/views/decidim/decidim_awesome/admin/menu_hacks/edit.html.erb +21 -12
  167. data/app/views/decidim/decidim_awesome/admin/menu_hacks/index.html.erb +39 -42
  168. data/app/views/decidim/decidim_awesome/admin/menu_hacks/new.html.erb +21 -12
  169. data/app/views/decidim/decidim_awesome/admin/proposals/_editor.html.erb +8 -5
  170. data/app/views/decidim/decidim_awesome/admin/proposals/_private_body.html.erb +20 -0
  171. data/app/views/decidim/decidim_awesome/admin/shared/_filters_with_date.html.erb +14 -18
  172. data/app/views/decidim/decidim_awesome/amendments/_modal.html.erb +23 -0
  173. data/app/views/decidim/decidim_awesome/custom_fields/_form_render.html.erb +8 -2
  174. data/app/views/decidim/decidim_awesome/iframe_component/iframe/show.html.erb +7 -12
  175. data/app/views/decidim/decidim_awesome/map_component/map/_map_template.html.erb +53 -37
  176. data/app/views/decidim/decidim_awesome/map_component/map/show.html.erb +14 -5
  177. data/app/views/decidim/decidim_awesome/voting/voting_cards/_show_vote_button.html.erb +0 -3
  178. data/app/views/layouts/decidim/decidim_awesome/_awesome_config.html.erb +9 -7
  179. data/app/views/layouts/decidim/decidim_awesome/_intergram_widget.html.erb +9 -6
  180. data/app/views/layouts/decidim/decidim_awesome/admin/_base.html.erb +12 -0
  181. data/app/views/layouts/decidim/decidim_awesome/admin/application.html.erb +1 -73
  182. data/app/views/layouts/decidim/decidim_awesome/admin/maintenance.html.erb +19 -0
  183. data/config/assets.rb +3 -33
  184. data/config/i18n-tasks.yml +23 -3
  185. data/config/locales/ca.yml +110 -23
  186. data/config/locales/cs.yml +121 -19
  187. data/config/locales/de.yml +61 -20
  188. data/config/locales/en.yml +125 -35
  189. data/config/locales/es.yml +109 -22
  190. data/config/locales/eu.yml +22 -5
  191. data/config/locales/fr.yml +107 -20
  192. data/config/locales/hu.yml +53 -12
  193. data/config/locales/it.yml +22 -20
  194. data/config/locales/ja.yml +107 -20
  195. data/config/locales/lt.yml +0 -8
  196. data/config/locales/nl.yml +16 -17
  197. data/config/locales/pt-BR.yml +23 -20
  198. data/config/locales/pt-PT.yml +0 -1
  199. data/config/locales/ro-RO.yml +11 -7
  200. data/config/locales/sv.yml +24 -13
  201. data/config/rubocop/disabled.yml +11 -0
  202. data/config/rubocop/faker.yml +480 -0
  203. data/config/rubocop/rails.yml +88 -0
  204. data/config/rubocop/rspec.yml +65 -0
  205. data/config/rubocop/ruby.yml +1210 -0
  206. data/db/migrate/20240306175331_rename_editor_images_awesome_config.rb +18 -0
  207. data/db/migrate/20240531224204_add_decidim_awesome_proposal_private_fields.rb +29 -0
  208. data/db/migrate/20240729164227_add_decidim_awesome_proposal_private_fields_date.rb +20 -0
  209. data/db/seeds.rb +3 -3
  210. data/lib/decidim/decidim_awesome/admin_engine.rb +26 -7
  211. data/lib/decidim/decidim_awesome/api/types/localized_custom_fields_type.rb +22 -0
  212. data/lib/decidim/decidim_awesome/api/types/translated_custom_fields_type.rb +51 -0
  213. data/lib/decidim/decidim_awesome/awesome.rb +74 -23
  214. data/lib/decidim/decidim_awesome/awesome_helpers.rb +6 -2
  215. data/lib/decidim/decidim_awesome/checksums.yml +47 -44
  216. data/lib/decidim/decidim_awesome/config.rb +1 -1
  217. data/lib/decidim/decidim_awesome/custom_fields.rb +13 -5
  218. data/lib/decidim/decidim_awesome/engine.rb +165 -56
  219. data/lib/decidim/decidim_awesome/iframe_component/component.rb +1 -2
  220. data/lib/decidim/decidim_awesome/lock.rb +47 -0
  221. data/lib/decidim/decidim_awesome/map_component/component.rb +1 -1
  222. data/lib/decidim/decidim_awesome/menu.rb +165 -0
  223. data/lib/decidim/decidim_awesome/menu_hacker.rb +4 -8
  224. data/lib/decidim/decidim_awesome/system_checker.rb +2 -4
  225. data/lib/decidim/decidim_awesome/test/factories.rb +10 -10
  226. data/lib/decidim/decidim_awesome/test/initializer.rb +7 -12
  227. data/lib/decidim/decidim_awesome/test/layouts/decidim/_head.html.erb +2 -2
  228. data/lib/decidim/decidim_awesome/test/layouts/decidim/admin/_header.html.erb +2 -2
  229. data/lib/decidim/decidim_awesome/test/shared_examples/{box_label_editor.rb → box_label_editor_examples.rb} +17 -17
  230. data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +23 -5
  231. data/lib/decidim/decidim_awesome/test/shared_examples/custom_fields_examples.rb +155 -0
  232. data/lib/decidim/decidim_awesome/test/shared_examples/custom_redirects_contexts.rb +7 -7
  233. data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +42 -58
  234. data/lib/decidim/decidim_awesome/test/shared_examples/menu_hack_contexts.rb +9 -8
  235. data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +32 -24
  236. data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +97 -22
  237. data/lib/decidim/decidim_awesome/version.rb +2 -2
  238. data/lib/decidim/decidim_awesome/voting_manifest.rb +5 -10
  239. data/lib/decidim/decidim_awesome.rb +1 -2
  240. data/lib/tasks/decidim_awesome_active_storage_migrations_tasks.rake +1 -1
  241. data/lib/tasks/decidim_awesome_upgrade_tasks.rake +4 -0
  242. data/package.json +21 -30
  243. metadata +86 -63
  244. data/app/cells/concerns/decidim/decidim_awesome/proposal_m_cell_override.rb +0 -38
  245. data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter/show.erb +0 -15
  246. data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter/vote_button.erb +0 -15
  247. data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter_cell.rb +0 -21
  248. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_modal/show.erb +0 -16
  249. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_modal_cell.rb +0 -20
  250. data/app/cells/decidim/proposals/proposal_m/footer.erb +0 -13
  251. data/app/helpers/decidim/decidim_awesome/amendments_helper_override.rb +0 -48
  252. data/app/helpers/decidim/decidim_awesome/proposals/application_helper_override.rb +0 -78
  253. data/app/overrides/layouts/decidim/_head/add_awesome_legacy_scripts.rb +0 -14
  254. data/app/overrides/layouts/decidim/admin/_header/replace_styles.html.erb.deface +0 -3
  255. data/app/packs/entrypoints/decidim_admin_decidim_awesome_custom_fields.js +0 -2
  256. data/app/packs/entrypoints/decidim_decidim_awesome_admin_form_exit_warn.js +0 -1
  257. data/app/packs/src/decidim/decidim_awesome/admin/constraints.js +0 -55
  258. data/app/packs/src/decidim/decidim_awesome/editors/editor.js +0 -218
  259. data/app/packs/src/decidim/decidim_awesome/editors/tabs_focus.js +0 -22
  260. data/app/packs/stylesheets/decidim/decidim_awesome/editors/markdown_editor.scss +0 -19
  261. data/app/packs/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss +0 -58
  262. data/app/packs/stylesheets/vendor/select2-foundation-theme.scss +0 -348
  263. data/app/serializers/concerns/decidim/decidim_awesome/proposal_serializer_override.rb +0 -64
  264. data/app/views/decidim/decidim_awesome/admin/config/_modal.html.erb +0 -11
  265. data/app/views/decidim/decidim_awesome/voting/voting_cards/_proposal_m_cell_footer.erb +0 -15
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module Proposals
6
+ module ProposalFormOverride
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+ alias_method :decidim_original_map_model, :map_model
11
+ attribute :private_body, String
12
+
13
+ def map_model(model)
14
+ decidim_original_map_model(model)
15
+ self.private_body = model.private_body
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -15,6 +15,7 @@ module Decidim
15
15
  minimum: ->(form) { form.minimum_title_length },
16
16
  maximum: 150
17
17
  }
18
+
18
19
  validates :body, presence: true, unless: ->(form) { form.override_validations? || form.minimum_body_length.zero? }
19
20
  validates :body, etiquette: true, unless: ->(form) { form.override_validations? }
20
21
  validates :body, proposal_length: {
@@ -27,7 +28,7 @@ module Decidim
27
28
  def override_validations?
28
29
  return false if context.current_component.settings.participatory_texts_enabled
29
30
 
30
- custom_fields.present? || awesome_config.enabled_in_context?(:use_markdown_editor)
31
+ custom_fields.present?
31
32
  end
32
33
 
33
34
  def minimum_title_length
@@ -8,16 +8,15 @@ module Decidim
8
8
  class ConfigForm < Decidim::Form
9
9
  include ActionView::Helpers::SanitizeHelper
10
10
 
11
- attribute :allow_images_in_full_editor, Boolean
12
- attribute :allow_images_in_small_editor, Boolean
11
+ attribute :allow_images_in_editors, Boolean
12
+ attribute :allow_videos_in_editors, Boolean
13
13
  attribute :allow_images_in_proposals, Boolean
14
- attribute :use_markdown_editor, Boolean
15
- attribute :allow_images_in_markdown_editor, Boolean
16
14
  attribute :auto_save_forms, Boolean
17
15
  attribute :scoped_styles, Hash
18
16
  attribute :proposal_custom_fields, Hash
17
+ attribute :proposal_private_custom_fields, Hash
19
18
  attribute :scoped_admins, Hash
20
- attribute :menu, Array[MenuForm]
19
+ attribute :menu, [MenuForm]
21
20
  attribute :intergram_for_admins, Boolean
22
21
  attribute :intergram_for_admins_settings, IntergramForm
23
22
  attribute :intergram_for_public, Boolean
@@ -36,7 +35,8 @@ module Decidim
36
35
  attr_accessor :valid_keys
37
36
 
38
37
  validate :css_syntax, if: ->(form) { form.scoped_styles.present? }
39
- validate :json_syntax, if: ->(form) { form.proposal_custom_fields.present? }
38
+ validate :json_syntax
39
+
40
40
  validates :validate_title_min_length, presence: true, numericality: { greater_than_or_equal_to: 1, less_than_or_equal_to: 100 }
41
41
  validates :validate_title_max_caps_percent, presence: true, numericality: { greater_than_or_equal_to: 0, less_than_or_equal_to: 100 }
42
42
  validates :validate_title_max_marks_together, presence: true, numericality: { greater_than_or_equal_to: 1 }
@@ -65,26 +65,27 @@ module Decidim
65
65
 
66
66
  SassC::Engine.new(code).render
67
67
  rescue SassC::SyntaxError => e
68
- errors.add(:scoped_styles, I18n.t("config.form.errors.incorrect_css", key: key, scope: "decidim.decidim_awesome.admin"))
68
+ errors.add(:scoped_styles, I18n.t("config.form.errors.incorrect_css", key:, scope: "decidim.decidim_awesome.admin"))
69
69
  errors.add(key.to_sym, e.message)
70
70
  end
71
71
  end
72
72
 
73
73
  def json_syntax
74
- proposal_custom_fields.each do |key, code|
75
- next unless code
74
+ fields = {}
75
+ fields.merge!(proposal_custom_fields: proposal_custom_fields.values) if proposal_custom_fields.present?
76
+ fields.merge!(proposal_private_custom_fields: proposal_private_custom_fields.values) if proposal_private_custom_fields.present?
77
+ fields.each do |key, values|
78
+ next if values.blank?
76
79
 
77
- JSON.parse(code)
78
- rescue JSON::ParserError => e
79
- errors.add(:scoped_styles, I18n.t("config.form.errors.incorrect_json", key: key, scope: "decidim.decidim_awesome.admin"))
80
+ values.each { |code| JSON.parse(code) }
81
+ rescue JSON::JSONError => e
82
+ errors.add(key, I18n.t("config.form.errors.incorrect_json", key:, scope: "decidim.decidim_awesome.admin"))
80
83
  errors.add(key.to_sym, e.message)
81
84
  end
82
85
  end
83
86
 
84
87
  # formBuilder has a bug and do not sanitize text if users copy/paste text with format in the label input
85
88
  def sanitize_labels!
86
- return unless proposal_custom_fields
87
-
88
89
  proposal_custom_fields.transform_values! do |code|
89
90
  next unless code
90
91
 
@@ -97,6 +98,19 @@ module Decidim
97
98
  rescue JSON::ParserError
98
99
  code
99
100
  end
101
+
102
+ proposal_private_custom_fields.transform_values! do |code|
103
+ next unless code
104
+
105
+ json = JSON.parse(code)
106
+ json.map! do |item|
107
+ item["label"] = strip_tags(item["label"])
108
+ item
109
+ end
110
+ JSON.generate(json)
111
+ rescue JSON::ParserError
112
+ code
113
+ end
100
114
  end
101
115
  end
102
116
  end
@@ -18,8 +18,8 @@ module Decidim
18
18
  sanitize_url(origin),
19
19
  {
20
20
  destination: sanitize_url(destination, strip_host: false),
21
- active: active,
22
- pass_query: pass_query
21
+ active:,
22
+ pass_query:
23
23
  }
24
24
  ]
25
25
  end
@@ -13,6 +13,10 @@ module Decidim
13
13
  attribute :intro_message, String
14
14
  attribute :auto_response, String
15
15
  attribute :auto_no_response, String
16
+
17
+ def color
18
+ super || current_organization.colors["secondary"] || "#E91E63"
19
+ end
16
20
  end
17
21
  end
18
22
  end
@@ -27,10 +27,10 @@ module Decidim
27
27
  def to_params
28
28
  {
29
29
  label: raw_label,
30
- position: position,
31
- url: url,
32
- target: target,
33
- visibility: visibility
30
+ position:,
31
+ url:,
32
+ target:,
33
+ visibility:
34
34
  }
35
35
  end
36
36
  end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module AmendmentsHelperOverride
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ # original method
10
+ alias_method :decidim_amendments_form_field_for, :amendments_form_field_for
11
+
12
+ # override with custom fields if scope applies
13
+ def amendments_form_field_for(attribute, form, original_resource)
14
+ custom_fields, custom_private_fields = awesome_custom_fields(attribute, form)
15
+ content = if custom_fields.blank?
16
+ decidim_amendments_form_field_for(attribute, form, original_resource)
17
+ else
18
+ render_amendment_custom_fields_override(custom_fields, attribute, form, original_resource)
19
+ end
20
+ if custom_private_fields.present?
21
+ content = content_tag("div", content)
22
+ content += content_tag("div", render_amendment_custom_fields_override(custom_private_fields, :private_body, form, original_resource))
23
+ end
24
+ content
25
+ end
26
+
27
+ private
28
+
29
+ def render_amendment_custom_fields_override(custom_fields, attribute, form, original_resource)
30
+ # ensure decidim_editor is available as it is only required if the original FormBuilder is called
31
+ append_stylesheet_pack_tag "decidim_editor"
32
+ append_javascript_pack_tag "decidim_editor", defer: false
33
+
34
+ custom_fields.translate!
35
+ body = amendments_form_fields_value(original_resource, attribute)
36
+ custom_fields.apply_xml(body) if body.present?
37
+ # TODO: find a way to add errors as form is not the parent form
38
+ # form.object.errors.add(attribute, custom_fields.errors) if custom_fields.errors
39
+
40
+ editor_image = Decidim::EditorImage.new
41
+ editor_options = form.send(:editor_options, editor_image, { context: "participant", lines: 10 })
42
+ editor_upload = form.send(:editor_upload, editor_image, editor_options[:upload])
43
+ render partial: "decidim/decidim_awesome/custom_fields/form_render", locals: { spec: custom_fields.to_json, editor_options:, editor_upload:, form:, name: attribute }
44
+ end
45
+
46
+ # Amendments don't use a URL specifying participatory space and component
47
+ # context for awesome config constraints must be obtained from the resource
48
+ def awesome_custom_fields(attribute, _form)
49
+ return unless attribute == :body
50
+
51
+ component = amendable.try(:component)
52
+ return unless component
53
+ return if component.settings.participatory_texts_enabled?
54
+
55
+ awesome_config = Decidim::DecidimAwesome::Config.new(component.organization)
56
+ awesome_config.context_from_component(component)
57
+
58
+ pub = awesome_config.collect_sub_configs_values("proposal_custom_field")
59
+ priv = awesome_config.collect_sub_configs_values("proposal_private_custom_field")
60
+ [pub.presence && Decidim::DecidimAwesome::CustomFields.new(pub), priv.presence && Decidim::DecidimAwesome::CustomFields.new(priv)]
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module BreadcrumbHelperOverride
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ def active_breadcrumb_item(target_menu)
10
+ active_item = ::Decidim::MenuPresenter.new(target_menu, self).active_item_for_breadcrumb
11
+
12
+ return if active_item.blank?
13
+
14
+ {
15
+ label: active_item.label,
16
+ url: active_item.url,
17
+ active: active_item.active?
18
+ }
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module Proposals
6
+ module ApplicationHelperOverride
7
+ extend ActiveSupport::Concern
8
+
9
+ included do
10
+ alias_method :decidim_text_editor_for_proposal_body, :text_editor_for_proposal_body
11
+ alias_method :decidim_render_proposal_body, :render_proposal_body
12
+
13
+ # If the content is safe, HTML tags are sanitized, otherwise, they are stripped.
14
+ def render_proposal_body(proposal)
15
+ if awesome_proposal_custom_fields.present? || awesome_config[:allow_images_in_editors]
16
+ content = present(proposal).body(links: true, strip_tags: false)
17
+ sanitized = decidim_sanitize_editor_admin(content, {})
18
+ Decidim::ContentProcessor.render_without_format(sanitized).html_safe
19
+ else
20
+ decidim_render_proposal_body(proposal)
21
+ end
22
+ end
23
+
24
+ # replace normal method to draw the editor
25
+ def text_editor_for_proposal_body(form)
26
+ custom_fields = awesome_proposal_custom_fields_for(:body)
27
+ custom_private_fields = awesome_proposal_custom_fields_for(:private_body)
28
+
29
+ content = if custom_fields.empty?
30
+ decidim_text_editor_for_proposal_body(form)
31
+ else
32
+ render_proposal_custom_fields_override(custom_fields, form, :body)
33
+ end
34
+
35
+ unless custom_private_fields.empty?
36
+ content = content_tag("div", content)
37
+ content += content_tag("div", render_proposal_custom_fields_override(custom_private_fields, form, :private_body))
38
+ end
39
+ content
40
+ end
41
+
42
+ # replace admin method to draw the editor (multi lang)
43
+ def admin_editor_for_proposal_body(form)
44
+ custom_fields = awesome_proposal_custom_fields_for(:body)
45
+
46
+ return if custom_fields.empty?
47
+
48
+ locales = form.send(:locales)
49
+ return render_proposal_custom_fields_override(custom_fields, form, "body_#{locales.first}", locales.first) if locales.length == 1
50
+
51
+ tabs_id = form.send(:sanitize_tabs_selector, form.options[:tabs_id] || "#{form.object_name}-body-tabs")
52
+
53
+ label_tabs = form.content_tag(:div, class: "label--tabs") do
54
+ language_selector = "".html_safe
55
+ language_selector = form.create_language_selector(locales, tabs_id, "body") if form.options[:label] != false
56
+
57
+ safe_join [content_tag("label"), language_selector]
58
+ end
59
+
60
+ tabs_content = form.content_tag(:div, class: "tabs-content", data: { tabs_content: tabs_id }) do
61
+ locales.each_with_index.inject("".html_safe) do |string, (locale, index)|
62
+ tab_content_id = "#{tabs_id}-body-panel-#{index}"
63
+ string + content_tag(:div, class: form.send(:tab_element_class_for, "panel", index), id: tab_content_id, "aria-hidden": index.zero? ? "false" : "true") do
64
+ render_proposal_custom_fields_override(custom_fields, form, "body_#{locale}", locale)
65
+ end
66
+ end
67
+ end
68
+
69
+ safe_join [label_tabs, tabs_content]
70
+ end
71
+
72
+ def render_proposal_custom_fields_override(custom_fields, form, name, locale = nil)
73
+ # ensure decidim_editor is available as it is only required if the original FormBuilder is called
74
+ append_stylesheet_pack_tag "decidim_editor"
75
+ append_javascript_pack_tag "decidim_editor", defer: false
76
+
77
+ custom_fields.translate!
78
+
79
+ body = if name == :private_body
80
+ if form_presenter.proposal.private_body.is_a?(Hash) && locale.present?
81
+ form_presenter.private_body(extras: false, all_locales: locale.present?).with_indifferent_access[locale]
82
+ else
83
+ form_presenter.private_body(extras: false)
84
+ end
85
+ elsif form_presenter.proposal.body.is_a?(Hash) && locale.present?
86
+ form_presenter.body(extras: false, all_locales: locale.present?).with_indifferent_access[locale]
87
+ else
88
+ form_presenter.body(extras: false)
89
+ end
90
+
91
+ custom_fields.apply_xml(body) if body.present?
92
+ form.object.errors.add(name, custom_fields.errors) if custom_fields.errors
93
+ editor_image = Decidim::EditorImage.new
94
+ editor_options = form.send(:editor_options, editor_image, { context: "participant", lines: 10 })
95
+ editor_upload = form.send(:editor_upload, editor_image, editor_options[:upload])
96
+ render partial: "decidim/decidim_awesome/custom_fields/form_render", locals: { spec: custom_fields.to_json, editor_options:, editor_upload:, form:, name: }
97
+ end
98
+
99
+ def awesome_proposal_custom_fields_for(name)
100
+ if name == :private_body
101
+ Decidim::DecidimAwesome::CustomFields.new(awesome_proposal_private_custom_fields)
102
+ else
103
+ Decidim::DecidimAwesome::CustomFields.new(awesome_proposal_custom_fields)
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
109
+ end
110
+ end
@@ -8,40 +8,19 @@ module Decidim
8
8
 
9
9
  include Decidim::TranslatableAttributes
10
10
 
11
- def check(status)
12
- content_tag(:span, icon(status ? "check" : "x", class: "icon", aria_label: status, role: "img"), class: "text-#{status ? "success" : "alert"}")
13
- end
11
+ delegate :menus, :config_enabled?, to: "Decidim::DecidimAwesome::Menu"
14
12
 
15
- def menus
16
- @menus ||= {
17
- editors: config_enabled?([:allow_images_in_full_editor, :allow_images_in_small_editor, :use_markdown_editor, :allow_images_in_markdown_editor]),
18
- proposals: config_enabled?([:allow_images_in_proposals,
19
- :validate_title_min_length, :validate_title_max_caps_percent,
20
- :validate_title_max_marks_together, :validate_title_start_with_caps,
21
- :validate_body_min_length, :validate_body_max_caps_percent,
22
- :validate_body_max_marks_together, :validate_body_start_with_caps]),
23
- surveys: config_enabled?(:auto_save_forms),
24
- styles: config_enabled?(:scoped_styles),
25
- proposal_custom_fields: config_enabled?(:proposal_custom_fields),
26
- admins: config_enabled?(:scoped_admins),
27
- menu_hacks: config_enabled?(:menu),
28
- custom_redirects: config_enabled?(:custom_redirects),
29
- livechat: config_enabled?([:intergram_for_admins, :intergram_for_public])
30
- }
13
+ def check(status)
14
+ content_tag(:span, icon(status ? "check-line" : "close-line", class: "inline-block", aria_label: status, role: "img"), class: "fill-#{status ? "success" : "alert"}")
31
15
  end
32
16
 
33
17
  # returns only non :disabled vars in config
34
18
  def enabled_configs(vars)
35
- vars.filter do |var|
36
- config_enabled? var
19
+ vars.filter do |conf|
20
+ config_enabled?(conf)
37
21
  end
38
22
  end
39
23
 
40
- # ensure boolean value
41
- def config_enabled?(var)
42
- DecidimAwesome.enabled?(var)
43
- end
44
-
45
24
  def participatory_space_manifests
46
25
  manifests = OTHER_MANIFESTS.index_with { |m| I18n.t("decidim.decidim_awesome.admin.config.#{m}") }
47
26
  Decidim.participatory_space_manifests.pluck(:name).each do |name|
@@ -71,7 +50,7 @@ module Decidim
71
50
  space = model_for_manifest(manifest)
72
51
  return {} unless space&.column_names&.include? "slug"
73
52
 
74
- components = Component.where(participatory_space: space.find_by(slug: slug))
53
+ components = Component.where(participatory_space: space.find_by(slug:))
75
54
  components.to_h do |item|
76
55
  [item.id, "#{item.id}: #{translated_attribute(item.name)}"]
77
56
  end
@@ -11,14 +11,12 @@ module Decidim
11
11
 
12
12
  # rubocop:disable Metrics/CyclomaticComplexity
13
13
  # rubocop:disable Metrics/PerceivedComplexity:
14
- def awesome_map_for(components, &block)
14
+ def awesome_map_for(components, &)
15
15
  return unless map_utility_dynamic
16
16
 
17
- map = awesome_builder.map_element({ class: "google-map", id: "awesome-map-container" }, &block)
18
- help = content_tag(:div, class: "map__help") do
19
- sr_content = content_tag(:p, t("screen_reader_explanation", scope: "decidim.map.dynamic"), class: "show-for-sr")
20
-
21
- sr_content
17
+ map = awesome_builder.map_element({ class: "dynamic-map", id: "awesome-map-container" }, &)
18
+ help = content_tag(:div, class: "map__skip-container") do
19
+ content_tag(:p, t("screen_reader_explanation", scope: "decidim.map.dynamic"), class: "sr-only")
22
20
  end
23
21
 
24
22
  html_options = {
@@ -30,7 +28,7 @@ module Decidim
30
28
  type: component.manifest.name,
31
29
  name: translated_attribute(component.name),
32
30
  url: Decidim::EngineRouter.main_proxy(component).root_path,
33
- amendments: component.manifest.name == :proposals ? Decidim::Proposals::Proposal.where(component: component).only_emendations.count : 0
31
+ amendments: component.manifest.name == :proposals ? Decidim::Proposals::Proposal.where(component:).only_emendations.count : 0
34
32
  }
35
33
  end.to_json,
36
34
  "data-hide-controls" => settings_source.try(:hide_controls),
@@ -51,7 +49,7 @@ module Decidim
51
49
  }
52
50
 
53
51
  content_tag(:div, html_options) do
54
- content_tag :div, class: "row column" do
52
+ content_tag :div, class: "w-full" do
55
53
  help + map
56
54
  end
57
55
  end
@@ -71,7 +69,6 @@ module Decidim
71
69
  try(:current_component) || self
72
70
  end
73
71
 
74
- # rubocop:disable Rails/HelperInstanceVariable
75
72
  def current_categories(categories)
76
73
  return @current_categories if @current_categories
77
74
 
@@ -97,26 +94,12 @@ module Decidim
97
94
  }
98
95
  builder = map_utility_dynamic.create_builder(self, options)
99
96
 
100
- # We need awesome map listeners before initialize the official map
101
- unless snippets.any?(:awesome_map_styles) || snippets.any?(:awesome_map_scripts)
102
- snippets.add(:awesome_map_styles, stylesheet_pack_tag("decidim_decidim_awesome_map"))
103
- snippets.add(:awesome_map_scripts, javascript_pack_tag("decidim_decidim_awesome_map", defer: false))
104
- snippets.add(:head, snippets.for(:awesome_map_styles))
105
- snippets.add(DecidimAwesome.legacy_version? ? :head : :foot, snippets.for(:awesome_map_scripts))
106
- end
107
-
108
- unless snippets.any?(:map_styles) || snippets.any?(:map_scripts)
109
- snippets.add(:map_styles, builder.stylesheet_snippets)
110
- snippets.add(:map_scripts, builder.javascript_snippets)
111
-
112
- snippets.add(:head, snippets.for(:map_styles))
113
- snippets.add(DecidimAwesome.legacy_version? ? :head : :foot, snippets.for(:map_scripts))
114
- end
97
+ append_stylesheet_pack_tag("decidim_decidim_awesome_map")
98
+ append_javascript_pack_tag("decidim_decidim_awesome_map")
115
99
 
116
100
  builder
117
101
  end
118
102
 
119
- # rubocop:disable Style/FormatStringToken
120
103
  def append_category(category)
121
104
  @h += @golden_ratio_conjugate
122
105
  @h %= 1
@@ -129,8 +112,6 @@ module Decidim
129
112
  color: format("#%02x%02x%02x", r, g, b)
130
113
  )
131
114
  end
132
- # rubocop:enable Style/FormatStringToken
133
- # rubocop:enable Rails/HelperInstanceVariable
134
115
 
135
116
  # HSV values in [0..1[
136
117
  # returns [r, g, b] values from 0 to 255
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ class DestroyPrivateDataJob < ApplicationJob
6
+ queue_as :default
7
+
8
+ # Destroys private data associated with the resource
9
+ def perform(resource)
10
+ extra_fields = Decidim::DecidimAwesome::ProposalExtraField.where(
11
+ proposal: Decidim::Proposals::Proposal.where(component: resource)
12
+ ).where("private_body_updated_at < ?", DecidimAwesome.private_data_expiration_time.ago)
13
+
14
+ extra_fields.find_each do |extra_field|
15
+ extra_field.update(private_body: nil)
16
+ end
17
+
18
+ Lock.new(resource.organization).release!(resource)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -25,7 +25,7 @@ module Decidim
25
25
  cw_uploader: Decidim::Cw::DecidimAwesome::ImageUploader,
26
26
  as_attribute: "file",
27
27
  logger: @logger,
28
- routes_mappings: routes_mappings
28
+ routes_mappings:
29
29
  )
30
30
  end
31
31
 
@@ -34,11 +34,11 @@ module Decidim
34
34
  klass, id = mapping[:instance].split("#")
35
35
  next unless klass == "Decidim::DecidimAwesome::EditorImage"
36
36
 
37
- instance = Decidim::DecidimAwesome::EditorImage.find_by(id: id)
37
+ instance = Decidim::DecidimAwesome::EditorImage.find_by(id:)
38
38
 
39
39
  next if instance.blank?
40
40
 
41
- mapping.merge!(instance: instance)
41
+ mapping.merge!(instance:)
42
42
  end.compact
43
43
 
44
44
  editor_images_available_attributes.each do |model, attributes|
@@ -75,7 +75,8 @@ module Decidim
75
75
  "Decidim::Assembly" => %w(short_description description purpose_of_action composition internal_organisation announcement closing_date_reason special_features),
76
76
  "Decidim::Forms::Questionnaire" => %w(description tos),
77
77
  "Decidim::Forms::Question" => %w(description),
78
- "Decidim::Organization" => %w(welcome_notification_body admin_terms_of_use_body description highlighted_content_banner_short_description id_documents_explanation_text),
78
+ "Decidim::Organization" => %w(welcome_notification_body admin_terms_of_service_body description highlighted_content_banner_short_description
79
+ id_documents_explanation_text),
79
80
  "Decidim::StaticPage" => %w(content),
80
81
  "Decidim::ContextualHelpSection" => %w(content),
81
82
  "Decidim::Category" => %w(description),
@@ -1,6 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # rubocop:disable Style/OpenStructUse
4
3
  module Decidim
5
4
  module DecidimAwesome
6
5
  # A middleware that stores the current awesome context by parsing the request
@@ -101,7 +100,7 @@ module Decidim
101
100
  end
102
101
 
103
102
  def safe_get_route?
104
- return unless @request.get?
103
+ return false unless @request.get?
105
104
 
106
105
  case @request.path
107
106
  when "/"
@@ -116,7 +115,7 @@ module Decidim
116
115
  end
117
116
 
118
117
  def safe_post_route?
119
- return unless @request.post? || @request.put? || @request.patch?
118
+ return false unless @request.post? || @request.put? || @request.patch?
120
119
 
121
120
  case @request.path
122
121
  when %r{^/admin/admin_terms}
@@ -171,7 +170,7 @@ module Decidim
171
170
  next unless model
172
171
 
173
172
  settings["participatory_space_slug"] = model.find_by(slug: settings["participatory_space_slug"])&.id
174
- OpenStruct.new(settings: settings) if settings["participatory_space_slug"]
173
+ OpenStruct.new(settings:) if settings["participatory_space_slug"]
175
174
  end
176
175
  end
177
176
  # rubocop:enable Metrics/CyclomaticComplexity
@@ -183,4 +182,3 @@ module Decidim
183
182
  end
184
183
  end
185
184
  end
186
- # rubocop:enable Style/OpenStructUse