decidim-decidim_awesome 0.10.3 → 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 (232) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -5
  3. data/README.md +65 -67
  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 +44 -0
  6. data/app/cells/decidim/decidim_awesome/content_blocks/map/show.erb +5 -12
  7. data/app/cells/decidim/decidim_awesome/voting/proposal_metadata_cell.rb +54 -0
  8. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/modal.erb +18 -0
  9. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/show.erb +37 -32
  10. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_cell.rb +9 -4
  11. data/app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb +1 -1
  12. data/app/commands/concerns/decidim/decidim_awesome/proposals/create_proposal_override.rb +2 -2
  13. data/app/commands/concerns/decidim/decidim_awesome/proposals/update_proposal_override.rb +2 -2
  14. data/app/commands/decidim/decidim_awesome/admin/create_constraint.rb +1 -1
  15. data/app/commands/decidim/decidim_awesome/admin/destroy_custom_redirect.rb +1 -1
  16. data/app/commands/decidim/decidim_awesome/admin/destroy_menu_hack.rb +1 -1
  17. data/app/commands/decidim/decidim_awesome/admin/rename_scope_label.rb +1 -1
  18. data/app/commands/decidim/decidim_awesome/admin/update_constraint.rb +1 -1
  19. data/app/commands/decidim/decidim_awesome/admin/update_custom_redirect.rb +2 -2
  20. data/app/commands/decidim/decidim_awesome/command.rb +1 -7
  21. data/app/controllers/concerns/decidim/decidim_awesome/admin/maintenance_context.rb +1 -1
  22. data/app/controllers/concerns/decidim/decidim_awesome/admin_accountability/admin/filterable_helper.rb +3 -4
  23. data/app/controllers/concerns/decidim/decidim_awesome/content_security_policy.rb +34 -0
  24. data/app/controllers/concerns/decidim/decidim_awesome/not_found_redirect.rb +1 -1
  25. data/app/controllers/concerns/decidim/decidim_awesome/proposals/orderable_override.rb +22 -9
  26. data/app/controllers/concerns/decidim/decidim_awesome/proposals/proposal_votes_controller_override.rb +3 -3
  27. data/app/controllers/decidim/decidim_awesome/admin/admin_accountability_controller.rb +7 -7
  28. data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +7 -7
  29. data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +8 -10
  30. data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +20 -19
  31. data/app/controllers/decidim/decidim_awesome/admin/custom_redirects_controller.rb +6 -8
  32. data/app/controllers/decidim/decidim_awesome/admin/maintenance_controller.rb +2 -2
  33. data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +6 -8
  34. data/app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb +2 -2
  35. data/app/controllers/decidim/decidim_awesome/admin/scoped_admins_controller.rb +2 -2
  36. data/app/controllers/decidim/decidim_awesome/admin/scoped_styles_controller.rb +2 -2
  37. data/app/controllers/decidim/decidim_awesome/blank_component_controller.rb +8 -3
  38. data/app/controllers/decidim/decidim_awesome/editor_images_controller.rb +3 -3
  39. data/app/controllers/decidim/decidim_awesome/iframe_component/iframe_controller.rb +11 -5
  40. data/app/forms/concerns/decidim/decidim_awesome/proposals/proposal_wizard_create_step_form_override.rb +1 -1
  41. data/app/forms/decidim/decidim_awesome/admin/config_form.rb +13 -25
  42. data/app/forms/decidim/decidim_awesome/admin/custom_redirect_form.rb +2 -2
  43. data/app/forms/decidim/decidim_awesome/admin/intergram_form.rb +4 -0
  44. data/app/forms/decidim/decidim_awesome/admin/menu_form.rb +4 -4
  45. data/app/helpers/concerns/decidim/decidim_awesome/amendments_helper_override.rb +8 -1
  46. data/app/helpers/concerns/decidim/decidim_awesome/breadcrumb_helper_override.rb +23 -0
  47. data/app/helpers/concerns/decidim/decidim_awesome/proposals/application_helper_override.rb +23 -39
  48. data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +2 -2
  49. data/app/helpers/decidim/decidim_awesome/map_helper.rb +8 -27
  50. data/app/jobs/decidim/decidim_awesome/migrate_legacy_images_job.rb +5 -4
  51. data/app/middleware/decidim/decidim_awesome/current_config.rb +3 -5
  52. data/app/models/concerns/decidim/decidim_awesome/has_proposal_extra_fields.rb +1 -1
  53. data/app/models/decidim/decidim_awesome/awesome_config.rb +1 -1
  54. data/app/models/decidim/decidim_awesome/paper_trail_version.rb +4 -8
  55. data/app/models/decidim/decidim_awesome/proposal_extra_field.rb +1 -1
  56. data/app/models/decidim/decidim_awesome/vote_weight.rb +2 -2
  57. data/app/overrides/decidim/proposals/proposals/{show → _proposal_aside}/limit_amendments_modal.html.erb.deface +1 -1
  58. data/app/overrides/decidim/proposals/proposals/_vote_button/replace_vote_button.html.erb.deface +1 -1
  59. data/app/overrides/layouts/decidim/_decidim_javascript/add_awesome_tags.html.erb.deface +6 -0
  60. data/app/overrides/layouts/decidim/_head/add_awesome_tags.html.erb.deface +4 -11
  61. data/app/overrides/layouts/decidim/admin/_header/{replace_scripts.html.erb.deface → add_awesome_tags.html.erb.deface} +4 -4
  62. data/app/packs/entrypoints/decidim_admin_decidim_awesome.js +1 -2
  63. data/app/packs/entrypoints/decidim_admin_decidim_awesome_global.js +4 -0
  64. data/app/packs/entrypoints/decidim_admin_decidim_awesome_global.scss +1 -0
  65. data/app/packs/entrypoints/decidim_decidim_awesome.js +2 -2
  66. data/app/packs/entrypoints/decidim_editor.js +14 -0
  67. data/app/packs/src/decidim/decidim_awesome/admin/auto_edit.js +95 -70
  68. data/app/packs/src/decidim/decidim_awesome/admin/check_redirections.js +46 -41
  69. data/app/packs/src/decidim/decidim_awesome/admin/codemirror.js +3 -3
  70. data/app/packs/src/decidim/decidim_awesome/admin/constraint_form_events.js +115 -0
  71. data/app/packs/src/decidim/decidim_awesome/admin/custom_fields_builder.js +4 -1
  72. data/app/packs/src/decidim/decidim_awesome/admin/form_exit_warn.js +22 -11
  73. data/app/packs/src/decidim/decidim_awesome/admin/proposal_sortings.js +26 -8
  74. data/app/packs/src/decidim/decidim_awesome/admin/user_picker.js +34 -21
  75. data/app/packs/src/decidim/decidim_awesome/amendments/show_modal_on_limits.js +20 -22
  76. data/app/packs/src/decidim/decidim_awesome/awesome_admin.js +5 -16
  77. data/app/packs/src/decidim/decidim_awesome/awesome_admin_global.js +1 -0
  78. data/app/packs/src/decidim/decidim_awesome/awesome_application.js +0 -15
  79. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/fetcher.js +33 -11
  80. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/meetings_fetcher.js +9 -12
  81. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/proposals_fetcher.js +28 -0
  82. data/app/packs/src/decidim/decidim_awesome/awesome_map/awesome_map.js +3 -4
  83. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/controller.js +12 -12
  84. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/meetings_controller.js +11 -7
  85. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/proposals_controller.js +6 -13
  86. data/app/packs/src/decidim/decidim_awesome/awesome_map/controls_ui.js +51 -20
  87. data/app/packs/src/decidim/decidim_awesome/awesome_map/load_map.js +27 -18
  88. data/app/packs/src/decidim/decidim_awesome/editor/index.js +94 -0
  89. data/app/packs/src/decidim/decidim_awesome/forms/autosave.js +28 -23
  90. data/app/packs/src/decidim/decidim_awesome/forms/custom_fields_renderer.js +9 -14
  91. data/app/packs/src/decidim/decidim_awesome/forms/rich_text_plugin.js +27 -32
  92. data/app/packs/src/decidim/decidim_awesome/proposals/images.js +16 -10
  93. data/app/packs/src/decidim/decidim_awesome/voting/voting_cards.js +47 -38
  94. data/app/packs/stylesheets/decidim/decidim_awesome/admin/auto_edits.scss +11 -12
  95. data/app/packs/stylesheets/decidim/decidim_awesome/admin/check_redirections.scss +15 -0
  96. data/app/packs/stylesheets/decidim/decidim_awesome/admin/codemirror.scss +19 -12
  97. data/app/packs/stylesheets/decidim/decidim_awesome/admin/constraints.scss +8 -32
  98. data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_fields.scss +28 -78
  99. data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_styles.scss +48 -0
  100. data/app/packs/stylesheets/decidim/decidim_awesome/admin/intergram_fixes.scss +11 -0
  101. data/app/packs/stylesheets/decidim/decidim_awesome/admin/user_picker.scss +15 -24
  102. data/app/packs/stylesheets/decidim/decidim_awesome/amendments/modal.scss +5 -0
  103. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin.scss +9 -47
  104. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss +3 -12
  105. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_application.scss +3 -19
  106. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_iframe/iframe.scss +1 -1
  107. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_map/map.scss +27 -21
  108. data/app/packs/stylesheets/decidim/decidim_awesome/forms/autosave.scss +6 -6
  109. data/app/packs/stylesheets/decidim/decidim_awesome/forms/custom_fields.scss +32 -101
  110. data/app/packs/stylesheets/decidim/decidim_awesome/shared/spinner.scss +5 -26
  111. data/app/packs/stylesheets/decidim/decidim_awesome/voting/voting_cards.scss +34 -52
  112. data/app/permissions/decidim/decidim_awesome/permissions.rb +3 -4
  113. data/app/presenters/concerns/decidim/decidim_awesome/breadcrumb_root_menu_item_presenter_override.rb +23 -0
  114. data/app/presenters/concerns/decidim/decidim_awesome/menu_item_presenter_override.rb +10 -2
  115. data/app/presenters/concerns/decidim/decidim_awesome/menu_presenter_override.rb +8 -0
  116. data/app/presenters/decidim/decidim_awesome/participatory_space_role_presenter.rb +1 -1
  117. data/app/presenters/decidim/decidim_awesome/private_data_presenter.rb +11 -11
  118. data/app/presenters/decidim/decidim_awesome/user_entity_presenter.rb +1 -1
  119. data/app/queries/decidim/decidim_awesome/private_data_finder.rb +1 -1
  120. data/app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb +0 -8
  121. data/app/views/decidim/decidim_awesome/admin/admin_accountability/index.html.erb +23 -17
  122. data/app/views/decidim/decidim_awesome/admin/checks/index.html.erb +1 -3
  123. data/app/views/decidim/decidim_awesome/admin/config/_autoedit_box_label.html.erb +3 -3
  124. data/app/views/decidim/decidim_awesome/admin/config/_constraints.html.erb +20 -21
  125. data/app/views/decidim/decidim_awesome/admin/config/_form_admins.html.erb +6 -5
  126. data/app/views/decidim/decidim_awesome/admin/config/_form_editors.html.erb +2 -2
  127. data/app/views/decidim/decidim_awesome/admin/config/_form_livechat.html.erb +39 -23
  128. data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_custom_fields.html.erb +4 -6
  129. data/app/views/decidim/decidim_awesome/admin/config/_form_proposals.html.erb +64 -76
  130. data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +15 -11
  131. data/app/views/decidim/decidim_awesome/admin/config/_form_surveys.html.erb +8 -6
  132. data/app/views/decidim/decidim_awesome/admin/config/show.html.erb +22 -12
  133. data/app/views/decidim/decidim_awesome/admin/constraints/_form.html.erb +1 -49
  134. data/app/views/decidim/decidim_awesome/admin/constraints/new.html.erb +14 -9
  135. data/app/views/decidim/decidim_awesome/admin/constraints/show.html.erb +14 -9
  136. data/app/views/decidim/decidim_awesome/admin/custom_redirects/_form.html.erb +20 -5
  137. data/app/views/decidim/decidim_awesome/admin/custom_redirects/edit.html.erb +5 -5
  138. data/app/views/decidim/decidim_awesome/admin/custom_redirects/index.html.erb +15 -15
  139. data/app/views/decidim/decidim_awesome/admin/custom_redirects/new.html.erb +5 -5
  140. data/app/views/decidim/decidim_awesome/admin/maintenance/_private_data.html.erb +4 -4
  141. data/app/views/decidim/decidim_awesome/admin/menu_hacks/_form.html.erb +6 -6
  142. data/app/views/decidim/decidim_awesome/admin/menu_hacks/edit.html.erb +21 -12
  143. data/app/views/decidim/decidim_awesome/admin/menu_hacks/index.html.erb +16 -18
  144. data/app/views/decidim/decidim_awesome/admin/menu_hacks/new.html.erb +21 -12
  145. data/app/views/decidim/decidim_awesome/admin/shared/_filters_with_date.html.erb +14 -18
  146. data/app/views/decidim/decidim_awesome/amendments/_modal.html.erb +18 -11
  147. data/app/views/decidim/decidim_awesome/custom_fields/_form_render.html.erb +3 -5
  148. data/app/views/decidim/decidim_awesome/iframe_component/iframe/show.html.erb +7 -12
  149. data/app/views/decidim/decidim_awesome/map_component/map/_map_template.html.erb +53 -37
  150. data/app/views/decidim/decidim_awesome/map_component/map/show.html.erb +14 -5
  151. data/app/views/decidim/decidim_awesome/voting/voting_cards/_show_vote_button.html.erb +0 -3
  152. data/app/views/layouts/decidim/decidim_awesome/_awesome_config.html.erb +9 -7
  153. data/app/views/layouts/decidim/decidim_awesome/_intergram_widget.html.erb +9 -6
  154. data/app/views/layouts/decidim/decidim_awesome/admin/_base.html.erb +3 -12
  155. data/config/assets.rb +3 -33
  156. data/config/i18n-tasks.yml +1 -0
  157. data/config/locales/ca.yml +17 -94
  158. data/config/locales/cs.yml +15 -93
  159. data/config/locales/de.yml +15 -91
  160. data/config/locales/en.yml +24 -28
  161. data/config/locales/es.yml +18 -96
  162. data/config/locales/eu.yml +8 -18
  163. data/config/locales/fr.yml +15 -94
  164. data/config/locales/hu.yml +4 -18
  165. data/config/locales/it.yml +9 -26
  166. data/config/locales/ja.yml +16 -93
  167. data/config/locales/lt.yml +2 -4
  168. data/config/locales/nl.yml +8 -18
  169. data/config/locales/pt-BR.yml +11 -25
  170. data/config/locales/ro-RO.yml +2 -14
  171. data/config/locales/sv.yml +10 -21
  172. data/config/rubocop/disabled.yml +11 -0
  173. data/config/rubocop/faker.yml +480 -0
  174. data/config/rubocop/rails.yml +88 -0
  175. data/config/rubocop/rspec.yml +65 -0
  176. data/config/rubocop/ruby.yml +1210 -0
  177. data/db/migrate/20240306175331_rename_editor_images_awesome_config.rb +18 -0
  178. data/db/migrate/20240729164227_add_decidim_awesome_proposal_private_fields_date.rb +1 -1
  179. data/db/seeds.rb +3 -3
  180. data/lib/decidim/decidim_awesome/admin_engine.rb +4 -1
  181. data/lib/decidim/decidim_awesome/api/types/translated_custom_fields_type.rb +2 -3
  182. data/lib/decidim/decidim_awesome/awesome.rb +42 -28
  183. data/lib/decidim/decidim_awesome/awesome_helpers.rb +1 -1
  184. data/lib/decidim/decidim_awesome/checksums.yml +39 -60
  185. data/lib/decidim/decidim_awesome/config.rb +1 -1
  186. data/lib/decidim/decidim_awesome/custom_fields.rb +5 -5
  187. data/lib/decidim/decidim_awesome/engine.rb +24 -6
  188. data/lib/decidim/decidim_awesome/iframe_component/component.rb +1 -2
  189. data/lib/decidim/decidim_awesome/lock.rb +2 -2
  190. data/lib/decidim/decidim_awesome/map_component/component.rb +1 -1
  191. data/lib/decidim/decidim_awesome/menu.rb +33 -14
  192. data/lib/decidim/decidim_awesome/menu_hacker.rb +4 -8
  193. data/lib/decidim/decidim_awesome/system_checker.rb +2 -4
  194. data/lib/decidim/decidim_awesome/test/factories.rb +10 -10
  195. data/lib/decidim/decidim_awesome/test/initializer.rb +3 -11
  196. data/lib/decidim/decidim_awesome/test/layouts/decidim/_head.html.erb +2 -2
  197. data/lib/decidim/decidim_awesome/test/layouts/decidim/admin/_header.html.erb +2 -2
  198. data/lib/decidim/decidim_awesome/test/shared_examples/box_label_editor_examples.rb +18 -18
  199. data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +3 -3
  200. data/lib/decidim/decidim_awesome/test/shared_examples/custom_fields_examples.rb +11 -11
  201. data/lib/decidim/decidim_awesome/test/shared_examples/custom_redirects_contexts.rb +7 -7
  202. data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +26 -66
  203. data/lib/decidim/decidim_awesome/test/shared_examples/menu_hack_contexts.rb +10 -9
  204. data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +30 -20
  205. data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +19 -10
  206. data/lib/decidim/decidim_awesome/version.rb +2 -2
  207. data/lib/decidim/decidim_awesome/voting_manifest.rb +5 -10
  208. data/lib/decidim/decidim_awesome.rb +1 -2
  209. data/lib/tasks/decidim_awesome_active_storage_migrations_tasks.rake +1 -1
  210. data/lib/tasks/decidim_awesome_upgrade_tasks.rake +4 -0
  211. data/package.json +19 -28
  212. metadata +40 -56
  213. data/app/cells/concerns/decidim/decidim_awesome/proposal_m_cell_override.rb +0 -18
  214. data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter/show.erb +0 -15
  215. data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter/vote_button.erb +0 -15
  216. data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter_cell.rb +0 -21
  217. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_modal/show.erb +0 -16
  218. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_modal_cell.rb +0 -20
  219. data/app/cells/decidim/proposals/proposal_m/footer.erb +0 -13
  220. data/app/overrides/layouts/decidim/_head/add_awesome_legacy_scripts.rb +0 -14
  221. data/app/overrides/layouts/decidim/admin/_header/replace_styles.html.erb.deface +0 -3
  222. data/app/packs/entrypoints/decidim_admin_decidim_awesome_custom_fields.js +0 -2
  223. data/app/packs/entrypoints/decidim_decidim_awesome_admin_form_exit_warn.js +0 -1
  224. data/app/packs/src/decidim/decidim_awesome/admin/constraints.js +0 -55
  225. data/app/packs/src/decidim/decidim_awesome/editors/editor.js +0 -213
  226. data/app/packs/stylesheets/decidim/decidim_awesome/editors/markdown_editor.scss +0 -19
  227. data/app/packs/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss +0 -58
  228. data/app/packs/stylesheets/vendor/select2-foundation-theme.scss +0 -348
  229. data/app/serializers/concerns/decidim/decidim_awesome/proposal_serializer_override.rb +0 -65
  230. data/app/views/decidim/decidim_awesome/admin/config/_modal.html.erb +0 -11
  231. data/app/views/decidim/decidim_awesome/voting/voting_cards/_proposal_m_cell_footer.erb +0 -15
  232. /data/app/packs/src/decidim/decidim_awesome/{editors/tabs_focus.js → admin/tabs_change.js} +0 -0
@@ -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
 
@@ -15,10 +15,10 @@ module Decidim
15
15
  alias_method :decidim_original_create_proposal, :create_proposal
16
16
 
17
17
  def create_proposal
18
- decidim_original_create_proposal
18
+ created_proposal = decidim_original_create_proposal
19
19
  # Update the proposal with the private body, to
20
20
  # avoid tracebility on private fields.
21
- @proposal.update_private_body!(form.private_body) if form.private_body.present?
21
+ created_proposal.update_private_body!(form.private_body) if form.private_body.present?
22
22
  end
23
23
  end
24
24
  end
@@ -15,8 +15,8 @@ module Decidim
15
15
 
16
16
  alias_method :decidim_original_update_draft, :update_draft
17
17
 
18
- def update_draft
19
- decidim_original_update_draft
18
+ def update_proposal
19
+ decidim_original_update_proposal
20
20
  update_private_field!
21
21
  end
22
22
  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
@@ -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:
@@ -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
@@ -26,7 +26,7 @@ module Decidim
26
26
  {
27
27
  "private_data" => {
28
28
  title: I18n.t("private_data", scope: "decidim.decidim_awesome.admin.menu.maintenance"),
29
- icon: "lock-locked",
29
+ icon: "spy-line",
30
30
  path: decidim_admin_decidim_awesome.maintenance_path("private_data")
31
31
  },
32
32
  "checks" => {
@@ -13,13 +13,12 @@ module Decidim
13
13
  end
14
14
 
15
15
  def applied_filters_tags(i18n_ctx)
16
- admin_role_type = PaperTrailVersion.safe_admin_role_type(params[:admin_role_type])
17
- if global? && admin_role_type.present?
16
+ if global? && params[:admin_role_type].present?
18
17
  content_tag(:span, class: "label secondary") do
19
18
  concat "#{i18n_filter_label(:admin_role_type, filterable_i18n_scope_from_ctx(i18n_ctx))}: "
20
- concat t("decidim.decidim_awesome.admin.admin_accountability.admin_roles.#{admin_role_type}", default: admin_role_type)
19
+ concat t("decidim.decidim_awesome.admin.admin_accountability.admin_roles.#{params[:admin_role_type]}", default: params[:admin_role_type])
21
20
  concat icon_link_to(
22
- "circle-x",
21
+ "close-circle-line",
23
22
  url_for(export_params.except(:admin_role_type)),
24
23
  t("decidim.admin.actions.cancel"),
25
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
@@ -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
@@ -14,8 +14,6 @@ module Decidim
14
14
 
15
15
  private
16
16
 
17
- alias_method :decidim_original_reorder, :reorder
18
-
19
17
  # read order from session if available
20
18
  def order
21
19
  @order ||= detect_order(session[:order]) || default_order
@@ -33,23 +31,38 @@ module Decidim
33
31
  end
34
32
  end
35
33
 
34
+ # rubocop:disable Metrics/CyclomaticComplexity
36
35
  def reorder(proposals)
37
- title_by_locale = Arel.sql(proposals.sanitize_sql(["decidim_proposals_proposals.title->>? #{collation}", locale]))
38
- title_by_machine_translation = Arel.sql(proposals.sanitize_sql(["decidim_proposals_proposals.title->'machine_translations'->>? #{collation}", locale]))
39
- title_by_default_locale = Arel.sql(proposals.sanitize_sql(["decidim_proposals_proposals.title->>? #{collation}", default_locale]))
40
36
  case order
41
37
  when "az"
42
- proposals.order(title_by_locale => :asc, title_by_machine_translation => :asc, title_by_default_locale => :asc)
38
+ proposals.order(Arel.sql("CONCAT(decidim_proposals_proposals.title->>'#{locale}',
39
+ decidim_proposals_proposals.title->'machine_translations'->>'#{locale}',
40
+ decidim_proposals_proposals.title->>'#{default_locale}') #{collation} ASC"))
43
41
  when "za"
44
- proposals.order(title_by_locale => :desc, title_by_machine_translation => :desc, title_by_default_locale => :desc)
42
+ proposals.order(Arel.sql("CONCAT(decidim_proposals_proposals.title->>'#{locale}',
43
+ decidim_proposals_proposals.title->'machine_translations'->>'#{locale}',
44
+ decidim_proposals_proposals.title->>'#{default_locale}') #{collation} DESC"))
45
45
  when "supported_first"
46
46
  proposals.joins(my_votes_join).group(:id).order(Arel.sql("COUNT(decidim_proposals_proposal_votes.id) DESC"))
47
47
  when "supported_last"
48
48
  proposals.joins(my_votes_join).group(:id).order(Arel.sql("COUNT(decidim_proposals_proposal_votes.id) ASC"))
49
- else
50
- decidim_original_reorder(proposals)
49
+ when "most_commented"
50
+ proposals.left_joins(:comments).group(:id).order(Arel.sql("COUNT(decidim_comments_comments.id) DESC"))
51
+ when "most_endorsed"
52
+ proposals.order(endorsements_count: :desc)
53
+ when "most_followed"
54
+ proposals.left_joins(:follows).group(:id).order(Arel.sql("COUNT(decidim_follows.id) DESC"))
55
+ when "most_voted"
56
+ proposals.order(proposal_votes_count: :desc)
57
+ when "random"
58
+ proposals.order_randomly(random_seed)
59
+ when "recent"
60
+ proposals.order(published_at: :desc)
61
+ when "with_more_authors"
62
+ proposals.order(coauthorships_count: :desc)
51
63
  end
52
64
  end
65
+ # rubocop:enable Metrics/CyclomaticComplexity
53
66
 
54
67
  def collation
55
68
  @collation ||= begin
@@ -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
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  class AdminAccountabilityController < DecidimAwesome::Admin::ApplicationController
7
7
  include NeedsAwesomeConfig
8
- include AdminAccountability::Admin::Filterable
8
+ include Decidim::DecidimAwesome::AdminAccountability::Admin::Filterable
9
9
 
10
10
  helper_method :admin_actions, :collection, :export_params, :global?, :global_users_missing_date
11
11
 
@@ -20,9 +20,9 @@ module Decidim
20
20
  def export
21
21
  filters = export_params[:q]
22
22
 
23
- ExportAdminActionsJob.perform_later(current_user,
24
- params[:format].to_s,
25
- admin_actions.ransack(filters).result.ids)
23
+ Decidim::DecidimAwesome::ExportAdminActionsJob.perform_later(current_user,
24
+ params[:format].to_s,
25
+ admin_actions.ransack(filters).result.ids)
26
26
 
27
27
  redirect_back fallback_location: decidim_admin_decidim_awesome.admin_accountability_path,
28
28
  notice: t("decidim.decidim_awesome.admin.admin_accountability.exports.notice")
@@ -39,11 +39,11 @@ module Decidim
39
39
  end
40
40
 
41
41
  def space_role_actions
42
- @space_role_actions ||= PaperTrailVersion.space_role_actions(current_organization)
42
+ @space_role_actions ||= Decidim::DecidimAwesome::PaperTrailVersion.space_role_actions(current_organization)
43
43
  end
44
44
 
45
45
  def admin_role_actions
46
- @admin_role_actions ||= PaperTrailVersion.in_organization(current_organization).admin_role_actions(PaperTrailVersion.safe_admin_role_type(params[:admin_role_type]))
46
+ @admin_role_actions ||= Decidim::DecidimAwesome::PaperTrailVersion.in_organization(current_organization).admin_role_actions(params[:admin_role_type])
47
47
  end
48
48
 
49
49
  def export_params
@@ -61,7 +61,7 @@ module Decidim
61
61
  return unless global?
62
62
 
63
63
  @global_users_missing_date ||= begin
64
- first_version = PaperTrailVersion.where(item_type: "Decidim::UserBaseEntity").last
64
+ first_version = Decidim::DecidimAwesome::PaperTrailVersion.where(item_type: "Decidim::UserBaseEntity").last
65
65
  first_user = Decidim::User.first
66
66
  first_version.created_at if first_user && first_version && (first_version.created_at > first_user.created_at + 1.second)
67
67
  end
@@ -34,27 +34,27 @@ module Decidim
34
34
  def head_addons(part)
35
35
  case part
36
36
  when :CSS
37
- ['<%= stylesheet_pack_tag "decidim_decidim_awesome", media: "all" %>',
37
+ ['<%= append_stylesheet_pack_tag "decidim_decidim_awesome", media: "all" %>',
38
38
  '<%= render(partial: "layouts/decidim/decidim_awesome/custom_styles") if awesome_custom_styles %>'].join("\n")
39
39
  when :JavaScript
40
40
  ['<%= render partial: "layouts/decidim/decidim_awesome/awesome_config" %>',
41
- '<%= javascript_pack_tag "decidim_decidim_awesome" %>',
42
- '<%= javascript_pack_tag "decidim_decidim_awesome_custom_fields" if awesome_proposal_custom_fields %>'].join("\n")
41
+ '<%= append_javascript_pack_tag "decidim_decidim_awesome", defer: false %>',
42
+ '<%= append_javascript_pack_tag "decidim_decidim_awesome_custom_fields" if awesome_proposal_custom_fields %>'].join("\n")
43
43
  end
44
44
  end
45
45
 
46
46
  def admin_addons(part)
47
47
  case part
48
48
  when :CSS
49
- '<%= stylesheet_pack_tag "decidim_admin_decidim_awesome", media: "all" %>'
49
+ '<%= append_stylesheet_pack_tag "decidim_admin_decidim_awesome", media: "all" %>'
50
50
  when :JavaScript
51
- ['<%= javascript_pack_tag "decidim_admin_decidim_awesome", defer: false %>',
52
- '<%= javascript_pack_tag "decidim_decidim_awesome_custom_fields" if awesome_proposal_custom_fields %>'].join("\n")
51
+ ['<%= append_javascript_pack_tag "decidim_admin_decidim_awesome", defer: false %>',
52
+ '<%= append_javascript_pack_tag "decidim_decidim_awesome_custom_fields" if awesome_proposal_custom_fields %>'].join("\n")
53
53
  end
54
54
  end
55
55
 
56
56
  def render_template(partial)
57
- render_to_string(partial: partial)
57
+ render_to_string(partial:)
58
58
  rescue ActionView::Template::Error => e
59
59
  flash.now[:alert] = "Partial [#{partial}] has thrown an error: #{e.message}"
60
60
  end
@@ -42,12 +42,12 @@ module Decidim
42
42
  query = current_organization.users.order(name: :asc)
43
43
  query = query.where("name ILIKE :term OR nickname ILIKE :term OR email ILIKE :term", term: "%#{term}%")
44
44
  render json: query.all.collect { |u|
45
- {
46
- value: u.id,
47
- text: format_user_name(u),
48
- is_admin: u.read_attribute("admin")
49
- }
50
- }
45
+ {
46
+ value: u.id,
47
+ text: format_user_name(u),
48
+ is_admin: u.read_attribute("admin")
49
+ }
50
+ }
51
51
  else
52
52
  render json: []
53
53
  end
@@ -91,14 +91,12 @@ module Decidim
91
91
  DecidimAwesome.config.keys
92
92
  end
93
93
 
94
- # rubocop:disable Style/OpenStructUse
95
94
  def users_for(ids_list)
96
- Decidim::User.where(id: ids_list).map { |user| OpenStruct.new(text: format_user_name(user), id: user.id) }
95
+ Decidim::User.where(id: ids_list).map { |user| [format_user_name(user), user.id, { data: { is_admin: user.read_attribute("admin") } }] }
97
96
  end
98
- # rubocop:enable Style/OpenStructUse
99
97
 
100
98
  def format_user_name(user)
101
- "<span class='#{"is-admin" if user.read_attribute("admin")}'>#{user.name} (@#{user.nickname} - #{user.email})</span>"
99
+ "#{user.name} (@#{user.nickname} - #{user.email})"
102
100
  end
103
101
  end
104
102
  end
@@ -6,6 +6,7 @@ module Decidim
6
6
  # Constraints configuration controller for config keys
7
7
  class ConstraintsController < DecidimAwesome::Admin::ApplicationController
8
8
  include NeedsAwesomeConfig
9
+ include Decidim::Headers::HttpCachingDisabler
9
10
  helper ConfigConstraintsHelpers
10
11
 
11
12
  layout false
@@ -13,14 +14,14 @@ module Decidim
13
14
  render plain: "no permissions for #{constraint_key}" unless allowed_to? :edit_config, constraint_key
14
15
  end
15
16
 
16
- def new
17
- @form = form(ConstraintForm).from_params(filtered_params, setting: current_setting)
18
- end
19
-
20
17
  def show
21
18
  @form = form(ConstraintForm).from_params(constraint.settings.merge(filtered_params))
22
19
  end
23
20
 
21
+ def new
22
+ @form = form(ConstraintForm).from_params(filtered_params, setting: current_setting)
23
+ end
24
+
24
25
  def create
25
26
  @form = form(ConstraintForm).from_params(params, setting: current_setting)
26
27
  CreateConstraint.call(@form) do
@@ -39,11 +40,11 @@ module Decidim
39
40
 
40
41
  on(:invalid) do |message|
41
42
  render json: {
42
- id: params[:id],
43
- key: current_setting.var,
44
- message: I18n.t("decidim_awesome.admin.constraints.create.error", scope: "decidim"),
45
- error: message
46
- },
43
+ id: params[:id],
44
+ key: current_setting.var,
45
+ message: I18n.t("decidim_awesome.admin.constraints.create.error", scope: "decidim"),
46
+ error: message
47
+ },
47
48
  status: :unprocessable_entity
48
49
  end
49
50
  end
@@ -67,11 +68,11 @@ module Decidim
67
68
 
68
69
  on(:invalid) do |message|
69
70
  render json: {
70
- id: params[:id],
71
- key: constraint.awesome_config.var,
72
- message: I18n.t("decidim_awesome.admin.constraints.update.error", scope: "decidim"),
73
- error: message
74
- },
71
+ id: params[:id],
72
+ key: constraint.awesome_config.var,
73
+ message: I18n.t("decidim_awesome.admin.constraints.update.error", scope: "decidim"),
74
+ error: message
75
+ },
75
76
  status: :unprocessable_entity
76
77
  end
77
78
  end
@@ -94,11 +95,11 @@ module Decidim
94
95
 
95
96
  on(:invalid) do |message|
96
97
  render json: {
97
- id: params[:id],
98
- key: constraint.awesome_config.var,
99
- message: I18n.t("decidim_awesome.admin.constraints.destroy.error", scope: "decidim"),
100
- error: message
101
- },
98
+ id: params[:id],
99
+ key: constraint.awesome_config.var,
100
+ message: I18n.t("decidim_awesome.admin.constraints.destroy.error", scope: "decidim"),
101
+ error: message
102
+ },
102
103
  status: :unprocessable_entity
103
104
  end
104
105
  end
@@ -21,6 +21,10 @@ module Decidim
21
21
  @form = form(CustomRedirectForm).instance
22
22
  end
23
23
 
24
+ def edit
25
+ @form = form(CustomRedirectForm).from_model(redirect_item)
26
+ end
27
+
24
28
  def create
25
29
  @form = form(CustomRedirectForm).from_params(params)
26
30
  CreateCustomRedirect.call(@form) do
@@ -36,10 +40,6 @@ module Decidim
36
40
  end
37
41
  end
38
42
 
39
- def edit
40
- @form = form(CustomRedirectForm).from_model(redirect_item)
41
- end
42
-
43
43
  def update
44
44
  @form = form(CustomRedirectForm).from_params(params)
45
45
  UpdateCustomRedirect.call(@form, redirect_item) do
@@ -61,7 +61,7 @@ module Decidim
61
61
  flash[:notice] = I18n.t("custom_redirects.destroy.success", scope: "decidim.decidim_awesome.admin")
62
62
  end
63
63
  on(:invalid) do |error|
64
- flash[:alert] = I18n.t("custom_redirects.destroy.error", scope: "decidim.decidim_awesome.admin", error: error)
64
+ flash[:alert] = I18n.t("custom_redirects.destroy.error", scope: "decidim.decidim_awesome.admin", error:)
65
65
  end
66
66
  end
67
67
  redirect_to decidim_admin_decidim_awesome.custom_redirects_path
@@ -73,13 +73,11 @@ module Decidim
73
73
  origin, item = current_config.find { |origin, _| md5(origin) == params[:id] }
74
74
  raise ActiveRecord::RecordNotFound unless item
75
75
 
76
- # rubocop:disable Style/OpenStructUse
77
76
  OpenStruct.new(
78
- origin: origin,
77
+ origin:,
79
78
  destination: item["destination"],
80
79
  active: item["active"]
81
80
  )
82
- # rubocop:enable Style/OpenStructUse
83
81
  end
84
82
 
85
83
  def current_config
@@ -16,7 +16,7 @@ module Decidim
16
16
  helper_method :collection, :resource, :present, :time_ago
17
17
 
18
18
  before_action do
19
- enforce_permission_to :edit_config, :private_data, private_data: private_data
19
+ enforce_permission_to :edit_config, :private_data, private_data:
20
20
  end
21
21
 
22
22
  def show
@@ -64,7 +64,7 @@ module Decidim
64
64
  end
65
65
 
66
66
  def private_data_finder
67
- @private_data_finder ||= PrivateDataFinder.new
67
+ @private_data ||= PrivateDataFinder.new
68
68
  end
69
69
 
70
70
  def time_ago