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
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-decidim_awesome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Vergés
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-11-12 00:00:00.000000000 Z
11
+ date: 2024-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-admin
@@ -16,40 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.26.0
19
+ version: 0.28.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '0.28'
22
+ version: '0.29'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.26.0
29
+ version: 0.28.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '0.28'
32
+ version: '0.29'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: decidim-core
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 0.26.0
39
+ version: 0.28.0
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '0.28'
42
+ version: '0.29'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 0.26.0
49
+ version: 0.28.0
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '0.28'
52
+ version: '0.29'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: deface
55
55
  requirement: !ruby/object:Gem::Requirement
@@ -78,26 +78,6 @@ dependencies:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
80
  version: '2.3'
81
- - !ruby/object:Gem::Dependency
82
- name: decidim-dev
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- version: 0.26.0
88
- - - "<"
89
- - !ruby/object:Gem::Version
90
- version: '0.28'
91
- type: :development
92
- prerelease: false
93
- version_requirements: !ruby/object:Gem::Requirement
94
- requirements:
95
- - - ">="
96
- - !ruby/object:Gem::Version
97
- version: 0.26.0
98
- - - "<"
99
- - !ruby/object:Gem::Version
100
- version: '0.28'
101
81
  description: Some usability and UX tweaks for Decidim.
102
82
  email:
103
83
  - ivan@pokecode.net
@@ -109,22 +89,19 @@ files:
109
89
  - LICENSE-AGPLv3.txt
110
90
  - README.md
111
91
  - Rakefile
112
- - app/cells/concerns/decidim/decidim_awesome/proposal_m_cell_override.rb
92
+ - app/cells/concerns/decidim/decidim_awesome/global_menu_cell_override.rb
93
+ - app/cells/concerns/decidim/decidim_awesome/proposal_l_cell_override.rb
113
94
  - app/cells/decidim/decidim_awesome/content_blocks/map/error.erb
114
95
  - app/cells/decidim/decidim_awesome/content_blocks/map/show.erb
115
96
  - app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb
116
97
  - app/cells/decidim/decidim_awesome/content_blocks/map_form/show.erb
117
98
  - app/cells/decidim/decidim_awesome/content_blocks/map_form_cell.rb
99
+ - app/cells/decidim/decidim_awesome/voting/proposal_metadata_cell.rb
118
100
  - app/cells/decidim/decidim_awesome/voting/voting_cards_base_cell.rb
119
- - app/cells/decidim/decidim_awesome/voting/voting_cards_counter/show.erb
120
- - app/cells/decidim/decidim_awesome/voting/voting_cards_counter/vote_button.erb
121
- - app/cells/decidim/decidim_awesome/voting/voting_cards_counter_cell.rb
101
+ - app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/modal.erb
122
102
  - app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/show.erb
123
103
  - app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/vote_block_for.erb
124
104
  - app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_cell.rb
125
- - app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_modal/show.erb
126
- - app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_modal_cell.rb
127
- - app/cells/decidim/proposals/proposal_m/footer.erb
128
105
  - app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb
129
106
  - app/commands/concerns/decidim/decidim_awesome/proposals/admin/update_proposal_override.rb
130
107
  - app/commands/concerns/decidim/decidim_awesome/proposals/create_collaborative_draft_override.rb
@@ -153,6 +130,7 @@ files:
153
130
  - app/controllers/concerns/decidim/decidim_awesome/admin/maintenance_context.rb
154
131
  - app/controllers/concerns/decidim/decidim_awesome/admin_accountability/admin/filterable.rb
155
132
  - app/controllers/concerns/decidim/decidim_awesome/admin_accountability/admin/filterable_helper.rb
133
+ - app/controllers/concerns/decidim/decidim_awesome/content_security_policy.rb
156
134
  - app/controllers/concerns/decidim/decidim_awesome/limit_pending_amendments.rb
157
135
  - app/controllers/concerns/decidim/decidim_awesome/needs_awesome_config.rb
158
136
  - app/controllers/concerns/decidim/decidim_awesome/not_found_redirect.rb
@@ -183,6 +161,7 @@ files:
183
161
  - app/forms/decidim/decidim_awesome/admin/menu_form.rb
184
162
  - app/forms/decidim/decidim_awesome/editor_image_form.rb
185
163
  - app/helpers/concerns/decidim/decidim_awesome/amendments_helper_override.rb
164
+ - app/helpers/concerns/decidim/decidim_awesome/breadcrumb_helper_override.rb
186
165
  - app/helpers/concerns/decidim/decidim_awesome/proposals/application_helper_override.rb
187
166
  - app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb
188
167
  - app/helpers/decidim/decidim_awesome/admin/system_checker_helpers.rb
@@ -204,36 +183,38 @@ files:
204
183
  - app/overrides/decidim/proposals/admin/proposals/_form/replace_editor.html.erb.deface
205
184
  - app/overrides/decidim/proposals/admin/proposals/show/add_private_body.html.erb.deface
206
185
  - app/overrides/decidim/proposals/admin/proposals/show/replace_body.html.erb.deface
186
+ - app/overrides/decidim/proposals/proposals/_proposal_aside/limit_amendments_modal.html.erb.deface
207
187
  - app/overrides/decidim/proposals/proposals/_vote_button/replace_vote_button.html.erb.deface
208
188
  - app/overrides/decidim/proposals/proposals/_votes_count/replace_counter.html.erb.deface
209
- - app/overrides/decidim/proposals/proposals/show/limit_amendments_modal.html.erb.deface
210
- - app/overrides/layouts/decidim/_head/add_awesome_legacy_scripts.rb
189
+ - app/overrides/layouts/decidim/_decidim_javascript/add_awesome_tags.html.erb.deface
211
190
  - app/overrides/layouts/decidim/_head/add_awesome_tags.html.erb.deface
212
- - app/overrides/layouts/decidim/admin/_header/replace_scripts.html.erb.deface
213
- - app/overrides/layouts/decidim/admin/_header/replace_styles.html.erb.deface
191
+ - app/overrides/layouts/decidim/admin/_header/add_awesome_tags.html.erb.deface
214
192
  - app/packs/entrypoints/decidim_admin_decidim_awesome.js
215
193
  - app/packs/entrypoints/decidim_admin_decidim_awesome.scss
216
- - app/packs/entrypoints/decidim_admin_decidim_awesome_custom_fields.js
194
+ - app/packs/entrypoints/decidim_admin_decidim_awesome_global.js
195
+ - app/packs/entrypoints/decidim_admin_decidim_awesome_global.scss
217
196
  - app/packs/entrypoints/decidim_decidim_awesome.js
218
197
  - app/packs/entrypoints/decidim_decidim_awesome.scss
219
- - app/packs/entrypoints/decidim_decidim_awesome_admin_form_exit_warn.js
220
198
  - app/packs/entrypoints/decidim_decidim_awesome_custom_fields.js
221
199
  - app/packs/entrypoints/decidim_decidim_awesome_iframe.scss
222
200
  - app/packs/entrypoints/decidim_decidim_awesome_map.js
223
201
  - app/packs/entrypoints/decidim_decidim_awesome_map.scss
202
+ - app/packs/entrypoints/decidim_editor.js
224
203
  - app/packs/images/decidim/decidim_awesome/handcard.svg
225
204
  - app/packs/images/decidim/decidim_awesome/handcheck.svg
226
205
  - app/packs/images/decidim/decidim_awesome/pokecode-logo.png
227
206
  - app/packs/src/decidim/decidim_awesome/admin/auto_edit.js
228
207
  - app/packs/src/decidim/decidim_awesome/admin/check_redirections.js
229
208
  - app/packs/src/decidim/decidim_awesome/admin/codemirror.js
230
- - app/packs/src/decidim/decidim_awesome/admin/constraints.js
209
+ - app/packs/src/decidim/decidim_awesome/admin/constraint_form_events.js
231
210
  - app/packs/src/decidim/decidim_awesome/admin/custom_fields_builder.js
232
211
  - app/packs/src/decidim/decidim_awesome/admin/form_exit_warn.js
233
212
  - app/packs/src/decidim/decidim_awesome/admin/proposal_sortings.js
213
+ - app/packs/src/decidim/decidim_awesome/admin/tabs_change.js
234
214
  - app/packs/src/decidim/decidim_awesome/admin/user_picker.js
235
215
  - app/packs/src/decidim/decidim_awesome/amendments/show_modal_on_limits.js
236
216
  - app/packs/src/decidim/decidim_awesome/awesome_admin.js
217
+ - app/packs/src/decidim/decidim_awesome/awesome_admin_global.js
237
218
  - app/packs/src/decidim/decidim_awesome/awesome_application.js
238
219
  - app/packs/src/decidim/decidim_awesome/awesome_map/api/api_fetcher.js
239
220
  - app/packs/src/decidim/decidim_awesome/awesome_map/api/fetcher.js
@@ -245,8 +226,7 @@ files:
245
226
  - app/packs/src/decidim/decidim_awesome/awesome_map/controllers/proposals_controller.js
246
227
  - app/packs/src/decidim/decidim_awesome/awesome_map/controls_ui.js
247
228
  - app/packs/src/decidim/decidim_awesome/awesome_map/load_map.js
248
- - app/packs/src/decidim/decidim_awesome/editors/editor.js
249
- - app/packs/src/decidim/decidim_awesome/editors/tabs_focus.js
229
+ - app/packs/src/decidim/decidim_awesome/editor/index.js
250
230
  - app/packs/src/decidim/decidim_awesome/forms/autosave.js
251
231
  - app/packs/src/decidim/decidim_awesome/forms/custom_fields_renderer.js
252
232
  - app/packs/src/decidim/decidim_awesome/forms/rich_text_plugin.js
@@ -259,21 +239,22 @@ files:
259
239
  - app/packs/stylesheets/decidim/decidim_awesome/admin/codemirror.scss
260
240
  - app/packs/stylesheets/decidim/decidim_awesome/admin/constraints.scss
261
241
  - app/packs/stylesheets/decidim/decidim_awesome/admin/custom_fields.scss
242
+ - app/packs/stylesheets/decidim/decidim_awesome/admin/custom_styles.scss
243
+ - app/packs/stylesheets/decidim/decidim_awesome/admin/intergram_fixes.scss
262
244
  - app/packs/stylesheets/decidim/decidim_awesome/admin/user_picker.scss
245
+ - app/packs/stylesheets/decidim/decidim_awesome/amendments/modal.scss
263
246
  - app/packs/stylesheets/decidim/decidim_awesome/awesome_admin.scss
264
247
  - app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss
265
248
  - app/packs/stylesheets/decidim/decidim_awesome/awesome_application.scss
266
249
  - app/packs/stylesheets/decidim/decidim_awesome/awesome_iframe/iframe.scss
267
250
  - app/packs/stylesheets/decidim/decidim_awesome/awesome_map/map.scss
268
- - app/packs/stylesheets/decidim/decidim_awesome/editors/markdown_editor.scss
269
- - app/packs/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss
270
251
  - app/packs/stylesheets/decidim/decidim_awesome/forms/autosave.scss
271
252
  - app/packs/stylesheets/decidim/decidim_awesome/forms/custom_fields.scss
272
253
  - app/packs/stylesheets/decidim/decidim_awesome/shared/spinner.scss
273
254
  - app/packs/stylesheets/decidim/decidim_awesome/voting/voting_cards.scss
274
- - app/packs/stylesheets/vendor/select2-foundation-theme.scss
275
255
  - app/permissions/decidim/decidim_awesome/admin/permissions.rb
276
256
  - app/permissions/decidim/decidim_awesome/permissions.rb
257
+ - app/presenters/concerns/decidim/decidim_awesome/breadcrumb_root_menu_item_presenter_override.rb
277
258
  - app/presenters/concerns/decidim/decidim_awesome/menu_item_presenter_override.rb
278
259
  - app/presenters/concerns/decidim/decidim_awesome/menu_presenter_override.rb
279
260
  - app/presenters/concerns/decidim/decidim_awesome/proposals/proposal_presenter_override.rb
@@ -284,7 +265,6 @@ files:
284
265
  - app/presenters/decidim/decidim_awesome/role_base_presenter.rb
285
266
  - app/presenters/decidim/decidim_awesome/user_entity_presenter.rb
286
267
  - app/queries/decidim/decidim_awesome/private_data_finder.rb
287
- - app/serializers/concerns/decidim/decidim_awesome/proposal_serializer_override.rb
288
268
  - app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_methods.rb
289
269
  - app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_override.rb
290
270
  - app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb
@@ -307,7 +287,6 @@ files:
307
287
  - app/views/decidim/decidim_awesome/admin/config/_form_proposals.html.erb
308
288
  - app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb
309
289
  - app/views/decidim/decidim_awesome/admin/config/_form_surveys.html.erb
310
- - app/views/decidim/decidim_awesome/admin/config/_modal.html.erb
311
290
  - app/views/decidim/decidim_awesome/admin/config/show.html.erb
312
291
  - app/views/decidim/decidim_awesome/admin/constraints/_form.html.erb
313
292
  - app/views/decidim/decidim_awesome/admin/constraints/new.html.erb
@@ -332,7 +311,6 @@ files:
332
311
  - app/views/decidim/decidim_awesome/map_component/map/_map_template.html.erb
333
312
  - app/views/decidim/decidim_awesome/map_component/map/error.html.erb
334
313
  - app/views/decidim/decidim_awesome/map_component/map/show.html.erb
335
- - app/views/decidim/decidim_awesome/voting/voting_cards/_proposal_m_cell_footer.erb
336
314
  - app/views/decidim/decidim_awesome/voting/voting_cards/_show_vote_button.html.erb
337
315
  - app/views/decidim/decidim_awesome/voting/voting_cards/_show_votes_count.html.erb
338
316
  - app/views/layouts/decidim/decidim_awesome/_awesome_config.html.erb
@@ -360,12 +338,18 @@ files:
360
338
  - config/locales/pt.yml
361
339
  - config/locales/ro-RO.yml
362
340
  - config/locales/sv.yml
341
+ - config/rubocop/disabled.yml
342
+ - config/rubocop/faker.yml
343
+ - config/rubocop/rails.yml
344
+ - config/rubocop/rspec.yml
345
+ - config/rubocop/ruby.yml
363
346
  - db/migrate/20200324170000_create_decidim_awesome_config.rb
364
347
  - db/migrate/20200324230936_create_awesome_editor_images.rb
365
348
  - db/migrate/20200403142257_create_decidim_awesome_config_constraints.rb
366
349
  - db/migrate/20210628150825_change_awesome_config_var_type.rb
367
350
  - db/migrate/20231006113837_create_decidim_awesome_vote_weights.rb
368
351
  - db/migrate/20231006113841_create_decidim_awesome_proposal_extra_fields.rb
352
+ - db/migrate/20240306175331_rename_editor_images_awesome_config.rb
369
353
  - db/migrate/20240531224204_add_decidim_awesome_proposal_private_fields.rb
370
354
  - db/migrate/20240729164227_add_decidim_awesome_proposal_private_fields_date.rb
371
355
  - db/seeds.rb
@@ -421,7 +405,7 @@ licenses:
421
405
  - AGPL-3.0
422
406
  metadata:
423
407
  rubygems_mfa_required: 'true'
424
- post_install_message:
408
+ post_install_message:
425
409
  rdoc_options: []
426
410
  require_paths:
427
411
  - lib
@@ -429,7 +413,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
429
413
  requirements:
430
414
  - - ">="
431
415
  - !ruby/object:Gem::Version
432
- version: '2.7'
416
+ version: '3.1'
433
417
  required_rubygems_version: !ruby/object:Gem::Requirement
434
418
  requirements:
435
419
  - - ">="
@@ -437,7 +421,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
437
421
  version: '0'
438
422
  requirements: []
439
423
  rubygems_version: 3.5.10
440
- signing_key:
424
+ signing_key:
441
425
  specification_version: 4
442
426
  summary: A decidim decidim_awesome module
443
427
  test_files: []
@@ -1,18 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module DecidimAwesome
5
- module ProposalMCellOverride
6
- extend ActiveSupport::Concern
7
-
8
- included do
9
- alias_method :decidim_original_cache_hash, :cache_hash
10
-
11
- def cache_hash
12
- extra_hash = model.extra_fields&.reload&.vote_weight_totals
13
- "#{decidim_original_cache_hash}#{Decidim.cache_key_separator}#{extra_hash}"
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,15 +0,0 @@
1
- <% unless proposal.rejected? || proposal.withdrawn? %>
2
- <% unless current_settings.votes_hidden? %>
3
- <span class="votes_counter">
4
- <span data-weight="3" title="<%= proposal.manifest.label_for(3) %>" class="weight_3"><%= t("decidim.decidim_awesome.voting.voting_cards.weights.weight_3_short") %> <%= model.weight_count(3) %></span> |
5
- <span data-weight="2" title="<%= proposal.manifest.label_for(2) %>" class="weight_2"><%= t("decidim.decidim_awesome.voting.voting_cards.weights.weight_2_short") %> <%= model.weight_count(2) %></span> |
6
- <span data-weight="1" title="<%= proposal.manifest.label_for(1) %>" class="weight_1"><%= t("decidim.decidim_awesome.voting.voting_cards.weights.weight_1_short") %> <%= model.weight_count(1) %></span>
7
- <% if current_component.settings.voting_cards_show_abstain %>
8
- | <span title="<%= proposal.manifest.label_for(0) %>" data-weight="0" class="weight_0"><%= t("decidim.decidim_awesome.voting.voting_cards.weights.weight_0_short") %> <%= model.weight_count(0) %></span>
9
- <% end %>
10
- </span>
11
- <% end %>
12
- <div id="proposal-<%= model.id %>-vote-button">
13
- <%= render "vote_button" %>
14
- </div>
15
- <% end %>
@@ -1,15 +0,0 @@
1
- <%= link_to resource_path,
2
- class: "button #{vote_btn_class} small button--sc#{" disabled" if current_settings.votes_blocked?}",
3
- title: t("decidim.decidim_awesome.voting.voting_cards.vote_button") do %>
4
- <% if user_voted_weight %>
5
- <%= icon "actions", class: "icon" %> <%= t("decidim.decidim_awesome.voting.voting_cards.voted") %>
6
- <% elsif proposal.maximum_votes_reached? && !proposal.can_accumulate_supports_beyond_threshold && current_component.participatory_space.can_participate?(current_user) %>
7
- <%= t("decidim.proposals.proposals.vote_button.maximum_votes_reached") %>
8
- <% elsif vote_limit_enabled? && remaining_votes_count_for(current_user) <= 0 %>
9
- <%= t("decidim.proposals.proposals.vote_button.no_votes_remaining") %>
10
- <% elsif current_settings.votes_blocked? || !current_component.participatory_space.can_participate?(current_user) %>
11
- <%= t("decidim.proposals.proposals.vote_button.votes_blocked") %>
12
- <% else %>
13
- <%= t("decidim.decidim_awesome.voting.voting_cards.vote_button") %>
14
- <% end %>
15
- <% end %>
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module DecidimAwesome
5
- module Voting
6
- class VotingCardsCounterCell < VotingCardsBaseCell
7
- def show
8
- render :show
9
- end
10
-
11
- def resource_path
12
- resource_locator(model).path
13
- end
14
-
15
- def vote_btn_class
16
- user_voted_weight ? "weight_#{user_voted_weight.to_i}" : "hollow"
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,16 +0,0 @@
1
- <!--the modal window will be used in another pr-->
2
- <div class="reveal vote_proposal_modal voting-voting_cards" id="VotingCardsModalHelp" data-reveal role="dialog" aria-modal="true" aria-labelledby="VotingCardsModalHelp-label">
3
- <div class="reveal__content">
4
- <div class="instructions"><%= vote_instructions %></div>
5
- <div class="current-choice voting-voting_cards"><div class="vote-card"></div></div>
6
- <div class="future-dismiss">
7
- <%= check_box_tag "voting_cards-skip_help", current_component.id, false %>
8
- <%= label_tag "voting_cards-skip_help", t("decidim.decidim_awesome.voting.voting_cards.modal.skip") %>
9
- </div>
10
-
11
- <div class="text-center">
12
- <button class="button vote-action"><%= t("decidim.decidim_awesome.voting.voting_cards.modal.proceed") %></button>
13
- <button class="button cancel-action hollow secondary" data-close><%= t("decidim.decidim_awesome.voting.voting_cards.modal.cancel") %></button>
14
- </div>
15
- </div>
16
- </div>
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module DecidimAwesome
5
- module Voting
6
- class VotingCardsProposalModalCell < VotingCardsBaseCell
7
- include Decidim::Proposals::Engine.routes.url_helpers
8
-
9
- def show
10
- render :show
11
- end
12
-
13
- def vote_instructions
14
- translated_attribute(current_component.settings.voting_cards_instructions).presence || t("decidim.decidim_awesome.voting.voting_cards.default_instructions_html",
15
- organization: current_organization.name)
16
- end
17
- end
18
- end
19
- end
20
- end
@@ -1,13 +0,0 @@
1
- <%#
2
- A hack for the Trailblazer Cell component, here we obtain the "parent" view
3
- https://github.com/trailblazer/cells/blob/master/lib/cell/view_model.rb#L102
4
- renders parent view by removing the awesome override from the paths
5
- %>
6
- <% original = normalize_options(:footer) %>
7
- <% original[:prefixes] = original[:prefixes].filter {|path| path != Decidim::DecidimAwesome::Engine.root.join("app/cells/decidim/proposals/proposal_m").to_s } %>
8
-
9
- <% if view = awesome_voting_manifest_for(current_component)&.proposal_m_cell_footer %>
10
- <%= render partial: view if view.present? %>
11
- <% else %>
12
- <%= render original %>
13
- <% end %>
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Deface::Override.new(virtual_path: "layouts/decidim/_head",
4
- name: "legacy_awesome_scripts",
5
- insert_after: 'erb[loud]:contains(\'javascript_pack_tag "decidim_core"\')') do
6
- # NOTE THAT THIS ONLY APPLIES TO DECIDIM 0.26. This will be ignored in 0.27
7
- '
8
- <%= javascript_pack_tag "decidim_decidim_awesome", defer: false %>
9
- <%= javascript_pack_tag("decidim_decidim_awesome_custom_fields") if Decidim::DecidimAwesome.enabled?(:proposal_custom_fields) %>
10
- <% if show_public_intergram? %>
11
- <%= render partial: "layouts/decidim/decidim_awesome/intergram_widget", locals: { settings: organization_awesome_config[:intergram_for_public_settings] } %>
12
- <% end %>
13
- '
14
- end
@@ -1,3 +0,0 @@
1
- <!-- replace "erb[loud]:contains('stylesheet_pack_tag')" -->
2
-
3
- <%= stylesheet_pack_tag "decidim_admin_decidim_awesome", media: "all" %>
@@ -1,2 +0,0 @@
1
- import "src/decidim/decidim_awesome/proposals/custom_fields"
2
- import "src/decidim/decidim_awesome/admin/custom_fields_builder"
@@ -1 +0,0 @@
1
- import "src/decidim/decidim_awesome/admin/form_exit_warn"
@@ -1,55 +0,0 @@
1
- $(() => {
2
- const $modal = $("#constraintsModal");
3
- if (!$modal.length) {
4
- return;
5
- }
6
-
7
- $(".decidim_awesome-form").on("click", ".constraints-editor .add-condition,.constraints-editor .edit-condition", (evt) => {
8
- evt.preventDefault();
9
- const $this = $(evt.target)
10
- const url = $this.attr("href") || $this.data("constraints-url");
11
- const $callout = $this.closest(".constraints-editor").find(".callout");
12
- $callout.hide();
13
- $callout.removeClass("alert success");
14
- $modal.find(".modal-content").html("");
15
- $modal.addClass("loading");
16
- $modal.data("url", url);
17
- $modal.foundation("open");
18
- $modal.find(".modal-content").load(url, () => {
19
- $modal.removeClass("loading");
20
- });
21
- });
22
-
23
- // Custom event listener to reload the modal if needed
24
- document.body.addEventListener("constraint:change", (evt) => {
25
- const vars = evt.detail.map((setting) => `${setting.key}=${setting.value}`);
26
- const url = `${$modal.data("url")}&${vars.join("&")}`;
27
- // console.log("constraint:change vars:", vars, "url:", url)
28
- $modal.addClass("loading");
29
- $modal.find(".modal-content").load(url, () => {
30
- $modal.removeClass("loading");
31
- });
32
- });
33
-
34
- // Rails AJAX events
35
- document.body.addEventListener("ajax:error", (responseText) => {
36
- // console.log("ajax:error", responseText)
37
- const $container = $(`.constraints-editor[data-key="${responseText.detail[0].key}"]`)
38
- const $callout = $container.find(".callout");
39
- $callout.show();
40
- $callout.contents("p").html(`${responseText.detail[0].message}: <strong>${responseText.detail[0].error}</strong>`);
41
- $callout.addClass("alert");
42
- });
43
-
44
- document.body.addEventListener("ajax:success", (responseText) => {
45
- // console.log("ajax:success", responseText)
46
- const $container = $(`.constraints-editor[data-key="${responseText.detail[0].key}"]`)
47
- const $callout = $container.find(".callout");
48
- $modal.foundation("close");
49
- $callout.show();
50
- $callout.contents("p").html(responseText.detail[0].message);
51
- $callout.addClass("success");
52
- // reconstruct list
53
- $container.replaceWith(responseText.detail[0].html);
54
- });
55
- });