decidim-decidim_awesome 0.10.1 → 0.11.1

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

Potentially problematic release.


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

Files changed (263) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +35 -0
  3. data/README.md +177 -60
  4. data/app/cells/concerns/decidim/decidim_awesome/global_menu_cell_override.rb +20 -0
  5. data/app/cells/concerns/decidim/decidim_awesome/{proposal_m_cell_override.rb → proposal_l_cell_override.rb} +10 -4
  6. data/app/cells/decidim/decidim_awesome/content_blocks/map/show.erb +5 -12
  7. data/app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb +9 -5
  8. data/app/cells/decidim/decidim_awesome/voting/proposal_metadata_cell.rb +54 -0
  9. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/modal.erb +18 -0
  10. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/show.erb +37 -32
  11. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_cell.rb +9 -4
  12. data/app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb +2 -2
  13. data/app/commands/concerns/decidim/decidim_awesome/proposals/admin/update_proposal_override.rb +31 -0
  14. data/app/commands/concerns/decidim/decidim_awesome/proposals/create_collaborative_draft_override.rb +27 -0
  15. data/app/commands/concerns/decidim/decidim_awesome/proposals/create_proposal_override.rb +27 -0
  16. data/app/commands/concerns/decidim/decidim_awesome/proposals/update_collaborative_draft_override.rb +27 -0
  17. data/app/commands/concerns/decidim/decidim_awesome/proposals/update_proposal_override.rb +26 -0
  18. data/app/commands/decidim/decidim_awesome/admin/create_constraint.rb +1 -1
  19. data/app/commands/decidim/decidim_awesome/admin/create_proposal_custom_field.rb +4 -3
  20. data/app/commands/decidim/decidim_awesome/admin/destroy_custom_redirect.rb +1 -1
  21. data/app/commands/decidim/decidim_awesome/admin/destroy_menu_hack.rb +1 -1
  22. data/app/commands/decidim/decidim_awesome/admin/destroy_proposal_custom_field.rb +6 -3
  23. data/app/commands/decidim/decidim_awesome/admin/rename_scope_label.rb +1 -1
  24. data/app/commands/decidim/decidim_awesome/admin/update_constraint.rb +1 -1
  25. data/app/commands/decidim/decidim_awesome/admin/update_custom_redirect.rb +2 -2
  26. data/app/commands/decidim/decidim_awesome/command.rb +1 -7
  27. data/app/controllers/concerns/decidim/decidim_awesome/admin/maintenance_context.rb +43 -0
  28. data/app/controllers/concerns/decidim/decidim_awesome/admin_accountability/admin/filterable_helper.rb +1 -1
  29. data/app/controllers/concerns/decidim/decidim_awesome/content_security_policy.rb +34 -0
  30. data/app/controllers/concerns/decidim/decidim_awesome/limit_pending_amendments.rb +35 -0
  31. data/app/controllers/concerns/decidim/decidim_awesome/not_found_redirect.rb +1 -1
  32. data/app/controllers/concerns/decidim/decidim_awesome/proposals/proposal_votes_controller_override.rb +3 -3
  33. data/app/controllers/decidim/decidim_awesome/admin/application_controller.rb +2 -0
  34. data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +14 -10
  35. data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +10 -9
  36. data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +23 -20
  37. data/app/controllers/decidim/decidim_awesome/admin/custom_redirects_controller.rb +6 -10
  38. data/app/controllers/decidim/decidim_awesome/admin/maintenance_controller.rb +76 -0
  39. data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +6 -10
  40. data/app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb +14 -6
  41. data/app/controllers/decidim/decidim_awesome/admin/scoped_admins_controller.rb +2 -2
  42. data/app/controllers/decidim/decidim_awesome/admin/scoped_styles_controller.rb +2 -2
  43. data/app/controllers/decidim/decidim_awesome/blank_component_controller.rb +8 -3
  44. data/app/controllers/decidim/decidim_awesome/editor_images_controller.rb +3 -3
  45. data/app/controllers/decidim/decidim_awesome/iframe_component/iframe_controller.rb +18 -5
  46. data/app/forms/concerns/decidim/decidim_awesome/proposals/proposal_form_override.rb +21 -0
  47. data/app/forms/{decidim → concerns/decidim}/decidim_awesome/proposals/proposal_wizard_create_step_form_override.rb +2 -1
  48. data/app/forms/decidim/decidim_awesome/admin/config_form.rb +28 -14
  49. data/app/forms/decidim/decidim_awesome/admin/custom_redirect_form.rb +2 -2
  50. data/app/forms/decidim/decidim_awesome/admin/intergram_form.rb +4 -0
  51. data/app/forms/decidim/decidim_awesome/admin/menu_form.rb +4 -4
  52. data/app/helpers/concerns/decidim/decidim_awesome/amendments_helper_override.rb +65 -0
  53. data/app/helpers/concerns/decidim/decidim_awesome/breadcrumb_helper_override.rb +23 -0
  54. data/app/helpers/concerns/decidim/decidim_awesome/proposals/application_helper_override.rb +110 -0
  55. data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +6 -27
  56. data/app/helpers/decidim/decidim_awesome/map_helper.rb +8 -27
  57. data/app/jobs/decidim/decidim_awesome/destroy_private_data_job.rb +22 -0
  58. data/app/jobs/decidim/decidim_awesome/migrate_legacy_images_job.rb +5 -4
  59. data/app/middleware/decidim/decidim_awesome/current_config.rb +3 -5
  60. data/app/models/concerns/decidim/decidim_awesome/has_proposal_extra_fields.rb +39 -10
  61. data/app/models/decidim/decidim_awesome/awesome_config.rb +1 -1
  62. data/app/models/decidim/decidim_awesome/paper_trail_version.rb +3 -3
  63. data/app/models/decidim/decidim_awesome/proposal_extra_field.rb +35 -1
  64. data/app/models/decidim/decidim_awesome/vote_weight.rb +2 -2
  65. data/app/overrides/decidim/proposals/admin/proposals/show/add_private_body.html.erb.deface +7 -0
  66. data/app/overrides/decidim/proposals/admin/proposals/show/replace_body.html.erb.deface +5 -0
  67. data/app/overrides/decidim/proposals/proposals/_proposal_aside/limit_amendments_modal.html.erb.deface +5 -0
  68. data/app/overrides/decidim/proposals/proposals/_vote_button/replace_vote_button.html.erb.deface +1 -1
  69. data/app/overrides/layouts/decidim/_decidim_javascript/add_awesome_tags.html.erb.deface +6 -0
  70. data/app/overrides/layouts/decidim/_head/add_awesome_tags.html.erb.deface +4 -11
  71. data/app/overrides/layouts/decidim/admin/_header/add_awesome_tags.html.erb.deface +9 -0
  72. data/app/packs/entrypoints/decidim_admin_decidim_awesome.js +1 -2
  73. data/app/packs/entrypoints/decidim_admin_decidim_awesome_global.js +4 -0
  74. data/app/packs/entrypoints/decidim_admin_decidim_awesome_global.scss +1 -0
  75. data/app/packs/entrypoints/decidim_decidim_awesome.js +2 -2
  76. data/app/packs/entrypoints/decidim_decidim_awesome_map.scss +1 -1
  77. data/app/packs/entrypoints/decidim_editor.js +14 -0
  78. data/app/packs/src/decidim/decidim_awesome/admin/auto_edit.js +96 -69
  79. data/app/packs/src/decidim/decidim_awesome/admin/check_redirections.js +46 -41
  80. data/app/packs/src/decidim/decidim_awesome/admin/codemirror.js +3 -3
  81. data/app/packs/src/decidim/decidim_awesome/admin/constraint_form_events.js +115 -0
  82. data/app/packs/src/decidim/decidim_awesome/admin/custom_fields_builder.js +9 -5
  83. data/app/packs/src/decidim/decidim_awesome/admin/form_exit_warn.js +22 -11
  84. data/app/packs/src/decidim/decidim_awesome/admin/proposal_sortings.js +26 -8
  85. data/app/packs/src/decidim/decidim_awesome/admin/tabs_change.js +31 -0
  86. data/app/packs/src/decidim/decidim_awesome/admin/user_picker.js +34 -21
  87. data/app/packs/src/decidim/decidim_awesome/amendments/show_modal_on_limits.js +28 -0
  88. data/app/packs/src/decidim/decidim_awesome/awesome_admin.js +5 -16
  89. data/app/packs/src/decidim/decidim_awesome/awesome_admin_global.js +1 -0
  90. data/app/packs/src/decidim/decidim_awesome/awesome_application.js +1 -15
  91. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/fetcher.js +33 -11
  92. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/meetings_fetcher.js +9 -12
  93. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/proposals_fetcher.js +28 -0
  94. data/app/packs/src/decidim/decidim_awesome/awesome_map/awesome_map.js +3 -4
  95. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/controller.js +12 -12
  96. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/meetings_controller.js +11 -7
  97. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/proposals_controller.js +6 -13
  98. data/app/packs/src/decidim/decidim_awesome/awesome_map/controls_ui.js +51 -20
  99. data/app/packs/src/decidim/decidim_awesome/awesome_map/load_map.js +27 -18
  100. data/app/packs/src/decidim/decidim_awesome/editor/index.js +94 -0
  101. data/app/packs/src/decidim/decidim_awesome/forms/autosave.js +28 -23
  102. data/app/packs/src/decidim/decidim_awesome/forms/custom_fields_renderer.js +29 -25
  103. data/app/packs/src/decidim/decidim_awesome/forms/rich_text_plugin.js +27 -32
  104. data/app/packs/src/decidim/decidim_awesome/proposals/custom_fields.js +31 -15
  105. data/app/packs/src/decidim/decidim_awesome/proposals/images.js +16 -10
  106. data/app/packs/src/decidim/decidim_awesome/voting/voting_cards.js +47 -38
  107. data/app/packs/stylesheets/decidim/decidim_awesome/admin/auto_edits.scss +11 -12
  108. data/app/packs/stylesheets/decidim/decidim_awesome/admin/check_redirections.scss +15 -0
  109. data/app/packs/stylesheets/decidim/decidim_awesome/admin/codemirror.scss +24 -12
  110. data/app/packs/stylesheets/decidim/decidim_awesome/admin/constraints.scss +49 -29
  111. data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_fields.scss +28 -71
  112. data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_styles.scss +48 -0
  113. data/app/packs/stylesheets/decidim/decidim_awesome/admin/intergram_fixes.scss +11 -0
  114. data/app/packs/stylesheets/decidim/decidim_awesome/admin/user_picker.scss +17 -26
  115. data/app/packs/stylesheets/decidim/decidim_awesome/amendments/modal.scss +5 -0
  116. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin.scss +11 -49
  117. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss +19 -0
  118. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_application.scss +4 -19
  119. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_iframe/iframe.scss +1 -1
  120. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_map/map.scss +41 -35
  121. data/app/packs/stylesheets/decidim/decidim_awesome/forms/autosave.scss +6 -6
  122. data/app/packs/stylesheets/decidim/decidim_awesome/forms/custom_fields.scss +118 -0
  123. data/app/packs/stylesheets/decidim/decidim_awesome/shared/spinner.scss +26 -0
  124. data/app/packs/stylesheets/decidim/decidim_awesome/voting/voting_cards.scss +41 -59
  125. data/app/permissions/decidim/decidim_awesome/admin/permissions.rb +14 -3
  126. data/app/permissions/decidim/decidim_awesome/permissions.rb +3 -4
  127. data/app/presenters/concerns/decidim/decidim_awesome/breadcrumb_root_menu_item_presenter_override.rb +23 -0
  128. data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_item_presenter_override.rb +10 -2
  129. data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_presenter_override.rb +8 -0
  130. data/app/presenters/concerns/decidim/decidim_awesome/proposals/proposal_presenter_override.rb +20 -0
  131. data/app/presenters/decidim/decidim_awesome/admin_log/component_presenter_override.rb +30 -0
  132. data/app/presenters/decidim/decidim_awesome/participatory_space_role_presenter.rb +1 -1
  133. data/app/presenters/decidim/decidim_awesome/private_data_presenter.rb +70 -0
  134. data/app/presenters/decidim/decidim_awesome/user_entity_presenter.rb +1 -1
  135. data/app/queries/decidim/decidim_awesome/private_data_finder.rb +19 -0
  136. data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_methods.rb +72 -0
  137. data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_override.rb +38 -0
  138. data/app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb +34 -0
  139. data/app/types/concerns/decidim/decidim_awesome/add_proposal_type_custom_fields.rb +59 -0
  140. data/app/types/concerns/decidim/decidim_awesome/{proposal_type_override.rb → add_proposal_type_vote_weights.rb} +3 -1
  141. data/app/views/decidim/decidim_awesome/admin/admin_accountability/index.html.erb +23 -17
  142. data/app/views/decidim/decidim_awesome/admin/checks/index.html.erb +50 -48
  143. data/app/views/decidim/decidim_awesome/admin/config/_autoedit_box_label.html.erb +7 -2
  144. data/app/views/decidim/decidim_awesome/admin/config/_constraints.html.erb +25 -18
  145. data/app/views/decidim/decidim_awesome/admin/config/_form_admins.html.erb +7 -6
  146. data/app/views/decidim/decidim_awesome/admin/config/_form_editors.html.erb +12 -16
  147. data/app/views/decidim/decidim_awesome/admin/config/_form_livechat.html.erb +39 -23
  148. data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_custom_fields.html.erb +35 -17
  149. data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_private_custom_fields.html.erb +1 -0
  150. data/app/views/decidim/decidim_awesome/admin/config/_form_proposals.html.erb +68 -80
  151. data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +16 -12
  152. data/app/views/decidim/decidim_awesome/admin/config/_form_surveys.html.erb +8 -6
  153. data/app/views/decidim/decidim_awesome/admin/config/show.html.erb +22 -12
  154. data/app/views/decidim/decidim_awesome/admin/constraints/_form.html.erb +1 -49
  155. data/app/views/decidim/decidim_awesome/admin/constraints/new.html.erb +14 -9
  156. data/app/views/decidim/decidim_awesome/admin/constraints/show.html.erb +14 -9
  157. data/app/views/decidim/decidim_awesome/admin/custom_redirects/_form.html.erb +20 -5
  158. data/app/views/decidim/decidim_awesome/admin/custom_redirects/edit.html.erb +5 -5
  159. data/app/views/decidim/decidim_awesome/admin/custom_redirects/index.html.erb +14 -13
  160. data/app/views/decidim/decidim_awesome/admin/custom_redirects/new.html.erb +5 -5
  161. data/app/views/decidim/decidim_awesome/admin/maintenance/_private_data.html.erb +44 -0
  162. data/app/views/decidim/decidim_awesome/admin/maintenance/show.html.erb +44 -0
  163. data/app/views/decidim/decidim_awesome/admin/menu_hacks/_form.html.erb +6 -6
  164. data/app/views/decidim/decidim_awesome/admin/menu_hacks/edit.html.erb +21 -12
  165. data/app/views/decidim/decidim_awesome/admin/menu_hacks/index.html.erb +39 -42
  166. data/app/views/decidim/decidim_awesome/admin/menu_hacks/new.html.erb +21 -12
  167. data/app/views/decidim/decidim_awesome/admin/proposals/_editor.html.erb +8 -5
  168. data/app/views/decidim/decidim_awesome/admin/proposals/_private_body.html.erb +20 -0
  169. data/app/views/decidim/decidim_awesome/admin/shared/_filters_with_date.html.erb +14 -18
  170. data/app/views/decidim/decidim_awesome/amendments/_modal.html.erb +23 -0
  171. data/app/views/decidim/decidim_awesome/custom_fields/_form_render.html.erb +8 -2
  172. data/app/views/decidim/decidim_awesome/iframe_component/iframe/show.html.erb +7 -12
  173. data/app/views/decidim/decidim_awesome/map_component/map/_map_template.html.erb +53 -37
  174. data/app/views/decidim/decidim_awesome/map_component/map/show.html.erb +14 -5
  175. data/app/views/decidim/decidim_awesome/voting/voting_cards/_show_vote_button.html.erb +0 -3
  176. data/app/views/layouts/decidim/decidim_awesome/_awesome_config.html.erb +9 -7
  177. data/app/views/layouts/decidim/decidim_awesome/_intergram_widget.html.erb +9 -6
  178. data/app/views/layouts/decidim/decidim_awesome/admin/_base.html.erb +12 -0
  179. data/app/views/layouts/decidim/decidim_awesome/admin/application.html.erb +1 -73
  180. data/app/views/layouts/decidim/decidim_awesome/admin/maintenance.html.erb +19 -0
  181. data/config/assets.rb +3 -33
  182. data/config/i18n-tasks.yml +23 -3
  183. data/config/locales/ca.yml +28 -17
  184. data/config/locales/cs.yml +39 -14
  185. data/config/locales/de.yml +25 -15
  186. data/config/locales/en.yml +125 -35
  187. data/config/locales/es.yml +26 -16
  188. data/config/locales/eu.yml +7 -3
  189. data/config/locales/fr.yml +25 -16
  190. data/config/locales/hu.yml +43 -8
  191. data/config/locales/it.yml +8 -15
  192. data/config/locales/ja.yml +26 -15
  193. data/config/locales/lt.yml +0 -4
  194. data/config/locales/nl.yml +9 -14
  195. data/config/locales/pt-BR.yml +9 -14
  196. data/config/locales/ro-RO.yml +0 -3
  197. data/config/locales/sv.yml +9 -9
  198. data/config/rubocop/disabled.yml +11 -0
  199. data/config/rubocop/faker.yml +480 -0
  200. data/config/rubocop/rails.yml +88 -0
  201. data/config/rubocop/rspec.yml +65 -0
  202. data/config/rubocop/ruby.yml +1210 -0
  203. data/db/migrate/20240306175331_rename_editor_images_awesome_config.rb +18 -0
  204. data/db/migrate/20240531224204_add_decidim_awesome_proposal_private_fields.rb +29 -0
  205. data/db/migrate/20240729164227_add_decidim_awesome_proposal_private_fields_date.rb +20 -0
  206. data/db/seeds.rb +3 -3
  207. data/lib/decidim/decidim_awesome/admin_engine.rb +26 -7
  208. data/lib/decidim/decidim_awesome/api/types/localized_custom_fields_type.rb +22 -0
  209. data/lib/decidim/decidim_awesome/api/types/translated_custom_fields_type.rb +51 -0
  210. data/lib/decidim/decidim_awesome/awesome.rb +70 -19
  211. data/lib/decidim/decidim_awesome/awesome_helpers.rb +6 -2
  212. data/lib/decidim/decidim_awesome/checksums.yml +46 -44
  213. data/lib/decidim/decidim_awesome/config.rb +1 -1
  214. data/lib/decidim/decidim_awesome/custom_fields.rb +13 -5
  215. data/lib/decidim/decidim_awesome/engine.rb +165 -56
  216. data/lib/decidim/decidim_awesome/iframe_component/component.rb +1 -2
  217. data/lib/decidim/decidim_awesome/lock.rb +47 -0
  218. data/lib/decidim/decidim_awesome/map_component/component.rb +1 -1
  219. data/lib/decidim/decidim_awesome/menu.rb +165 -0
  220. data/lib/decidim/decidim_awesome/menu_hacker.rb +4 -8
  221. data/lib/decidim/decidim_awesome/system_checker.rb +2 -4
  222. data/lib/decidim/decidim_awesome/test/factories.rb +10 -10
  223. data/lib/decidim/decidim_awesome/test/initializer.rb +7 -12
  224. data/lib/decidim/decidim_awesome/test/layouts/decidim/_head.html.erb +2 -2
  225. data/lib/decidim/decidim_awesome/test/layouts/decidim/admin/_header.html.erb +2 -2
  226. data/lib/decidim/decidim_awesome/test/shared_examples/{box_label_editor.rb → box_label_editor_examples.rb} +17 -17
  227. data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +23 -5
  228. data/lib/decidim/decidim_awesome/test/shared_examples/custom_fields_examples.rb +155 -0
  229. data/lib/decidim/decidim_awesome/test/shared_examples/custom_redirects_contexts.rb +7 -7
  230. data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +42 -58
  231. data/lib/decidim/decidim_awesome/test/shared_examples/menu_hack_contexts.rb +9 -8
  232. data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +32 -24
  233. data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +97 -22
  234. data/lib/decidim/decidim_awesome/version.rb +2 -2
  235. data/lib/decidim/decidim_awesome/voting_manifest.rb +5 -10
  236. data/lib/decidim/decidim_awesome.rb +1 -2
  237. data/lib/tasks/decidim_awesome_active_storage_migrations_tasks.rake +1 -1
  238. data/lib/tasks/decidim_awesome_upgrade_tasks.rake +4 -0
  239. data/package.json +21 -30
  240. metadata +83 -61
  241. data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter/show.erb +0 -15
  242. data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter/vote_button.erb +0 -15
  243. data/app/cells/decidim/decidim_awesome/voting/voting_cards_counter_cell.rb +0 -21
  244. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_modal/show.erb +0 -16
  245. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_modal_cell.rb +0 -20
  246. data/app/cells/decidim/proposals/proposal_m/footer.erb +0 -13
  247. data/app/helpers/decidim/decidim_awesome/amendments_helper_override.rb +0 -48
  248. data/app/helpers/decidim/decidim_awesome/proposals/application_helper_override.rb +0 -78
  249. data/app/overrides/layouts/decidim/_head/add_awesome_legacy_scripts.rb +0 -14
  250. data/app/overrides/layouts/decidim/admin/_application/add_intergram.html.erb.deface +0 -5
  251. data/app/overrides/layouts/decidim/admin/_header/replace_scripts.html.erb.deface +0 -6
  252. data/app/overrides/layouts/decidim/admin/_header/replace_styles.html.erb.deface +0 -3
  253. data/app/packs/entrypoints/decidim_admin_decidim_awesome_custom_fields.js +0 -2
  254. data/app/packs/entrypoints/decidim_decidim_awesome_admin_form_exit_warn.js +0 -1
  255. data/app/packs/src/decidim/decidim_awesome/admin/constraints.js +0 -55
  256. data/app/packs/src/decidim/decidim_awesome/editors/editor.js +0 -218
  257. data/app/packs/src/decidim/decidim_awesome/editors/tabs_focus.js +0 -22
  258. data/app/packs/stylesheets/decidim/decidim_awesome/editors/markdown_editor.scss +0 -19
  259. data/app/packs/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss +0 -58
  260. data/app/packs/stylesheets/vendor/select2-foundation-theme.scss +0 -348
  261. data/app/serializers/concerns/decidim/decidim_awesome/proposal_serializer_override.rb +0 -64
  262. data/app/views/decidim/decidim_awesome/admin/config/_modal.html.erb +0 -11
  263. data/app/views/decidim/decidim_awesome/voting/voting_cards/_proposal_m_cell_footer.erb +0 -15
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RenameEditorImagesAwesomeConfig < ActiveRecord::Migration[6.1]
4
+ class AwesomeConfig < ApplicationRecord
5
+ self.table_name = :decidim_awesome_config
6
+ end
7
+
8
+ # rubocop:disable Rails/SkipsModelValidations
9
+ def up
10
+ AwesomeConfig.where(var: :allow_images_in_full_editor).update_all(var: :allow_images_in_editors)
11
+ AwesomeConfig.where(var: :allow_images_in_small_editor).destroy_all
12
+ end
13
+
14
+ def down
15
+ AwesomeConfig.where(var: :allow_images_in_editors).update_all(var: :allow_images_in_full_editor)
16
+ end
17
+ # rubocop:enable Rails/SkipsModelValidations
18
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddDecidimAwesomeProposalPrivateFields < ActiveRecord::Migration[6.0]
4
+ class ProposalExtraField < ApplicationRecord
5
+ self.table_name = :decidim_awesome_proposal_extra_fields
6
+ end
7
+
8
+ def change
9
+ add_column :decidim_awesome_proposal_extra_fields, :private_body, :string
10
+ add_column :decidim_awesome_proposal_extra_fields, :decidim_proposal_type, :string
11
+ reversible do |direction|
12
+ direction.up do
13
+ execute <<~SQL.squish
14
+ UPDATE decidim_awesome_proposal_extra_fields
15
+ SET decidim_proposal_type = 'Decidim::Proposals::Proposal'
16
+ SQL
17
+ end
18
+ end
19
+
20
+ remove_index :decidim_awesome_proposal_extra_fields, name: "decidim_awesome_extra_fields_on_proposal"
21
+ add_index :decidim_awesome_proposal_extra_fields,
22
+ [:decidim_proposal_id, :decidim_proposal_type],
23
+ name: "index_decidim_awesome_proposal_extra_fields_on_decidim_proposal"
24
+
25
+ change_column_null :decidim_awesome_proposal_extra_fields, :decidim_proposal_id, false
26
+ change_column_null :decidim_awesome_proposal_extra_fields, :decidim_proposal_type, false
27
+ ProposalExtraField.reset_column_information
28
+ end
29
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddDecidimAwesomeProposalPrivateFieldsDate < ActiveRecord::Migration[6.1]
4
+ class ProposalExtraField < ApplicationRecord
5
+ self.table_name = :decidim_awesome_proposal_extra_fields
6
+ end
7
+
8
+ def change
9
+ add_column :decidim_awesome_proposal_extra_fields, :private_body_updated_at, :datetime
10
+
11
+ reversible do |direction|
12
+ direction.up do
13
+ execute <<~SQL.squish
14
+ UPDATE decidim_awesome_proposal_extra_fields
15
+ SET private_body_updated_at = updated_at
16
+ SQL
17
+ end
18
+ end
19
+ end
20
+ end
data/db/seeds.rb CHANGED
@@ -7,7 +7,7 @@ if !Rails.env.production? || ENV.fetch("SEED", nil)
7
7
 
8
8
  # Set the htmleditor on to facilitate development
9
9
  admin_user = Decidim::User.find_by(
10
- organization: organization,
10
+ organization:,
11
11
  email: "admin@example.org"
12
12
  )
13
13
 
@@ -18,10 +18,10 @@ if !Rails.env.production? || ENV.fetch("SEED", nil)
18
18
  )
19
19
 
20
20
  # Enable images in general
21
- setting = Decidim::DecidimAwesome::AwesomeConfig.find_or_initialize_by(var: :allow_images_in_full_editor, organization: organization)
21
+ setting = Decidim::DecidimAwesome::AwesomeConfig.find_or_initialize_by(var: :allow_images_in_editors, organization:)
22
22
  setting.value = true
23
23
  setting.save!
24
- setting = Decidim::DecidimAwesome::AwesomeConfig.find_or_initialize_by(var: :allow_images_in_small_editor, organization: organization)
24
+ setting = Decidim::DecidimAwesome::AwesomeConfig.find_or_initialize_by(var: :allow_videos_in_editors, organization:)
25
25
  setting.value = true
26
26
  setting.save!
27
27
  end
@@ -16,7 +16,9 @@ module Decidim
16
16
  routes do
17
17
  # Add admin engine routes here
18
18
  resources :constraints
19
- resources :menu_hacks, except: [:show]
19
+ resources :menus, only: [:show] do
20
+ resources :hacks, except: [:show], controller: "menu_hacks"
21
+ end
20
22
  resources :custom_redirects, except: [:show]
21
23
  resources :config, param: :var, only: [:show, :update]
22
24
  resources :scoped_styles, param: :var, only: [:create, :destroy]
@@ -26,7 +28,10 @@ module Decidim
26
28
  post :export_admin_accountability, to: "admin_accountability#export", as: "export_admin_accountability"
27
29
  get :users, to: "config#users"
28
30
  post :rename_scope_label, to: "config#rename_scope_label"
29
- get :checks, to: "checks#index"
31
+ resources :maintenance, only: [:show] do
32
+ delete :destroy_private_data, on: :member
33
+ get :checks, on: :collection, to: "checks#index"
34
+ end
30
35
  post :migrate_images, to: "checks#migrate_images"
31
36
  root to: "config#show"
32
37
  end
@@ -37,19 +42,33 @@ module Decidim
37
42
  end
38
43
  end
39
44
 
40
- initializer "decidim_awesome.admin_menu" do
45
+ initializer "decidim_awesome.admin_menus" do
46
+ first_available = Decidim::DecidimAwesome::Menu.menus.detect { |_key, val| val.present? }&.first
47
+
41
48
  Decidim.menu :admin_menu do |menu|
42
49
  menu.add_item :awesome_menu,
43
50
  I18n.t("menu.decidim_awesome", scope: "decidim.admin"),
44
- decidim_admin_decidim_awesome.config_path(:editors),
51
+ if first_available
52
+ decidim_admin_decidim_awesome.config_path(first_available)
53
+ else
54
+ decidim_admin_decidim_awesome.checks_maintenance_index_path
55
+ end,
45
56
  icon_name: "fire",
46
57
  position: 7.5,
47
- active: is_active_link?(decidim_admin_decidim_awesome.config_path(:editors), :inclusive),
58
+ active: if first_available
59
+ is_active_link?(decidim_admin_decidim_awesome.config_path(first_available), :inclusive)
60
+ else
61
+ is_active_link?(decidim_admin_decidim_awesome.checks_maintenance_index_path)
62
+ end,
48
63
  if: defined?(current_user) && current_user&.read_attribute("admin")
49
64
  end
50
- end
65
+ # submenus
66
+ Decidim::DecidimAwesome::Menu.register_custom_fields_submenu!
67
+ Decidim::DecidimAwesome::Menu.register_menu_hacks_submenu!
68
+ Decidim::DecidimAwesome::Menu.register_maintenance_admin_menu!
69
+ Decidim::DecidimAwesome::Menu.register_awesome_admin_menu!
51
70
 
52
- initializer "decidim_awesome.admin_menu" do
71
+ # user menu
53
72
  Decidim.menu :admin_user_menu do |menu|
54
73
  if DecidimAwesome.enabled? :admin_accountability
55
74
  menu.add_item :admin_accountability,
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ # This type represents a localized string in a single language.
6
+ class LocalizedCustomFieldsType < Decidim::Api::Types::BaseObject
7
+ description "Represents a particular translation of a LocalizedCustomFieldsType"
8
+
9
+ field :locale, GraphQL::Types::String, "The standard locale of this translation.", null: false
10
+ field :fields, GraphQL::Types::JSON, "The fields of this translation.", null: true
11
+ field :machine_translated, GraphQL::Types::Boolean, "Whether this string is machine translated or not.", null: false
12
+
13
+ def machine_translated
14
+ if object.respond_to?(:machine_translated)
15
+ object.machine_translated.present?
16
+ else
17
+ false
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Decidim::DecidimAwesome
5
+ # This type represents a translated field in multiple languages.
6
+ class TranslatedCustomFieldsType < Decidim::Api::Types::BaseObject
7
+ description "A translated field"
8
+
9
+ field :locales, [GraphQL::Types::String, { null: true }], description: "Lists all the locales in which this translation is available", null: true
10
+
11
+ field :translations, [LocalizedCustomFieldsType, { null: true }], description: "All the localized custom fields for this translation.", null: false do
12
+ argument :locales, [GraphQL::Types::String], description: "A list of locales to scope the translations to.", required: false
13
+ end
14
+
15
+ field :translation, GraphQL::Types::JSON, description: "Returns a single translation given a locale.", null: true do
16
+ argument :locale, GraphQL::Types::String, "A locale to search for", required: true
17
+ end
18
+
19
+ def locales
20
+ (defined_translations.keys + machine_translations.keys).uniq
21
+ end
22
+
23
+ def translation(locale: "")
24
+ display_translations[locale]
25
+ end
26
+
27
+ def translations(locales: [])
28
+ translations = display_translations
29
+ translations = translations.slice(*locales) unless locales.empty?
30
+
31
+ translations.map { |locale, fields| OpenStruct.new(locale:, fields:, machine_translated: defined_translations[locale].blank?) }
32
+ end
33
+
34
+ private
35
+
36
+ def display_translations
37
+ @display_translations ||= locales.index_with do |locale|
38
+ defined_translations[locale].presence || machine_translations[locale]
39
+ end
40
+ end
41
+
42
+ def defined_translations
43
+ object.stringify_keys.except("machine_translations")
44
+ end
45
+
46
+ def machine_translations
47
+ object.stringify_keys["machine_translations"]&.stringify_keys || {}
48
+ end
49
+ end
50
+ end
51
+ end
@@ -10,8 +10,11 @@ module Decidim
10
10
  autoload :MenuHacker, "decidim/decidim_awesome/menu_hacker"
11
11
  autoload :CustomFields, "decidim/decidim_awesome/custom_fields"
12
12
  autoload :VotingManifest, "decidim/decidim_awesome/voting_manifest"
13
+ autoload :Lock, "decidim/decidim_awesome/lock"
14
+ autoload :TranslatedCustomFieldsType, "decidim/decidim_awesome/api/types/translated_custom_fields_type"
15
+ autoload :LocalizedCustomFieldsType, "decidim/decidim_awesome/api/types/localized_custom_fields_type"
13
16
 
14
- # Awesome coms with some components for participatory spaces
17
+ # Awesome comes with some components for participatory spaces
15
18
  # Currently :awesome_map and :awesome_iframe, list them here
16
19
  # if you wan to disable them
17
20
  # NOTE if you have spaces with some of these components already configured
@@ -32,11 +35,11 @@ module Decidim
32
35
  # true => always true but admins can still restrict its scope
33
36
  # false => default false, admins can turn it true
34
37
  # :disabled => false and non available, hidden from admins
35
- config_accessor :allow_images_in_full_editor do
38
+ config_accessor :allow_images_in_editors do
36
39
  false
37
40
  end
38
41
 
39
- config_accessor :allow_images_in_small_editor do
42
+ config_accessor :allow_videos_in_editors do
40
43
  false
41
44
  end
42
45
 
@@ -44,28 +47,20 @@ module Decidim
44
47
  false
45
48
  end
46
49
 
47
- config_accessor :use_markdown_editor do
48
- false
49
- end
50
-
51
- config_accessor :allow_images_in_markdown_editor do
52
- false
53
- end
54
-
55
50
  # used to save forms in localstorage
56
51
  config_accessor :auto_save_forms do
57
- false
52
+ true
58
53
  end
59
54
 
60
55
  # Live chat widget linked to Telegram account or group
61
56
  # In the admin side only
62
57
  config_accessor :intergram_for_admins do
63
- false
58
+ true
64
59
  end
65
60
 
66
61
  # In the public side only
67
62
  config_accessor :intergram_for_public do
68
- false
63
+ true
69
64
  end
70
65
 
71
66
  # Configuration options to handle different validations in proposals
@@ -121,6 +116,16 @@ module Decidim
121
116
  ]
122
117
  end
123
118
 
119
+ # Allows admins to limit the amount of pending amendments to (currently) one per proposal before it's accepted.
120
+ # Once a pending amendment is accepted, a new on can be created.
121
+ # Note that this does not limit the number of amendment per se, the admin has to set the limit in the proposal's component configuration.
122
+ # set to :disable to will prevent admins to set an amendment's limit in the proposal's component configuration.
123
+ # if set to "true" the checkbox will be checked by default
124
+ # if set to "false" the checkbox will be unchecked by default
125
+ config_accessor :allow_limiting_amendments do
126
+ false
127
+ end
128
+
124
129
  # allows admins to created specific CSS snippets affecting only some specific parts
125
130
  # Valid values differ a little from the previous convention:
126
131
  # :disabled => false and non available, hidden from admins
@@ -146,6 +151,21 @@ module Decidim
146
151
  {}
147
152
  end
148
153
 
154
+ # Same as proposal_custom_fields but for generating private fields than can be read only by admins
155
+ config_accessor :proposal_private_custom_fields do
156
+ {}
157
+ end
158
+
159
+ # How old must be the private data to be considered expired and therefore presented to the admins for deletion
160
+ config_accessor :private_data_expiration_time do
161
+ 3.months
162
+ end
163
+
164
+ # How long must be the private data prevented from being deleted again after being scheduled for deletion
165
+ config_accessor :lock_time do
166
+ 1.minute
167
+ end
168
+
149
169
  # allows to keep modifications for the main menu
150
170
  # can return :disabled to completly remove this feature
151
171
  # otherwise it should be an array (some overrides can be specified by default):
@@ -160,6 +180,10 @@ module Decidim
160
180
  []
161
181
  end
162
182
 
183
+ config_accessor :home_content_block_menu do
184
+ []
185
+ end
186
+
163
187
  # Allows admins to assignate "fake" admins scoped to some admin zones using the
164
188
  # same scope editor as :scoped_styles, valid values uses the same convention:
165
189
  # :disabled => false and non available, hidden from admins
@@ -262,6 +286,13 @@ module Decidim
262
286
  [:proposals, :reporting_propposals]
263
287
  end
264
288
 
289
+ # A URL where to obtain the translations for the FormBuilder component
290
+ # you can a custom place if you are worried about the CDN geolocation
291
+ # Download them from https://github.com/kevinchappell/formBuilder-languages
292
+ config_accessor :form_builder_langs_location do
293
+ "https://cdn.jsdelivr.net/npm/formbuilder-languages@1.1.0/"
294
+ end
295
+
265
296
  # Public: Stores an instance of ContentBlockRegistry
266
297
  def self.voting_registry
267
298
  @voting_registry ||= Decidim::ManifestRegistry.new("decidim_awesome/voting")
@@ -273,13 +304,33 @@ module Decidim
273
304
  # pass a single config var or an array of them
274
305
  # any non disabled match will return as true
275
306
  def self.possible_additional_proposal_sortings
276
- @possible_additional_proposal_sortings ||= additional_proposal_sortings.to_a.filter_map do |sort|
307
+ return [] unless additional_proposal_sortings.is_a?(Array)
308
+
309
+ @possible_additional_proposal_sortings ||= additional_proposal_sortings.filter_map do |sort|
277
310
  next unless sort.to_sym.in?([:az, :za, :supported_first, :supported_last])
278
311
 
279
312
  sort.to_s
280
313
  end
281
314
  end
282
315
 
316
+ # appends to a hash a new value in a specified position so that the hash becomes:
317
+ # { a: 1, b: 2, c: 3 } => append_hash(hash, :b, :d, 4) => { a: 1, b: 2, d: 4, c: 3 }
318
+ # if key is not found then it will be inserted at the end
319
+ def self.hash_append!(hash, after_key, key, value)
320
+ insert_at = hash.to_a.index(hash.assoc(after_key))
321
+ insert_at = insert_at.nil? ? hash.size : insert_at + 1
322
+ hash.replace(hash.to_a.insert(insert_at, [key, value]).to_h)
323
+ end
324
+
325
+ # prepends to a hash a new value in a specified position so that the hash becomes:
326
+ # { a: 1, b: 2, c: 3 } => prepend_hash(hash, :b, :d, 4) => { a: 1, d: 4, b: 2, c: 3 }
327
+ # if key is not found then it will be inserted at the beggining
328
+ def self.hash_prepend!(hash, before_key, key, value)
329
+ insert_at = hash.to_a.index(hash.assoc(before_key))
330
+ insert_at = 0 if insert_at.nil?
331
+ hash.replace(hash.to_a.insert(insert_at, [key, value]).to_h)
332
+ end
333
+
283
334
  def self.collation_for(locale)
284
335
  @collation_for ||= {}
285
336
  @collation_for[locale] ||= begin
@@ -289,9 +340,7 @@ module Decidim
289
340
  end
290
341
  end
291
342
 
292
- def self.enabled?(config_vars)
293
- config_vars = [config_vars] unless config_vars.respond_to?(:any?)
294
-
343
+ def self.enabled?(*config_vars)
295
344
  config_vars.any? do |item|
296
345
  next unless config.has_key?(item.to_sym)
297
346
 
@@ -309,8 +358,10 @@ module Decidim
309
358
  registered_components << [manifest, block]
310
359
  end
311
360
 
361
+ # version 0.11 is compatible only with decidim 0.28
312
362
  def self.legacy_version?
313
- Decidim.version[0..3] == "0.26"
363
+ # Decidim.version[0..3] == "0.28"
364
+ false
314
365
  end
315
366
  end
316
367
  end
@@ -24,11 +24,11 @@ module Decidim
24
24
  end
25
25
 
26
26
  def javascript_config_vars
27
- awesome_config.except(:scoped_styles, :proposal_custom_fields, :scoped_admins).to_json.html_safe
27
+ awesome_config.except(:scoped_styles, :proposal_custom_fields, :proposal_private_custom_fields, :scoped_admins).to_json.html_safe
28
28
  end
29
29
 
30
30
  def show_public_intergram?
31
- return unless awesome_config[:intergram_for_public]
31
+ return false unless awesome_config[:intergram_for_public]
32
32
  return true unless awesome_config[:intergram_for_public_settings][:require_login]
33
33
 
34
34
  user_signed_in?
@@ -61,6 +61,10 @@ module Decidim
61
61
  @awesome_proposal_custom_fields ||= awesome_config_instance.collect_sub_configs_values("proposal_custom_field")
62
62
  end
63
63
 
64
+ def awesome_proposal_private_custom_fields
65
+ @awesome_proposal_private_custom_fields ||= awesome_config_instance.collect_sub_configs_values("proposal_private_custom_field")
66
+ end
67
+
64
68
  # this will check if the current component has been configured to use a custom voting manifest
65
69
  def awesome_voting_manifest_for(component)
66
70
  return nil unless component.settings.respond_to? :awesome_voting_manifest
@@ -1,63 +1,65 @@
1
1
  decidim-admin:
2
2
  /app/views/layouts/decidim/admin/_header.html.erb:
3
- decidim-0.25: 1aff077428830b12306d6c42e6b37216
3
+ decidim-0.28: 25bf272ac5a70eb8a975f4889fa46095
4
+ decidim-0.28.c4d3889: 6391da1f357f9b260622ddd404a47987
5
+ decidim-0.28.1: b2ae319d5bcf43954bbe0edb9a4e3ffb
4
6
  decidim-core:
7
+ /app/packs/entrypoints/decidim_editor.js:
8
+ decidim-0.28: beddd77e3893fd0b7cd2679a7ee6e536
9
+ /app/packs/src/decidim/editor/index.js:
10
+ decidim-0.28: 90dfac3acae97202dec083955e2249e4
5
11
  /app/validators/etiquette_validator.rb:
6
- decidim-0.25: f7a4a652005385a994208f1ab41c4f08
7
- decidim-0.26.4: f1f0fdf15be88f695c8359afab80f73f
12
+ decidim-0.28: e9ad91d824ad48ac2075a088a0d21349
8
13
  /app/views/layouts/decidim/_head.html.erb:
9
- decidim-0.26: 0927fc81123addec70853c2e7986c538
10
- decidim-0.27: c82ac6defe55b6d4f6a54544dbf2ac58
11
- /app/packs/src/decidim/editor.js:
12
- decidim-0.25: 742698903a30034094c01aecaca6de84
13
- decidim-0.26: 651830d87aeeeff39316a787fc70d461
14
- decidim-0.26.4: eac4ea47c09762aa2e56300bf7e98f31
15
- decidim-0.27.3: a9585960d5979aa3adbf5561010513fe
14
+ decidim-0.28: e51e400a98821f4ca0fff26ebd4d0741
15
+ decidim-0.28.1: 8ac1af4e223d9a7a98136760b6194a75
16
+ /app/views/layouts/decidim/_decidim_javascript.html.erb:
17
+ decidim-0.28: dc60ed8abf7649611f18804b67b1408d
16
18
  /app/presenters/decidim/menu_presenter.rb:
17
- decidim-0.25: f3b05daf279f909f8b3b628658dd5810
19
+ decidim-0.28: 220c8865a43bd8b7b12a7f926f7f4324
18
20
  /app/presenters/decidim/menu_item_presenter.rb:
19
- decidim-0.25: 860ffb160ec5f8552cc2855a6a47851b
20
- decidim-0.26.4: d6d0129d81845c61884bcfd07885e911
21
- decidim-0.27: c82bc2ea3c8f792472670d5996613ecf
21
+ decidim-0.28: 4e4cd366a8a313079ac5fab466bd3679
22
22
  /app/helpers/decidim/amendments_helper.rb:
23
- decidim-0.25: 63532a04fcf07cf92b789833a9421416
24
- decidim-0.26: 636943ccb2e994fe0124dc87e72e49e9
23
+ decidim-0.28: df28f9321d1bc07757746ed608274e3d
24
+ /app/presenters/decidim/admin_log/component_presenter.rb:
25
+ decidim-0.28: 77e80d527727acdf117a0c4517a69a7c
25
26
  decidim-proposals:
26
27
  /lib/decidim/proposals/proposal_serializer.rb:
27
- decidim-0.26: 2d817775f79a19cfcf9cfae8e5b68c5a
28
+ decidim-0.28: bbd33bdc60defb734b3fb814666bb622
29
+ decidim-0.28.1: 7bd5cadb1127a4e81bd5f333670351bd
30
+ decidim-0.28.2: ab146c54850a4486d96cf50211679671
28
31
  /lib/decidim/api/proposal_type.rb:
29
32
  decidim-0.26: e38e4875e408ec4f658e28725c5a94d4
30
33
  /app/forms/decidim/proposals/proposal_wizard_create_step_form.rb:
31
- decidim-0.24: db69edd0ba8ffa3965a5c44a6bfaba8d
32
34
  decidim-0.27: b495d37088ecebcbe4ac9563bb3498d5
35
+ /app/forms/decidim/proposals/admin/proposal_form.rb:
36
+ decidim-0.28: 422632395194b19beed4c7c65f127ff5
33
37
  /app/helpers/decidim/proposals/application_helper.rb:
34
- decidim-0.26: 216c974bc425393c18b01bfc4eed4f0b
35
- decidim-0.26.4: 2e673d2aabe66a80a971d7ff80ebdbb8
36
- decidim-0.26.7: ddd9a1f88609c8c7b60c07882d026441
37
- decidim-0.27: c0ebeac39ebe4926bf0e5fc585a384d7
38
- decidim-0.27.1: a4f902d1c4829a7f7f62299686f8604e
39
- decidim-0.27.3: a9c9ed5eedaf7bf80afaf9ff5a89c254
38
+ decidim-0.28: 89df14045349cc2eaaec78f79f6140b1
39
+ decidim-0.28.2: 317b0347528e697fa405a792bcfa3db8
40
40
  /app/controllers/decidim/proposals/proposal_votes_controller.rb:
41
- decidim-0.26: 65ca00fdb4aaf30da37ad75aaf66e70a
42
- decidim-0.27: a1d416491752f4c2fb2668b29ceb8e09
43
- /app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb:
44
- # this file is not overriden anymore but it needs to be the last version
45
- decidim-0.26: 519a0d34a9ffbd8b9c26d9b68ff4e2a3
46
- decidim-0.27.3: 949b2163c547742549531320bf5e0de1
47
- /app/views/decidim/proposals/collaborative_drafts/show.html.erb:
48
- # this file is not overriden anymore but it needs to be the last version
49
- decidim-0.26: 519a0d34a9ffbd8b9c26d9b68ff4e2a3
50
- decidim-0.27.3: b1ec22d35263a2ac96fe4604c0ceb752
41
+ decidim-0.28: f983e72c1ee8d31222d537533c762cd2
51
42
  /app/views/decidim/proposals/admin/proposals/_form.html.erb:
52
- decidim-0.25: 90a04984d4269398b7cd21aa33763a1f
53
- decidim-0.27: f60168e432e1d419e5aec5d3d1e53f0e
43
+ decidim-0.28: 824463b320562c15fdb530bfebbf2f0f
54
44
  /app/views/decidim/proposals/proposals/_vote_button.html.erb:
55
- decidim-0.27: f7202c37fe042cd816a6f9fd0f9e6807
45
+ decidim-0.27: 3d087d807238f33b71e6b385db8ffc70
56
46
  /app/views/decidim/proposals/proposals/_votes_count.html.erb:
57
- decidim-0.27: 33339aae5004361e24c4c5b009cc2888
58
- /app/cells/decidim/proposals/proposal_m_cell.rb:
59
- decidim-0.26: 21cc09a45efa20dbcda5c943d820c867
60
- decidim-0.27: 9df97ded3e6594b65b85fcbf1e5b0644
61
- decidim-0.27.4: ce3b30cdddfee547b8fb089c0fddd8a4
62
- /app/cells/decidim/proposals/proposal_m/footer.erb:
63
- decidim-0.26: 7ade5bbd8412f44f1c4ed913ae1834c6
47
+ decidim-0.27: 6e663e5c82c27291b63f29f346df8737
48
+ /app/cells/decidim/proposals/proposal_l_cell.rb:
49
+ decidim-0.27.4: 5e111ed30bca9475bed8247e5e056747
50
+ /app/cells/decidim/proposals/proposal_metadata_cell.rb:
51
+ decidim-0.26: eedfd7f813aedbd819b519e03ae4a680
52
+ /app/commands/decidim/proposals/create_proposal.rb:
53
+ decidim-0.28: 95c7bba44dbe477abdfbf450b7eee258
54
+ /app/commands/decidim/proposals/create_collaborative_draft.rb:
55
+ decidim-0.28: ab3f937f15c6ed945e776fef34b18abf
56
+ /app/commands/decidim/proposals/admin/create_proposal.rb:
57
+ decidim-0.28: aa0c093cb10b3ccfb046edd0018eae1d
58
+ /app/commands/decidim/proposals/update_proposal.rb:
59
+ decidim-0.28: 1cc15b946512f4d5a54d1cf5aea8450a
60
+ /app/commands/decidim/proposals/update_collaborative_draft.rb:
61
+ decidim-0.28: 7df5266382bd57db72832da391fe7e11
62
+ /app/commands/decidim/proposals/admin/update_proposal.rb:
63
+ decidim-0.28: 67b691b6d1ce61cb198592ac25f76f74
64
+ /app/presenters/decidim/proposals/proposal_presenter.rb:
65
+ decidim-0.28: 72910541010305f25baf297f4a58497b
@@ -71,7 +71,7 @@ module Decidim
71
71
  def setting_for(var)
72
72
  @vars.find_or_initialize_by(
73
73
  organization: @organization,
74
- var: var
74
+ var:
75
75
  )
76
76
  end
77
77
 
@@ -13,6 +13,14 @@ module Decidim
13
13
 
14
14
  attr_reader :fields, :xml, :errors, :data
15
15
 
16
+ def empty?
17
+ @fields.empty?
18
+ end
19
+
20
+ def present?
21
+ !@fields.empty?
22
+ end
23
+
16
24
  def apply_xml(xml)
17
25
  parse_xml(xml)
18
26
  map_fields!
@@ -32,7 +40,7 @@ module Decidim
32
40
 
33
41
  def parse_xml(xml)
34
42
  @xml = xml
35
- @data = Nokogiri.XML(xml).xpath("//dl/dd")
43
+ @data = Nokogiri.XML(@xml).xpath("//dl/dd")
36
44
  return if @data.present?
37
45
 
38
46
  apply_to_first_textarea
@@ -54,7 +62,7 @@ module Decidim
54
62
  # Finds the first textarea and applies non-xml compatible content
55
63
  # when textarea has not wysiwyg assigned, strips html
56
64
  def apply_to_first_textarea
57
- # quill editor might leave html traces without any user content
65
+ # HTML editors might leave html traces without any user content
58
66
  # so we won't process it if there is no text (html free) result
59
67
  text = Nokogiri.HTML(xml).html? ? Nokogiri.HTML(xml).text.strip : text.strip
60
68
  return if text.blank?
@@ -79,12 +87,12 @@ module Decidim
79
87
  @fields
80
88
  end
81
89
 
82
- def deep_transform_values!(object, &block)
90
+ def deep_transform_values!(object, &)
83
91
  case object
84
92
  when Hash
85
- object.transform_values! { |value| deep_transform_values!(value, &block) }
93
+ object.transform_values! { |value| deep_transform_values!(value, &) }
86
94
  when Array
87
- object.map! { |e| deep_transform_values!(e, &block) }
95
+ object.map! { |e| deep_transform_values!(e, &) }
88
96
  else
89
97
  yield(object)
90
98
  end