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,115 @@
1
+ /* eslint no-use-before-define: "off" */
2
+
3
+ // This script manually handles the "edit" button from the constraints editor by loading the content into the modal after the modal (operated by Dialog) is opened.
4
+ // We don't use the RemoteModal class because it chaches the modal content and the "fetch" operation does not specify the "no-cache" headers.
5
+
6
+ const fetchConstraints = (url, callback = () => {}) => {
7
+ fetch(url, { cache: "no-cache" }).
8
+ then((res) => {
9
+ if (!res.ok) {
10
+ throw res;
11
+ }
12
+ return res.text();
13
+ }).
14
+ then((text) => {
15
+ callback(text);
16
+ }).
17
+ catch((err) => {
18
+ console.error("dialog open failed", err);
19
+ });
20
+ };
21
+
22
+ const renderModal = (element, html) => {
23
+ element.innerHTML = html;
24
+ bindModalEvents(element)
25
+ };
26
+
27
+ const constraintChange = (modalId, data) => {
28
+ const modal = window.Decidim.currentDialogs[modalId];
29
+ const constraintsUrl = modal.openingTrigger.dataset.constraintsUrl;
30
+
31
+ // Prepare parameters to request the modal content again, but updated based on the user selections
32
+ const vars = data.map((setting) => `${setting.key}=${setting.value}`);
33
+ const url = `${constraintsUrl}&${vars.join("&")}`;
34
+
35
+ fetchConstraints(url, (res) => renderModal(modal.dialog, res));
36
+ };
37
+
38
+ const bindModalEvents = (detail) => {
39
+ const div = detail.querySelector("[id^=constraint-form]");
40
+ const spaceManifest = div.getElementsByTagName("select")[0];
41
+ const spaceSlug = div.getElementsByTagName("select")[1];
42
+ const componentManifest = div.getElementsByTagName("select")[2];
43
+ const componentId = div.getElementsByTagName("select")[3];
44
+
45
+ spaceManifest.addEventListener("change", (event) => {
46
+ constraintChange(detail.id, [{
47
+ key: "participatory_space_manifest",
48
+ value: event.target.value
49
+ }])
50
+ });
51
+
52
+ spaceSlug.addEventListener("change", (event) => {
53
+ constraintChange(detail.id, [{
54
+ key: "participatory_space_manifest",
55
+ value: spaceManifest.value
56
+ }, {
57
+ key: "participatory_space_slug",
58
+ value: event.target.value
59
+ }])
60
+ });
61
+
62
+ // Component manfiest and component id are mutually exclusive
63
+ componentManifest.addEventListener("change", (event) => {
64
+ if (event.target.value) {
65
+ componentId.value = "";
66
+ }
67
+ });
68
+
69
+ componentId.addEventListener("change", (event) => {
70
+ if (event.target.value) {
71
+ componentManifest.value = "";
72
+ }
73
+ });
74
+ };
75
+
76
+
77
+ const initializeDialog = (dialog) => {
78
+ dialog.addEventListener("open.dialog", async (el) => {
79
+ const currentDialog = window.Decidim.currentDialogs[el.target.id];
80
+ const button = currentDialog && currentDialog.openingTrigger;
81
+ const url = button.dataset.constraintsUrl;
82
+ // console.log("open.dialog", el, url, "currentDialog",currentDialog);
83
+ fetchConstraints(url, (res) => renderModal(el.target, res));
84
+ });
85
+ };
86
+
87
+ document.addEventListener("DOMContentLoaded", () => {
88
+ document.querySelectorAll("[data-constraint][data-dialog]").forEach((dialog) => {
89
+ initializeDialog(dialog);
90
+ });
91
+ });
92
+
93
+ document.addEventListener("ajax:loaded:modals", (event) => {
94
+ event.detail.forEach((modal) => initializeDialog(modal));
95
+ });
96
+
97
+ // Rails AJAX events, this will update the parent page constrains
98
+ document.body.addEventListener("ajax:error", (responseText) => {
99
+ // console.log("ajax:error", responseText)
100
+ const container = document.querySelector(`.constraints-editor[data-key="${responseText.detail[0].key}"]`);
101
+ const callout = container.querySelector(".flash");
102
+ callout.hidden = false;
103
+ callout.classList.add("alert");
104
+ callout.getElementsByTagName("p")[0].innerHTML = `${responseText.detail[0].message}: <strong>${responseText.detail[0].error}</strong>`;
105
+ });
106
+
107
+ document.body.addEventListener("ajax:success", (responseText) => {
108
+ // console.log("ajax:success", responseText)
109
+ let container = document.querySelector(`.constraints-editor[data-key="${responseText.detail[0].key}"]`);
110
+ const callout = container.querySelector(".flash");
111
+ callout.hidden = false;
112
+ callout.classList.add("success");
113
+ callout.getElementsByTagName("p")[0].innerHTML = responseText.detail[0].message;
114
+ container.outerHTML = responseText.detail[0].html;
115
+ });
@@ -1,21 +1,26 @@
1
- require("formBuilder/dist/form-builder.min.js")
1
+ import "formBuilder/dist/form-builder.min.js";
2
2
  import "src/decidim/decidim_awesome/forms/rich_text_plugin"
3
+ // formBuilder uses jquery-ui-sortable which is a very dirty npm package with no neat source code available, and causes problems with the webpacker configuration of Decidim.
4
+ // For the moment, we'll remove the sortable functionality with a dummy jQuery plugin until we find another sortable plugin (or keep it disabled for good)
5
+ jQuery.fn.sortable = () => {}
3
6
 
4
7
  window.CustomFieldsBuilders = window.CustomFieldsBuilders || [];
5
8
 
6
9
  $(() => {
7
10
  $(".awesome-edit-config .proposal_custom_fields_editor").each((_idx, el) => {
8
11
  const key = $(el).closest(".proposal_custom_fields_container").data("key");
12
+ const configVar = $(el).closest(".proposal_custom_fields_container").data("var");
9
13
  // DOCS: https://formbuilder.online/docs
10
14
  window.CustomFieldsBuilders.push({
11
15
  el: el,
12
16
  key: key,
17
+ var: configVar,
13
18
  config: {
14
19
  i18n: {
15
20
  locale: "en-US",
16
21
  location: "https://cdn.jsdelivr.net/npm/formbuilder-languages@1.1.0/"
17
22
  },
18
- formData: $(`input[name="config[proposal_custom_fields][${key}]"]`).val(),
23
+ formData: $(`input[name="config[${configVar}][${key}]"]`).val(),
19
24
  disableFields: ["button", "file"],
20
25
  disabledActionButtons: ["save", "data", "clear"],
21
26
  disabledAttrs: [
@@ -37,7 +42,7 @@ $(() => {
37
42
  ],
38
43
  disabledSubtypes: {
39
44
  // default color as it generate hashtags in decidim (TODO: fix hashtag generator with this)
40
- text: ["color"],
45
+ text: ["color"],
41
46
  // disable default wysiwyg editors as they present problems
42
47
  textarea: ["tinymce", "quill"]
43
48
  }
@@ -71,8 +76,7 @@ $(() => {
71
76
 
72
77
  $("form.awesome-edit-config").on("submit", () => {
73
78
  window.CustomFieldsBuilders.forEach((builder) => {
74
- $(`input[name="config[proposal_custom_fields][${builder.key}]"]`).val(builder.instance.actions.getData("json"));
79
+ $(`input[name="config[${builder.var}][${builder.key}]"]`).val(builder.instance.actions.getData("json"));
75
80
  });
76
81
  });
77
82
  });
78
-
@@ -1,21 +1,32 @@
1
- $(() => {
2
- const $form = $("form.awesome-edit-config");
3
- if ($form.length > 0) {
4
- $form.find("input, textarea, select").on("change", () => {
5
- $form.data("changed", true);
1
+ document.addEventListener("DOMContentLoaded", () => {
2
+ const form = document.querySelector("form.awesome-edit-config");
3
+ if (form) {
4
+ form.querySelectorAll("input, textarea, select").forEach((el) => {
5
+ el.addEventListener("change", () => {
6
+ form.dataset.changed = true;
7
+ });
6
8
  });
7
9
 
8
- const safePath = $form.data("safe-path").split("?")[0];
9
- $(document).on("click", "a", (event) => {
10
- window.exitUrl = event.currentTarget.href;
10
+ const safePath = form.dataset.safePath.split("?")[0];
11
+ document.querySelectorAll("a").forEach((el) => {
12
+ el.addEventListener("click", () => {
13
+ window.exitUrl = el.href;
14
+ });
11
15
  });
12
- $(document).on("submit", "form", (event) => {
13
- window.exitUrl = event.currentTarget.action;
16
+ document.querySelectorAll("form").forEach((el) => {
17
+ el.addEventListener("submit", () => {
18
+ window.exitUrl = el.action;
19
+ });
20
+ });
21
+ document.querySelectorAll('[type="submit"]').forEach((el) => {
22
+ el.addEventListener("click", () => {
23
+ window.exitUrl = el.form.action;
24
+ });
14
25
  });
15
26
 
16
27
  window.addEventListener("beforeunload", (event) => {
17
28
  const exitUrl = window.exitUrl;
18
- const hasChanged = $form.data("changed");
29
+ const hasChanged = form.dataset.changed;
19
30
  window.exitUrl = null;
20
31
 
21
32
  if (!hasChanged || (exitUrl && exitUrl.includes(safePath))) {
@@ -1,13 +1,31 @@
1
- import "select2"
1
+ /* eslint-disable no-new */
2
2
 
3
- $(() => {
4
- const $select = $("#config_additional_proposal_sortings");
5
- $select.select2({
6
- theme: "foundation"
3
+ import TomSelect from "tom-select/dist/cjs/tom-select.popular";
4
+
5
+ document.addEventListener("DOMContentLoaded", () => {
6
+ const selectContainer = document.getElementById("config_additional_proposal_sortings");
7
+
8
+ if (!selectContainer) {
9
+ return;
10
+ }
11
+
12
+ new TomSelect(selectContainer, {
13
+ plugins: ["remove_button", "dropdown_input"],
14
+ create: false,
15
+ render: {
16
+ option: function (data, escape) {
17
+ return `<div>${escape(data.text)}</div>`;
18
+ },
19
+ item: function (data, escape) {
20
+ return Boolean(data.is_admin) || data.isAdmin === "true"
21
+ ? `<div class="is-admin">${escape(data.text)}</div>`
22
+ : `<div>${escape(data.text)}</div>`;
23
+ }
24
+ }
7
25
  });
8
- $("#additional_proposal_sortings-enable-all").on("click", (evt) => {
26
+
27
+ document.getElementById("additional_proposal_sortings-enable-all").addEventListener("click", (evt) => {
9
28
  evt.preventDefault();
10
- $select.find("option").prop("selected", true);
11
- $select.trigger("change");
29
+ selectContainer.tomselect.setValue(Array.from(document.getElementById("config_additional_proposal_sortings").children).map((el) => el.value))
12
30
  });
13
31
  });
@@ -0,0 +1,31 @@
1
+ /**
2
+ * When switching tabs in i18n fields, autofocus on the markdown if exists
3
+ */
4
+ $(() => {
5
+ const reloadCustomFields = ($input) => {
6
+ // saves current data to the hidden field for the lang
7
+ window.DecidimAwesome.CustomFieldsRenderer.storeData();
8
+ // init the current language
9
+ window.DecidimAwesome.CustomFieldsRenderer.init($input);
10
+ };
11
+
12
+ // Event launched by foundation using jQuery (still used in the admin in v0.28, probably removed in the future)
13
+ $("[data-tabs]").on("change.zf.tabs", (event) => {
14
+ const $container = $(event.target).closest(".label--tabs").next(".tabs-content").find(".tabs-panel.is-active");
15
+ // fix custom fields if present
16
+ const $input = $container.find(".proposal_custom_field:first");
17
+ if ($input.length > 0) {
18
+ reloadCustomFields($input);
19
+ }
20
+ });
21
+
22
+ // if more than 3 languages, a select is used
23
+ $("#proposal-body-tabs").on("change", (event) => {
24
+ const $container = $($(event.target).val());
25
+ // fix custom fields if present
26
+ const $input = $container.find(".proposal_custom_field:first");
27
+ if ($input.length > 0) {
28
+ reloadCustomFields($input);
29
+ }
30
+ });
31
+ });
@@ -1,25 +1,38 @@
1
- /* eslint-disable no-invalid-this */
2
- import "select2"
3
- import "stylesheets/decidim/decidim_awesome/admin/user_picker.scss"
1
+ import TomSelect from "tom-select/dist/cjs/tom-select.popular";
4
2
 
5
- $(() => {
6
- $("select.multiusers-select").each(function() {
7
- const url = $(this).attr("data-url");
8
- $(this).select2({
9
- ajax: {
10
- url: url,
11
- delay: 100,
12
- dataType: "json",
13
- processResults: (data) => {
14
- return {
15
- results: data
16
- }
17
- }
3
+ document.addEventListener("DOMContentLoaded", () => {
4
+ const tagContainers = document.querySelectorAll(".multiusers-select");
5
+ const config = (element) => ({
6
+ plugins: ["remove_button", "dropdown_input"],
7
+ create: false,
8
+ render: {
9
+ option: function (data, escape) {
10
+ return `<div>${escape(data.text)}</div>`;
18
11
  },
19
- escapeMarkup: (markup) => markup,
20
- templateSelection: (item) => `${item.text}`,
21
- minimumInputLength: 1,
22
- theme: "foundation"
23
- });
12
+ item: function (data, escape) {
13
+ return Boolean(data.is_admin) || data.isAdmin === "true"
14
+ ? `<div class="is-admin">${escape(data.text)}</div>`
15
+ : `<div>${escape(data.text)}</div>`;
16
+ }
17
+ },
18
+ shouldLoad: function (query) {
19
+ return query.length > 1;
20
+ },
21
+ load: function (query, callback) {
22
+ const { url } = element.dataset;
23
+ const join = url.includes("?")
24
+ ? "&"
25
+ : "?";
26
+ const params = new URLSearchParams({
27
+ term: query
28
+ });
29
+
30
+ fetch(`${url}${join}${params}`).
31
+ then((response) => response.json()).
32
+ then((json) => callback(json)).
33
+ catch(() => callback());
34
+ }
24
35
  });
36
+
37
+ tagContainers.forEach((container) => new TomSelect(container, config(container)));
25
38
  });
@@ -0,0 +1,28 @@
1
+ document.addEventListener("DOMContentLoaded", () => {
2
+ const modalId = "LimitAmendmentsModal";
3
+ const modalEl = document.getElementById(modalId);
4
+ const amendButton = document.getElementById("amend-button");
5
+ const limitAmendments = modalEl && JSON.parse(modalEl.dataset.limitAmendments);
6
+
7
+ if (!amendButton || !limitAmendments || document.querySelector('a[href^="/users/sign_in"]')) {
8
+ return;
9
+ }
10
+
11
+ modalEl.querySelectorAll("a").forEach((aEl) => {
12
+ aEl.addEventListener("click", () => {
13
+ window.Decidim.currentDialogs[modalId].close();
14
+ });
15
+ });
16
+
17
+ /**
18
+ * Determines if the modal should be displayed based on its current state and data attributes.
19
+ */
20
+ amendButton.addEventListener("click", (event) => {
21
+ const modal = window.Decidim.currentDialogs[modalId];
22
+ if (modal) {
23
+ event.preventDefault();
24
+ event.stopPropagation();
25
+ modal.open();
26
+ }
27
+ });
28
+ });
@@ -1,24 +1,13 @@
1
- // Webpack seems to "forgget" about certain libraries already being loaded
2
- // if javascript_pack_tag is called two times, let's include the whole Decidim admin here instead
3
- import "entrypoints/decidim_admin"
4
1
  // Custom scripts for awesome
5
- import "src/decidim/decidim_awesome/admin/constraints"
2
+ import "src/decidim/decidim_awesome/admin/constraint_form_events"
6
3
  import "src/decidim/decidim_awesome/admin/auto_edit"
7
4
  import "src/decidim/decidim_awesome/admin/user_picker"
8
5
  import "src/decidim/decidim_awesome/admin/proposal_sortings"
9
- import "src/decidim/decidim_awesome/editors/tabs_focus"
10
6
  import "src/decidim/decidim_awesome/admin/codemirror"
11
7
  import "src/decidim/decidim_awesome/admin/check_redirections"
8
+ import "src/decidim/decidim_awesome/admin/form_exit_warn"
12
9
 
13
- import {destroyQuillEditor, createQuillEditor, createMarkdownEditor} from "src/decidim/decidim_awesome/editors/editor"
10
+ import "src/decidim/decidim_awesome/proposals/custom_fields"
11
+ import "src/decidim/decidim_awesome/admin/custom_fields_builder"
14
12
 
15
- $(() => {
16
- $(".editor-container").each((_idx, container) => {
17
- destroyQuillEditor(container);
18
- if (window.DecidimAwesome.use_markdown_editor) {
19
- createMarkdownEditor(container);
20
- } else {
21
- createQuillEditor(container);
22
- }
23
- });
24
- });
13
+ window.DecidimAwesome = window.DecidimAwesome || {};
@@ -0,0 +1 @@
1
+ import "src/decidim/decidim_awesome/admin/tabs_change"
@@ -1,18 +1,4 @@
1
1
  import "src/decidim/decidim_awesome/proposals/images"
2
2
  import "src/decidim/decidim_awesome/forms/autosave"
3
3
  import "src/decidim/decidim_awesome/voting/voting_cards"
4
- import {destroyQuillEditor, createQuillEditor, createMarkdownEditor} from "src/decidim/decidim_awesome/editors/editor"
5
-
6
- $(() => {
7
- // rebuild editors
8
- if (window.DecidimAwesome.allow_images_in_full_editor || window.DecidimAwesome.allow_images_in_small_editor || window.DecidimAwesome.use_markdown_editor) {
9
- $(".editor-container").each((_idx, container) => {
10
- destroyQuillEditor(container);
11
- if (window.DecidimAwesome.use_markdown_editor) {
12
- createMarkdownEditor(container);
13
- } else {
14
- createQuillEditor(container);
15
- }
16
- });
17
- }
18
- });
4
+ import "src/decidim/decidim_awesome/amendments/show_modal_on_limits"
@@ -30,7 +30,7 @@ export default class Fetcher {
30
30
  api.fetchAll((result) => {
31
31
  if (result) {
32
32
  const collection = result.component[this.collection];
33
- // console.log("collection",collection)
33
+ // console.log("collection", collection)
34
34
 
35
35
  collection.edges.forEach((element) => {
36
36
  let node = element.node;
@@ -56,14 +56,15 @@ export default class Fetcher {
56
56
  }
57
57
 
58
58
  decorateNode(node) {
59
- const body = this.findTranslation(node.body.translations);
59
+ const body = this.findTranslation(node.body.translations)
60
60
  const title = this.findTranslation(node.title.translations);
61
61
  node.hashtags = this.collectHashtags(title);
62
62
  node.hashtags = node.hashtags.concat(this.collectHashtags(body));
63
63
  // hashtags in the title look ugly, lets replace the gid:... structure with the tag #name
64
64
  node.title.translation = this.replaceHashtags(title, node.hashtags);
65
- node.body.translation = this.appendHtmlHashtags(this.truncate(this.removeHashtags(body)).replace(/\n/g, "<br>"), node.hashtags);
66
- node.link = `${this.controller.component.url}/${this.collection}/${node.id}`;
65
+ node.body.translation = this.appendHtmlHashtags(this.truncate(this.removeHashtags(body)), node.hashtags);
66
+ // console.log("decorateNode", node.title.translation, "BODY", body, "translation", node.body.translation, node.hashtags)
67
+ node.link = `${this.controller.component.url}/${node.id}`;
67
68
  }
68
69
 
69
70
  findTranslation(translations) {
@@ -83,7 +84,7 @@ export default class Fetcher {
83
84
  collectHashtags(text) {
84
85
  let tags = [];
85
86
  if (text) {
86
- const gids = text.match(/gid:\/\/[^\s<&]+/g)
87
+ const gids = text.match(/gid:\/\/[^\s<&,;]+/g)
87
88
  if (gids) {
88
89
  tags = gids.filter((gid) => gid.indexOf("/Decidim::Hashtag/") !== -1).map((gid) => {
89
90
  const parts = gid.split("/");
@@ -117,18 +118,39 @@ export default class Fetcher {
117
118
  }
118
119
 
119
120
  removeHashtags(text) {
120
- return text.replace(/gid:\/\/[^\s<&]+/g, "");
121
+ return text.replace(/gid:\/\/[^\s<&,;]+/g, "");
121
122
  }
122
123
 
123
124
  appendHtmlHashtags(txt, tags) {
124
- let text = txt;
125
- tags.forEach((tag) => {
126
- text += ` ${tag.html}`;
127
- });
128
- return text;
125
+ let string = tags.reduce((accumulator, tag) => (accumulator
126
+ ? `${accumulator} ${tag.html}`
127
+ : tag.html), "");
128
+ if (string) {
129
+ return `${txt}<p>${string}</p>`;
130
+ }
131
+ return txt;
132
+
129
133
  }
130
134
 
131
135
  truncate(html) {
132
136
  return $.truncate(html, this.config);
133
137
  }
138
+
139
+ formatDateRange(startDate, endDate) {
140
+ // Check if either startDate or endDate is blank
141
+ if (!startDate || !endDate) {
142
+ return "";
143
+ }
144
+
145
+ // Convert startDate and endDate to JavaScript Date objects
146
+ const start = new Date(startDate);
147
+ const end = new Date(endDate);
148
+
149
+ const date = Intl.DateTimeFormat(window.DecidimAwesome.currentLocale, { // eslint-disable-line new-cap
150
+ year: "numeric",
151
+ month: "short",
152
+ day: "numeric"
153
+ });
154
+ return date.formatRange(start, end);
155
+ }
134
156
  }
@@ -29,23 +29,13 @@ export default class MeetingsFetcher extends Fetcher {
29
29
  }
30
30
  }
31
31
  startTime
32
- location {
33
- translations {
34
- text
35
- locale
36
- }
37
- }
32
+ endTime
38
33
  address
39
- locationHints {
40
- translations {
41
- text
42
- locale
43
- }
44
- }
45
34
  coordinates {
46
35
  latitude
47
36
  longitude
48
37
  }
38
+ typeOfMeeting
49
39
  category {
50
40
  id
51
41
  }
@@ -56,4 +46,11 @@ export default class MeetingsFetcher extends Fetcher {
56
46
  }
57
47
  }`;
58
48
  }
49
+
50
+ decorateNode(node) {
51
+ super.decorateNode(node);
52
+ node.icon = window.AwesomeMapMeetingTypes[node.typeOfMeeting];
53
+ node.meetingType = window.AwesomeMapMeetingTexts[node.typeOfMeeting];
54
+ node.dateRange = this.formatDateRange(node.startTime, node.endTime);
55
+ }
59
56
  }
@@ -23,12 +23,18 @@ export default class ProposalsFetcher extends Fetcher {
23
23
  locale
24
24
  }
25
25
  }
26
+ author {
27
+ id
28
+ name
29
+ }
26
30
  body {
27
31
  translations {
28
32
  text
29
33
  locale
30
34
  }
31
35
  }
36
+ totalCommentsCount
37
+ endorsementsCount
32
38
  address
33
39
  coordinates {
34
40
  latitude
@@ -49,4 +55,26 @@ export default class ProposalsFetcher extends Fetcher {
49
55
  }
50
56
  }`;
51
57
  }
58
+
59
+ decorateNode(node) {
60
+ super.decorateNode(node);
61
+ node.authorName = node.author && node.author.name || window.DecidimAwesome.texts.officialAuthor;
62
+ node.humanState = window.AwesomeMapProposalTexts[node.state];
63
+ switch (node.state) {
64
+ case "accepted":
65
+ node.stateClass = "success";
66
+ break;
67
+ case "rejected":
68
+ case "withdrawn":
69
+ node.stateClass = "alert";
70
+ break;
71
+ case "evaluating":
72
+ node.stateClass = "warning";
73
+ break;
74
+ default:
75
+ node.stateClass = "muted";
76
+ }
77
+
78
+ node.isAmendment = () => (Boolean(this.controller.amendments[node.id]));
79
+ }
52
80
  }
@@ -1,11 +1,10 @@
1
1
  import * as L from "leaflet";
2
2
  // comes with Decidim
3
- import "src/decidim/map/icon.js"
4
3
  import "src/decidim/vendor/leaflet-tilelayer-here"
5
4
  // Comes with Decidim
6
- import "leaflet.markercluster";
5
+ import "leaflet.markercluster";
7
6
  // included in this package.json
8
- import "leaflet.featuregroup.subgroup"
7
+ import "leaflet.featuregroup.subgroup"
9
8
  import "src/vendor/jquery.truncate"
10
9
  import "jsrender"
11
10
 
@@ -64,7 +63,7 @@ export default class AwesomeMap {
64
63
  this.autoResize();
65
64
 
66
65
  if (this.loading.length === 0) {
67
- this.controls.$loading.hide();
66
+ this.controls.loading.style.display = "none";
68
67
  // call trigger as all loads are finished
69
68
  this.onFinished();
70
69
  }