decidim-decidim_awesome 0.10.2 → 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 (261) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -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/{replace_scripts.html.erb.deface → add_awesome_tags.html.erb.deface} +4 -4
  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 -60
  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/_header/replace_styles.html.erb.deface +0 -3
  251. data/app/packs/entrypoints/decidim_admin_decidim_awesome_custom_fields.js +0 -2
  252. data/app/packs/entrypoints/decidim_decidim_awesome_admin_form_exit_warn.js +0 -1
  253. data/app/packs/src/decidim/decidim_awesome/admin/constraints.js +0 -55
  254. data/app/packs/src/decidim/decidim_awesome/editors/editor.js +0 -218
  255. data/app/packs/src/decidim/decidim_awesome/editors/tabs_focus.js +0 -22
  256. data/app/packs/stylesheets/decidim/decidim_awesome/editors/markdown_editor.scss +0 -19
  257. data/app/packs/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss +0 -58
  258. data/app/packs/stylesheets/vendor/select2-foundation-theme.scss +0 -348
  259. data/app/serializers/concerns/decidim/decidim_awesome/proposal_serializer_override.rb +0 -64
  260. data/app/views/decidim/decidim_awesome/admin/config/_modal.html.erb +0 -11
  261. data/app/views/decidim/decidim_awesome/voting/voting_cards/_proposal_m_cell_footer.erb +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '08bc00aacee27422d2ad41cc59de7b1f6156cb56efa542cba8ca62ccc8e60bc1'
4
- data.tar.gz: d5ecdc79b637343ee9333c43b723108b27450ea8218e6f499c6a9eb4c3edb474
3
+ metadata.gz: 107f5d454725a66c2a3a7658d9c841616a4556f634a6615c5f124ad2815c94b2
4
+ data.tar.gz: cc18503da6d79d49787f40a6a6da9fe659d64c05183c599a30800a25a874c5b9
5
5
  SHA512:
6
- metadata.gz: 82eac50d751b3e1c36fab86709e7fd67656d99f218dfd25e5738f9c5f1480459f3ef5b5e397458b3eba5e7aac626aec23ba2e42d1e297907de95fdadb4427d5e
7
- data.tar.gz: 28c557694c26c9a82a282e368181bd5fe9e07403c33c91afcf6e42460230d5e5f7b46dd9d4cc903d015f91554fa23a50cc535276eee8c12dd716d11e56dbf1be
6
+ metadata.gz: 7da76c3a55fac5f16814946e9de813e7e30f2f56523a62143b20ad52bf16863abfd5da3a79ac44c7a0aedffc4e9ddec232bed2732153474ac586cecac0acb302
7
+ data.tar.gz: d5c566fe5297b253b6004ad23007fc22d7a47c5aa9a0a310de319799c2fdfced27cf1b0c0861e8c9341d041eeb556571c0d65b8ae16d56fcb6b16eafe30a7d54
data/CHANGELOG.md CHANGED
@@ -1,6 +1,30 @@
1
1
  CHANGELOG
2
2
  =========
3
3
 
4
+ v0.11.1
5
+ ------
6
+
7
+ Compatibility:
8
+ - Decidim v0.28.x
9
+
10
+ Features:
11
+ - Added Private Custom Fields feature
12
+ - Added GraphQL types for weighted voting in the API
13
+ - Added GraphQL types for custom fields in the API
14
+ - Adds parsed information about custom fields in the Proposals export
15
+ - Adds parsed information bout private custom fields when admins exports private data
16
+ - Adds a maintenance menu with tools to remove old private data
17
+
18
+ v0.11
19
+ ------
20
+
21
+ Compatibility:
22
+ - Decidim v0.28.x
23
+
24
+ Features:
25
+ - Redesign to version 0.28
26
+ - Removed markdown editor
27
+
4
28
  v0.10.2
5
29
  ------
6
30
 
data/README.md CHANGED
@@ -1,16 +1,14 @@
1
1
  # Decidim::DecidimAwesome
2
2
 
3
- [![[CI] Tests 0.27](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/tests.yml/badge.svg)](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/tests.yml)
4
- [![[CI] Tests 0.26](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/tests-legacy.yml/badge.svg)](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/tests-legacy.yml)
3
+ [![[CI] Tests 0.28](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/tests.yml/badge.svg)](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/tests.yml)
5
4
  [![[CI] Lint](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/lint.yml/badge.svg)](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/lint.yml)
6
- [![[CI] Precompile](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/precompile.yml/badge.svg)](https://github.com/decidim-ice/decidim-module-decidim_awesome/actions/workflows/precompile.yml)
7
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/2dada53525dd5a944089/maintainability)](https://codeclimate.com/github/decidim-ice/decidim-module-decidim_awesome/maintainability)
8
6
  [![Test Coverage](https://codecov.io/gh/decidim-ice/decidim-module-decidim_awesome/branch/main/graph/badge.svg?token=TFBMCLLZJG)](https://codecov.io/gh/decidim-ice/decidim-module-decidim_awesome)
9
7
 
10
- Usability and UX tweaks for Decidim.
8
+ **Usability and UX tweaks for Decidim.**
11
9
 
12
10
  This plugin allows the administrators to expand the possibilities of Decidim beyond some existing limitations.
13
- All tweaks are provided in a optional fashion with granular permissions that let the administrator to choose exactly where to apply those mods. Some tweaks can be applied to any assembly, other in an specific participatory process or even in type of component only.
11
+ All tweaks are provided in a optional fashion with granular permissions that let the administrator to choose exactly where to apply those mods. Some tweaks can be applied to an assembly, other in an specific participatory process or even in a type of component only (for instance, only in proposals).
14
12
 
15
13
  **DISCLAIMER: This module is heavily tested and widely used, however we do not accept any responsibility for breaking anything. Feedback is appreciated though.**
16
14
 
@@ -31,13 +29,13 @@ Each hack can be scoped to one or more specific participatory spaces or componen
31
29
 
32
30
  ### Tweaks:
33
31
 
34
- #### 1. Image support for the Quill editor
32
+ #### 1. Image support for the RichText editor
35
33
 
36
34
  Modifies the WYSIWYG editor in Decidim by adding the possibility to insert images. When uploading images, Drag & Drop is supported. Images will be uploaded to the server and inserted as external resources (it doesn't use base64 in-line encoding).
37
35
 
38
36
  This feature allows you use images in newsletters as well.
39
37
 
40
- ![Images in Quill Editor](examples/quill-images.png)
38
+ ![Images in RichText Editor](examples/quill-images.png)
41
39
 
42
40
  #### 2. Auto-save for surveys and forms
43
41
 
@@ -47,27 +45,23 @@ It works purely in the client side by using LocalStorage capabilities of the bro
47
45
 
48
46
  Saving the form removes the stored data.
49
47
 
50
- ![Auto save in forms](examples/auto-save.png)
48
+ ![Auto save in forms](examples/auto-save.gif)
51
49
 
52
50
  #### 3. Images in proposals
53
51
 
54
- Event if you haven't activated the WYSIWYG editor (Quill) in public views (eg: proposals use a simple textarea if rich text editor has not been activated for users). You can allow users to upload images in them by drag & drop over the text area.
52
+ Event if you haven't activated the WYSIWYG editor (RichText) in public views (eg: proposals use a simple textarea if rich text editor has not been activated for users). You can allow users to upload images in them by drag & drop over the text area.
55
53
 
56
54
  ![Proposal images](examples/proposal-images.png)
57
55
 
58
- #### 4. Markdown editor for proposals
59
-
60
- Allows to use markdown when creating proposals instead of a bare textarea.
61
-
62
- #### 5. Admin scope configuration
56
+ #### 4. Restrict scope for tweaks
63
57
 
64
58
  All tweaks can be configured and scoped to a specific participatory space, a type of participatory space, a type of component or a specific component.
65
59
 
66
- Many scopes can be defined for every tweak.
60
+ Many scopes can be defined for every tweak. If a tweak is not scoped, it will be applied globally.
67
61
 
68
- ![Admin tweaks for editors](examples/admin-editors.png)
62
+ ![Tweak scopes](examples/tweak-scopes.png)
69
63
 
70
- #### 6. Awesome map component
64
+ #### 5. Awesome map component
71
65
 
72
66
  This is a component you can add in any participatory space. It retrieves all the geolocated content in that participatory space (meetings or proposals) and displays it in a big map.
73
67
 
@@ -75,25 +69,25 @@ It also provides a simple search by category, each category is assigned to a dif
75
69
 
76
70
  ![Awesome map](examples/awesome-map.png)
77
71
 
78
- #### 7. Fullscreen Iframe component
72
+ #### 6. Fullscreen Iframe component
79
73
 
80
74
  Another simple component that can be used to embed and Iframe with any external content in it that fills all the viewport.
81
75
 
82
76
  ![Fullscreen iframe](examples/fullscreen-iframe.png)
83
77
 
84
- #### 8. Live support chat
78
+ #### 7. Live support chat
85
79
 
86
- With this feature you can have a support chat in Decidim. It is linked to a [Telegram](https://telegram.org/) group or a single user chat using the [[IntergramBot](https://web.telegram.org/#/im?p=@IntergramBot). Just invite the bot to a group or chat with it directly, grab your ID, put it on the Awesome settings and have fun!. For more info or for hosting your own version of the bot check the [Intergram project](https://github.com/idoco/intergram).
80
+ With this feature you can have a support chat in Decidim. It is linked to a [Telegram](https://telegram.org/) group or a single user chat using the [IntergramBot](https://web.telegram.org/#/im?p=@IntergramBot). Just invite the bot to a group or chat with it directly, grab your ID, put it on the Awesome settings and have fun!. For more info or for hosting your own version of the bot check the [Intergram project](https://github.com/idoco/intergram).
87
81
 
88
82
  ![Intergram screenshot](examples/intergram.png)
89
83
 
90
- #### 9. Custom CSS applied only according scoped restrictions
84
+ #### 8. Custom CSS applied only according scoped restrictions
91
85
 
92
86
  With this feature you can create directly in the admin a CSS snipped that is only applied globally, in a particular assembly or even a single proposal!
93
87
 
94
88
  ![CSS screenshot](examples/custom_styles.png)
95
89
 
96
- #### 10. Change the main menu of Decidim entirely!
90
+ #### 9. Change the main menu of Decidim entirely!
97
91
 
98
92
  Feel free to hide, modify or add items in the Decidim's main menu. You can also change the order, establish some conditions (like showing only for logged users) or open in a new window.
99
93
 
@@ -102,7 +96,7 @@ Feel free to hide, modify or add items in the Decidim's main menu. You can also
102
96
  ![Menu hacks screenshot](examples/menu-3.png)
103
97
  ![Menu hacks screenshot](examples/menu-4.png)
104
98
 
105
- #### 11. Assign admins to specific scopes and prevent them modify anything else
99
+ #### 10. Assign admins to specific scopes and prevent them modify anything else
106
100
 
107
101
  Convert any user on the platform (that is not currently an admin) to a limited subset of participatory spaces or event components. Just add users to a box and scope them to some constraints. These users will see the "Edit" button in everywhere they have permissions. Any access to non allowed zones will redirect the user to the admin index page.
108
102
 
@@ -110,7 +104,7 @@ Convert any user on the platform (that is not currently an admin) to a limited s
110
104
  ![Scoped admins unauthorized](examples/scoped_admins_unauthorized.png)
111
105
  ![Scoped admins configuration](examples/scoped_admins_config.png)
112
106
 
113
- #### 12. Custom fields for proposals
107
+ #### 11. Custom fields for proposals
114
108
 
115
109
  Now admins can substitute the body of a proposal with a set of form fields.
116
110
  Edition is make with a Drag & Drop interface in the admin and can (and should) be scoped to apply only to certain proposal components.
@@ -121,12 +115,79 @@ Technically, the content is stored in the database as an XML document compatible
121
115
  ![Custom fields screenshot](examples/custom-fields-2.png)
122
116
  ![Custom fields screenshot](examples/custom-fields-1.gif)
123
117
 
124
- #### 13. Custom Redirections (or URL shortener feature)
118
+ Note that the custom fields are build using the jQuery library [formBuilder](https://formbuilder.online). This package is included in Decidim Awesome but the i18n translations are not. By default they are dynamically downloaded from the CDN https://cdn.jsdelivr.net/npm/formbuilder-languages@1.1.0/.
119
+ If you wish to provide an alternative place for those files, you can configure the variable `form_builder_langs_location` in an initializer:
120
+
121
+ ```ruby
122
+ # config/initializers/awesome_defaults.rb
123
+
124
+ # A URL where to obtain the translations for the FormBuilder component
125
+ # you can a custom place if you are worried about the CDN geolocation
126
+ # Download them from https://github.com/kevinchappell/formBuilder-languages
127
+
128
+ # For instance, copy them to your /public/fb_locales/ directory and set the path here:
129
+ Decidim::DecidimAwesome.configure do |config|
130
+ config.form_builder_langs_location = "/fb_locales/"
131
+ end
132
+ ```
133
+
134
+ ##### 11.1. GraphQL types for custom fields
135
+
136
+ #### 11.1. GraphQL types for custom fields
137
+
138
+ Custom fields are displayed in the GaphQL API according to their definition in a formatted array of objects in the attribute `bodyFields`.
139
+
140
+ A query to extract this information could look like this (see that the original `body` is also available):
141
+
142
+ ```graphql
143
+ {
144
+ component(id: 999) {
145
+ ... on Proposals {
146
+ proposals {
147
+ edges {
148
+ node {
149
+ id
150
+ bodyFields {
151
+ locales
152
+ translation(locale: "en")
153
+ translations {
154
+ locale
155
+ fields
156
+ machineTranslated
157
+ }
158
+ }
159
+ body {
160
+ locales
161
+ translations {
162
+ locale
163
+ text
164
+ machineTranslated
165
+ }
166
+ }
167
+ }
168
+ }
169
+ }
170
+ }
171
+ }
172
+ }
173
+ ```
174
+
175
+ You can then use this custom type in your GraphQL queries and mutations to handle the custom fields in proposals.
176
+
177
+
178
+ ##### 11.2. Private Custom fields
179
+
180
+ Similar to the custom fields feature, but only admins can see the content of the fields. This is useful for adding metadata to proposals that should not be visible to the public (such as contact data).
181
+ Data is stored encrypted in the database.
182
+
183
+ ![Private Custom fields screenshot](examples/private_custom_fields.png)
184
+
185
+ #### 12. Custom Redirections (or URL shortener feature)
125
186
 
126
187
  Admins can create custom paths that redirect to other places. Destinations can be internal absolute paths or external sites.
127
188
  There's also possible to choose to sanitize (ie: remove) any query string or to maintain it (so you can decide to use).
128
189
 
129
- For instance you can create a redirection like
190
+ For instance you can create a redirection like
130
191
 
131
192
  * `/take-me-somewhere` => `/processes/canary-islands`
132
193
 
@@ -141,7 +202,7 @@ Using a link with a query string (ie: `/take-me-somewhere?locale=es`) that will
141
202
 
142
203
  ![Custom redirections screenshot](examples/custom-redirections.png)
143
204
 
144
- #### 14. Custom validation rules for title and body in proposals
205
+ #### 13. Custom validation rules for title and body in proposals
145
206
 
146
207
  Configure as you wish how the fields "title" and "body" are validated in proposals creation.
147
208
 
@@ -154,7 +215,7 @@ Rules available:
154
215
 
155
216
  ![Custom validations](examples/custom_validations.png)
156
217
 
157
- #### 15. Admin accountability
218
+ #### 14. Admin accountability
158
219
 
159
220
  This feature allows you to list all the users that are, or have been at any point in time, admins, valuators, user managers or any other role in Decidim. Including global admin roles or private admins of a particular participatory space.
160
221
 
@@ -162,7 +223,7 @@ Results can be filtered by role and by time range and also exported as CSV or ot
162
223
 
163
224
  ![Admin accountability](examples/admin_accountability.png)
164
225
 
165
- #### 16. Additional proposal sortings
226
+ #### 15. Additional proposal sortings
166
227
 
167
228
  ![Proposal sorting](examples/proposal_sorting.png)
168
229
  ![Proposal sorting admin](examples/proposal_sorting-admin.png)
@@ -191,7 +252,7 @@ Decidim::DecidimAwesome.configure do |config|
191
252
  end
192
253
  ```
193
254
 
194
- #### 17. Weighted voting
255
+ #### 16. Weighted voting
195
256
 
196
257
  This feature allows you to configure a proposals component to use a weighted voting system. This means that each vote can have a different weight and the result of the vote is calculated as the sum of all the weights.
197
258
 
@@ -214,7 +275,7 @@ if Decidim::DecidimAwesome.enabled?(:weighted_proposal_voting)
214
275
  voting.show_vote_button_view = "decidim/decidim_awesome/voting/no_admins_vote/show_vote_button"
215
276
  voting.show_votes_count_view = "decidim/decidim_awesome/voting/no_admins_vote/show_votes_count"
216
277
  # voting.show_votes_count_view = "" # hide votes count if needed
217
- voting.proposal_m_cell_footer = "decidim/decidim_awesome/voting/no_admins_vote/proposal_m_cell_footer"
278
+ voting.proposal_metadata_cell = "decidim/decidim_awesome/voting/proposal_metadata"
218
279
  # define a weight validator (optional, by default all weights are valid)
219
280
  voting.weight_validator do |weight, context|
220
281
  # don't allow admins to vote
@@ -240,11 +301,11 @@ A manifest must define a vote button view for the main proposal view, a vote cou
240
301
 
241
302
  All views are optional, if set to `nil` they will use the original ones. If set to an empty string `""` they will be hidden.
242
303
 
243
- The `weight_validator` is a Proc that receives the weight value and the context with the current user and the proposal and returns true or false if the weight is valid or not.
304
+ The `weight_validator` is a `Proc` that receives the weight value and the context with the current user and the proposal and returns true or false if the weight is valid or not.
244
305
 
245
306
  **Notes for view `show_vote_button_view`**
246
307
 
247
- When building a new view for the vote button ([see the original](https://github.com/decidim/decidim/blob/release/0.27-stable/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb)) is important to take into account the following situations:
308
+ When building a new view for the vote button ([see the original](https://github.com/decidim/decidim/blob/release/0.28-stable/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb)) is important to take into account the following situations:
248
309
 
249
310
  - If there's a `current_user` logged in
250
311
  - If votes are blocked `if current_settings.votes_blocked?`
@@ -252,7 +313,7 @@ When building a new view for the vote button ([see the original](https://github.
252
313
  - If maximum votes have already reached `if proposal.maximum_votes_reached?`
253
314
  - If the proposal can accumulate supports beyond maximum `if proposal.can_accumulate_supports_beyond_threshold`
254
315
  - If the current component allows the user to participate `if current_component.participatory_space.can_participate?(current_user)`
255
- - Note that the [original view](https://github.com/decidim/decidim/blob/release/0.27-stable/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb) is overridden only inside the tag `<div id="proposal-<%= proposal.id %>-vote-button" class="button--vote-button">`. You only need to substitute the part inside.
316
+ - Note that the [original view](https://github.com/decidim/decidim/blob/release/0.28-stable/decidim-proposals/app/views/decidim/proposals/proposals/_vote_button.html.erb) is overridden only inside the tag `<div id="proposal-<%= proposal.id %>-vote-button" class="button--vote-button">`. You only need to substitute the part inside.
256
317
 
257
318
  To cast a vote a `POST` action is needed with the parameters `proposal_id`, `from_proposals_list` and `weight`. The route where to send the vote can be constructed such as:
258
319
 
@@ -268,12 +329,55 @@ This view must implement the number of votes already cast. It requires an HTML t
268
329
 
269
330
  You can also completely hide this view (using `voting.show_votes_count_view = ""` in the manifest declaration). This is useful if you are using the same `show_vote_button_view` to also display the total counters (or your implementation does not use that).
270
331
 
271
- **Notes for view `proposal_m_cell_footer`**
332
+ **Notes for cell `voting.proposal_metadata_cell`**
333
+
334
+ This is the Decidim cell used to provide the metadata that is rendered at the bottom of a proposal card. If empty, defaults to [ProposalMetadataCell](https://github.com/decidim/decidim/blob/release/0.28-stable/decidim-proposals/app/cells/decidim/proposals/proposal_metadata_cell.rb), **wich does not renders the votes**.
272
335
 
273
- This view is used by the proposal cell in lists. It must implement the vote button and the vote count. The vote button must be a link with the same characteristics as the one explained above for the `show_vote_button_view` (typically you can just render the same view using `<%= render partial: my/path/to/view, { locals: model: proposal, from_proposals_list: true } %>`).
336
+ What this cell must do is to provide an array of items to render as part of the cell footer. Check the example used at the [voting cards implementation](app/cells/decidim/decidim_awesome/voting/proposal_metadata_cell.rb) for reference.
274
337
 
275
- Note that, it is strongly recommended to add and HTML tag element with the id `proposal-<%= proposal.id %>-votes-count` so the Ajax vote re-loader can work. Even if you don't use (in this case use a `style="display:none"` attribute), this is because the Ajax reloader always look for this element and throw JavaScript errors if not.
338
+ ##### 16.1 GraphQL Types for weighted voting
276
339
 
340
+ When a weighed voting mechanism is selected, the GraphQL API will show those weights separated in each proposal.
341
+ The attribute that holds this information is `vote_weights`, a query example could look like this:
342
+
343
+ ```graphql
344
+ {
345
+ component(id: 999) {
346
+ ... on Proposals {
347
+ proposals {
348
+ edges {
349
+ node {
350
+ id
351
+ voteWeights
352
+ }
353
+ }
354
+ }
355
+ }
356
+ }
357
+ }
358
+ ```
359
+
360
+ #### 17. Limiting amendments in proposals
361
+
362
+ By default, when proposals can be amended, any number of amendments can be created.
363
+
364
+ This feature allows admins to configure a specific Proposal's component to limit the number of evaluating amendments that can be created to one.
365
+ Note that this only applies to amendments being in the state "evaluating", not to accepted or rejected.
366
+
367
+ This option is disable by default, must be enabled in the component's configuration:
368
+
369
+ ![Limiting amendments](examples/limit_amendments.png)
370
+
371
+ #### 18. Maintenance tools
372
+
373
+ The awesome admin provides with some maintenance tools (more to come in the future);
374
+
375
+ ##### 18.1 Old private data removal
376
+
377
+ These tools are designed to help remove old data as required by laws such as GDPR, particularly in relation to private custom fields.
378
+ This menu will show if there's any data older than 6 months (configurable) and will let admins remove it component by component.
379
+
380
+ ![Private data](examples/private_data.png)
277
381
 
278
382
  #### To be continued...
279
383
 
@@ -293,11 +397,22 @@ And then execute:
293
397
 
294
398
  ```bash
295
399
  bundle
296
- bundle exec rails decidim_decidim_awesome:install:migrations
297
- bundle exec rails decidim:upgrade
298
- bundle exec rails db:migrate
400
+ bin/rails decidim:upgrade
401
+ bin/rails db:migrate
299
402
  ```
300
403
 
404
+ Go to `yourdomain/admin/decidim_awesome` and start tweaking things!
405
+
406
+ > **EXPERTS ONLY**
407
+ >
408
+ > Under the hood, when running `bundle exec rails decidim:upgrade` the `decidim-decidim_awesome` gem will run the following two tasks (that can also be run manually if you consider):
409
+ >
410
+ > ```bash
411
+ > bin/rails decidim_decidim_awesome:install:migrations
412
+ > bin/rails decidim_decidim_awesome:webpacker:install
413
+ > ```
414
+
415
+
301
416
  If you are upgrading from a version prior to 0.8, make sure to visit the URL `/admin/decidim_awesome/checks` and run image migrations for the old images:
302
417
 
303
418
  ![Check image migrations](examples/check_image_migrations.png)
@@ -314,13 +429,14 @@ RAILS_ENV=production bin/rails decidim_awesome:active_storage_migrations:check_m
314
429
  ```
315
430
 
316
431
  The correct version of Decidim Awesome should resolved automatically by the Bundler.
317
- However you can force some specific version using `gem "decidim-decidim_awesome", "~> 0.10.0"` in the Gemfile.
432
+ However you can force some specific version using `gem "decidim-decidim_awesome", "~> 0.11.0"` in the Gemfile.
318
433
 
319
434
  Depending on your Decidim version, choose the corresponding Awesome version to ensure compatibility:
320
435
 
321
436
  | Awesome version | Compatible Decidim versions |
322
437
  |---|---|
323
- | 0.10.0 | >= 0.26.7, >= 0.27.3 |
438
+ | 0.11.x | 0.28.x |
439
+ | 0.10.x | >= 0.26.7, >= 0.27.x |
324
440
  | 0.9.2 | >= 0.26.7, >= 0.27.3 |
325
441
  | 0.9.x | 0.26.x, 0.27.x |
326
442
  | 0.8.x | 0.25.x, 0.26.x |
@@ -328,10 +444,11 @@ Depending on your Decidim version, choose the corresponding Awesome version to e
328
444
  | 0.6.x | 0.22.x, 0.23.x |
329
445
  | 0.5.x | 0.21.x, 0.22.x |
330
446
 
331
- > *Heads up!*
447
+ > *Heads up!*
448
+ > * version 0.11.0 is only compatible with Decidim v0.28 as a major redesign makes backward compatibility impractical.
332
449
  > * version 0.10.0 requires database migrations! Don't forget the migrations step when updating.
333
450
  > * version 0.8.0 removes CSS Themes for tenants. If you have been using them you will have to manually migrate them to custom styles.
334
- > * version 0.8.0 uses ActiveStorage, same as Decidim 0.25. 2 new rake task have been introduced to facilitate the migration: `bin/rails decidim_awesome:active_storage_migrations:check_migration_from_carrierwave` and
451
+ > * version 0.8.0 uses ActiveStorage, same as Decidim 0.25. 2 new rake task have been introduced to facilitate the migration: `bin/rails decidim_awesome:active_storage_migrations:check_migration_from_carrierwave` and
335
452
  `bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave`
336
453
  > * version 0.7.1 requires database migrations! Don't forget the migrations step when updating.
337
454
 
@@ -350,13 +467,10 @@ In order to personalize default values, create an initializer such as:
350
467
  # Change some variables defaults
351
468
  Decidim::DecidimAwesome.configure do |config|
352
469
  # Enabled by default to all scopes, admins can still limit it's scope
353
- config.allow_images_in_full_editor = true
470
+ config.allow_images_in_editors = true
354
471
 
355
472
  # Disabled by default to all scopes, admins can enable it and limit it's scope
356
- config.allow_images_in_small_editor = false
357
-
358
- # De-activated, admins don't even see it as an option
359
- config.use_markdown_editor = :disabled
473
+ config.allow_videos_in_editors = false
360
474
 
361
475
  # Disable scoped admins
362
476
  config.scoped_admins = :disabled
@@ -448,31 +562,34 @@ DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec rake test_
448
562
  DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec rspec
449
563
  ```
450
564
 
565
+ > Note: the following is not currently applicable as version v0.11 is only compatible with version Decidim v0.28
566
+ > Is left here for future reference
567
+
451
568
  However, this project works with different versions of Decidim. In order to test them all, we maintain two different Gemfiles: `Gemfile` and `Gemfile.legacy`. The first one is used for development and testing the latest Decidim version supported, the second one is used for testing against the old Decidim version.
452
569
 
453
570
  You can run run tests against the legacy Decidim versions by using:
454
571
 
455
572
  ```bash
456
- export DATABASE_USERNAME=<username>
457
- export DATABASE_PASSWORD=<password>
458
- RBENV_VERSION=2.7.6 BUNDLE_GEMFILE=Gemfile.legacy bundle
459
- RBENV_VERSION=2.7.6 BUNDLE_GEMFILE=Gemfile.legacy bundle exec rake test_app
460
- RBENV_VERSION=2.7.6 BUNDLE_GEMFILE=Gemfile.legacy bundle exec rspec
573
+ export DATABASE_USERNAME=<username>
574
+ export DATABASE_PASSWORD=<password>
575
+ RBENV_VERSION=3.1.1 BUNDLE_GEMFILE=Gemfile.legacy bundle
576
+ RBENV_VERSION=3.1.1 BUNDLE_GEMFILE=Gemfile.legacy bundle exec rake test_app
577
+ RBENV_VERSION=3.1.1 BUNDLE_GEMFILE=Gemfile.legacy bundle exec rspec
461
578
  ```
462
579
 
463
- For convenience, you can use the scripts `bin/rspec` and `bin/rspec-legacy` to run tests against one or the other version:
580
+ For convenience, you can use the scripts `bin/test` and `bin/test-legacy` to run tests against one or the other version:
464
581
 
465
582
  ```bash
466
- bin/rspec spec/
467
- bin/rspec-legacy spec/
583
+ bin/test spec/
584
+ bin/test-legacy spec/
468
585
  ```
469
586
 
470
587
  - Rbenv is required for this script to work.
471
588
 
472
589
  > **NOTE:** Remember to reset the database when changing between tests:
473
590
  > ```bash
474
- > bin/rspec --reset
475
- > bin/rspec-legacy --reset
591
+ > bin/test --reset
592
+ > bin/test-legacy --reset
476
593
  > ```
477
594
 
478
595
 
@@ -507,4 +624,4 @@ This engine is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
507
624
 
508
625
  ## Credits
509
626
 
510
- This plugin maintainted by ![PokeCode](app/packs/images/decidim/decidim_awesome/pokecode-logo.png)
627
+ This plugin maintainted by [![PokeCode](app/packs/images/decidim/decidim_awesome/pokecode-logo.png) PokeCode](https://pokecode.net/)
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module GlobalMenuCellOverride
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ def cache_hash
10
+ [
11
+ "decidim/content_blocks/global_menu",
12
+ current_organization.cache_key_with_version,
13
+ I18n.locale,
14
+ awesome_config[:home_content_block_menu].to_s
15
+ ].join(Decidim.cache_key_separator)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -2,17 +2,24 @@
2
2
 
3
3
  module Decidim
4
4
  module DecidimAwesome
5
- module ProposalMCellOverride
5
+ module ProposalLCellOverride
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  included do
9
+ private
10
+
11
+ def metadata_cell
12
+ awesome_voting_manifest_for(resource&.component)&.proposal_metadata_cell.presence || "decidim/proposals/proposal_metadata"
13
+ end
14
+
9
15
  # rubocop:disable Metrics/CyclomaticComplexity
16
+ # rubocop:disable Metrics/PerceivedComplexity
10
17
  def cache_hash
11
18
  hash = []
12
19
  hash << I18n.locale.to_s
13
20
  hash << model.cache_key_with_version
14
21
  hash << model.proposal_votes_count
15
- hash << model.extra_fields&.vote_weight_totals
22
+ hash << model.extra_fields&.reload&.vote_weight_totals
16
23
  hash << model.endorsements_count
17
24
  hash << model.comments_count
18
25
  hash << Digest::MD5.hexdigest(model.component.cache_key_with_version)
@@ -26,12 +33,11 @@ module Decidim
26
33
  hash << Digest::MD5.hexdigest(model.authors.map(&:cache_key_with_version).to_s)
27
34
  hash << (model.must_render_translation?(model.organization) ? 1 : 0) if model.respond_to?(:must_render_translation?)
28
35
  hash << model.component.participatory_space.active_step.id if model.component.participatory_space.try(:active_step)
29
- hash << has_footer?
30
- hash << has_actions?
31
36
 
32
37
  hash.join(Decidim.cache_key_separator)
33
38
  end
34
39
  # rubocop:enable Metrics/CyclomaticComplexity
40
+ # rubocop:enable Metrics/PerceivedComplexity
35
41
  end
36
42
  end
37
43
  end
@@ -1,14 +1,7 @@
1
- <section class="wrapper-home map-block home-section">
2
- <div class="row">
1
+ <section class="map-block home__section">
2
+ <%= content_tag("h3", section_title) if section_title.present? %>
3
3
 
4
- <%= section_title %></h3>
5
-
6
- <div class="row">
7
- <div class="columns medium-12">
8
- <%= awesome_map_for global_map_components do %>
9
- <%= render partial: "decidim/decidim_awesome/map_component/map/map_template.html", locals: { categories: all_categories, map_height: model.settings.map_height } %>
10
- <% end %>
11
- </div>
12
- </div>
13
- </div>
4
+ <%= awesome_map_for global_map_components do %>
5
+ <%= render partial: "decidim/decidim_awesome/map_component/map/map_template.html", locals: { categories: all_categories, map_height: model.settings.map_height } %>
6
+ <% end %>
14
7
  </section>
@@ -40,11 +40,15 @@ module Decidim
40
40
 
41
41
  def global_map_components
42
42
  @global_map_components ||= Decidim::Component.where(manifest_name: [:meetings, :proposals]).published.filter do |component|
43
- case component.manifest.name
44
- when :meetings
45
- true
46
- when :proposals
47
- component.settings.geocoding_enabled
43
+ if component.organization == current_organization
44
+ case component.manifest.name
45
+ when :meetings
46
+ true
47
+ when :proposals
48
+ component.settings.geocoding_enabled
49
+ else
50
+ false
51
+ end
48
52
  else
49
53
  false
50
54
  end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module Voting
6
+ # This cell renders metadata for an instance of a Proposal
7
+ class ProposalMetadataCell < ::Decidim::Proposals::ProposalMetadataCell
8
+ private
9
+
10
+ def proposal_items
11
+ [coauthors_item, comments_count_item, endorsements_count_item, weight_count_item, state_item, emendation_item]
12
+ end
13
+
14
+ def current_vote
15
+ @current_vote ||= Decidim::Proposals::ProposalVote.find_by(author: current_user, proposal: resource)
16
+ end
17
+
18
+ def user_voted_weight
19
+ current_vote&.weight
20
+ end
21
+
22
+ def all_weights
23
+ @all_weights ||= begin
24
+ weights = [3, 2, 1]
25
+ weights << 0 if resource.component.settings.voting_cards_show_abstain
26
+ weights.index_with do |weight|
27
+ resource.weight_count(weight)
28
+ end
29
+ end
30
+ end
31
+
32
+ def weight_tags
33
+ @weight_tags ||= all_weights.map do |num, weight|
34
+ content_tag "span", title: resource.manifest.label_for(num), class: "voting-weight_#{num}" do
35
+ "#{t("decidim.decidim_awesome.voting.voting_cards.weights.weight_#{num}_short")} #{weight}"
36
+ end.html_safe
37
+ end
38
+ end
39
+
40
+ def weight_count_item
41
+ return unless resource.respond_to?(:weight_count)
42
+ return if resource.component.current_settings.votes_hidden?
43
+ return if resource&.rejected? || resource&.withdrawn?
44
+
45
+ {
46
+ text: weight_tags.join(" | ").html_safe,
47
+ icon: "#{user_voted_weight ? "checkbox" : "close"}-circle-line",
48
+ data_attributes: all_weights.transform_keys { |num| "weight-#{num}" }
49
+ }
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end