decidim-decidim_awesome 0.8.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (351) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +363 -0
  3. data/README.md +375 -100
  4. data/Rakefile +2 -1
  5. data/app/cells/concerns/decidim/decidim_awesome/global_menu_cell_override.rb +20 -0
  6. data/app/cells/concerns/decidim/decidim_awesome/proposal_l_cell_override.rb +26 -0
  7. data/app/cells/decidim/decidim_awesome/content_blocks/map/show.erb +5 -12
  8. data/app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb +7 -7
  9. data/app/cells/decidim/decidim_awesome/voting/proposal_metadata_cell.rb +69 -0
  10. data/app/cells/decidim/decidim_awesome/voting/voting_cards_base_cell.rb +40 -0
  11. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/modal.erb +18 -0
  12. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/show.erb +40 -0
  13. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal/vote_block_for.erb +16 -0
  14. data/app/cells/decidim/decidim_awesome/voting/voting_cards_proposal_cell.rb +90 -0
  15. data/app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb +2 -2
  16. data/app/commands/concerns/decidim/decidim_awesome/proposals/admin/update_proposal_override.rb +31 -0
  17. data/app/commands/concerns/decidim/decidim_awesome/proposals/create_collaborative_draft_override.rb +27 -0
  18. data/app/commands/concerns/decidim/decidim_awesome/proposals/create_proposal_override.rb +27 -0
  19. data/app/commands/concerns/decidim/decidim_awesome/proposals/update_collaborative_draft_override.rb +27 -0
  20. data/app/commands/concerns/decidim/decidim_awesome/proposals/update_proposal_override.rb +26 -0
  21. data/app/commands/concerns/decidim/decidim_awesome/system/create_organization_override.rb +29 -0
  22. data/app/commands/concerns/decidim/decidim_awesome/system/update_organization_override.rb +35 -0
  23. data/app/commands/concerns/decidim/decidim_awesome/update_account_override.rb +30 -0
  24. data/app/commands/decidim/decidim_awesome/admin/create_constraint.rb +3 -3
  25. data/app/commands/decidim/decidim_awesome/admin/create_custom_redirect.rb +1 -1
  26. data/app/commands/decidim/decidim_awesome/admin/create_menu_hack.rb +1 -1
  27. data/app/commands/decidim/decidim_awesome/admin/create_proposal_custom_field.rb +5 -4
  28. data/app/commands/decidim/decidim_awesome/admin/create_scoped_admin.rb +1 -1
  29. data/app/commands/decidim/decidim_awesome/admin/create_scoped_style.rb +4 -3
  30. data/app/commands/decidim/decidim_awesome/admin/destroy_constraint.rb +1 -1
  31. data/app/commands/decidim/decidim_awesome/admin/destroy_custom_redirect.rb +2 -2
  32. data/app/commands/decidim/decidim_awesome/admin/destroy_menu_hack.rb +2 -2
  33. data/app/commands/decidim/decidim_awesome/admin/destroy_proposal_custom_field.rb +7 -4
  34. data/app/commands/decidim/decidim_awesome/admin/destroy_scoped_admin.rb +1 -1
  35. data/app/commands/decidim/decidim_awesome/admin/destroy_scoped_style.rb +7 -5
  36. data/app/commands/decidim/decidim_awesome/admin/rename_scope_label.rb +2 -2
  37. data/app/commands/decidim/decidim_awesome/admin/update_config.rb +2 -3
  38. data/app/commands/decidim/decidim_awesome/admin/update_constraint.rb +3 -3
  39. data/app/commands/decidim/decidim_awesome/admin/update_custom_redirect.rb +3 -3
  40. data/app/commands/decidim/decidim_awesome/admin/update_menu_hack.rb +1 -1
  41. data/app/commands/decidim/decidim_awesome/command.rb +8 -0
  42. data/app/commands/decidim/decidim_awesome/create_editor_image.rb +2 -2
  43. data/app/controllers/concerns/decidim/decidim_awesome/admin/maintenance_context.rb +43 -0
  44. data/app/controllers/concerns/decidim/decidim_awesome/admin_accountability/admin/filterable.rb +67 -0
  45. data/app/controllers/concerns/decidim/decidim_awesome/admin_accountability/admin/filterable_helper.rb +38 -0
  46. data/app/controllers/concerns/decidim/decidim_awesome/check_login_authorizations.rb +60 -0
  47. data/app/controllers/concerns/decidim/decidim_awesome/content_security_policy.rb +34 -0
  48. data/app/controllers/concerns/decidim/decidim_awesome/limit_pending_amendments.rb +35 -0
  49. data/app/controllers/concerns/decidim/decidim_awesome/needs_awesome_config.rb +0 -2
  50. data/app/controllers/concerns/decidim/decidim_awesome/not_found_redirect.rb +3 -3
  51. data/app/controllers/concerns/decidim/decidim_awesome/proposals/memoize_extra_fields.rb +23 -0
  52. data/app/controllers/concerns/decidim/decidim_awesome/proposals/orderable_override.rb +94 -0
  53. data/app/controllers/concerns/decidim/decidim_awesome/proposals/proposal_votes_controller_override.rb +64 -0
  54. data/app/controllers/concerns/decidim/decidim_awesome/use_user_time_zone.rb +32 -0
  55. data/app/controllers/decidim/decidim_awesome/admin/admin_accountability_controller.rb +72 -0
  56. data/app/controllers/decidim/decidim_awesome/admin/admin_authorizations_controller.rb +122 -0
  57. data/app/controllers/decidim/decidim_awesome/admin/application_controller.rb +2 -0
  58. data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +21 -17
  59. data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +17 -8
  60. data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +27 -20
  61. data/app/controllers/decidim/decidim_awesome/admin/custom_redirects_controller.rb +6 -8
  62. data/app/controllers/decidim/decidim_awesome/admin/maintenance_controller.rb +76 -0
  63. data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +6 -8
  64. data/app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb +14 -6
  65. data/app/controllers/decidim/decidim_awesome/admin/scoped_admins_controller.rb +2 -2
  66. data/app/controllers/decidim/decidim_awesome/admin/scoped_styles_controller.rb +14 -6
  67. data/app/controllers/decidim/decidim_awesome/blank_component_controller.rb +8 -3
  68. data/app/controllers/decidim/decidim_awesome/editor_images_controller.rb +3 -5
  69. data/app/controllers/decidim/decidim_awesome/iframe_component/iframe_controller.rb +18 -5
  70. data/app/controllers/decidim/decidim_awesome/required_authorizations_controller.rb +58 -0
  71. data/app/forms/concerns/decidim/decidim_awesome/account_form_override.rb +25 -0
  72. data/app/forms/concerns/decidim/decidim_awesome/proposals/proposal_form_customizations.rb +57 -0
  73. data/app/forms/concerns/decidim/decidim_awesome/proposals/proposal_form_override.rb +21 -0
  74. data/app/forms/concerns/decidim/decidim_awesome/system/organization_form_override.rb +34 -0
  75. data/app/forms/decidim/decidim_awesome/admin/config_form.rb +88 -20
  76. data/app/forms/decidim/decidim_awesome/admin/custom_redirect_form.rb +3 -3
  77. data/app/forms/decidim/decidim_awesome/admin/intergram_form.rb +4 -0
  78. data/app/forms/decidim/decidim_awesome/admin/menu_form.rb +5 -5
  79. data/app/helpers/concerns/decidim/decidim_awesome/amendments_helper_override.rb +65 -0
  80. data/app/helpers/concerns/decidim/decidim_awesome/breadcrumb_helper_override.rb +23 -0
  81. data/app/helpers/concerns/decidim/decidim_awesome/proposals/application_helper_override.rb +110 -0
  82. data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +12 -29
  83. data/app/helpers/decidim/decidim_awesome/admin/system_checker_helpers.rb +4 -0
  84. data/app/helpers/decidim/decidim_awesome/map_helper.rb +38 -52
  85. data/app/jobs/decidim/decidim_awesome/destroy_private_data_job.rb +22 -0
  86. data/app/jobs/decidim/decidim_awesome/export_admin_actions_job.rb +28 -0
  87. data/app/models/concerns/decidim/decidim_awesome/has_proposal_extra_fields.rb +80 -0
  88. data/app/models/concerns/decidim/decidim_awesome/has_vote_weight.rb +30 -0
  89. data/app/models/decidim/decidim_awesome/awesome_config.rb +1 -2
  90. data/app/models/decidim/decidim_awesome/config_constraint.rb +0 -2
  91. data/app/models/decidim/decidim_awesome/editor_image.rb +0 -3
  92. data/app/models/decidim/decidim_awesome/paper_trail_version.rb +117 -0
  93. data/app/models/decidim/decidim_awesome/proposal_extra_field.rb +45 -0
  94. data/app/models/decidim/decidim_awesome/vote_weight.rb +30 -0
  95. data/app/overrides/decidim/account/show/add_timezone_select.html.erb.deface +3 -0
  96. data/app/overrides/decidim/admin/officializations/index/add_modal.html.erb.deface +3 -0
  97. data/app/overrides/decidim/admin/officializations/index/add_td.html.erb.deface +5 -0
  98. data/app/overrides/decidim/admin/officializations/index/add_th.html.erb.deface +5 -0
  99. data/app/overrides/decidim/proposals/admin/proposals/_form/replace_editor.html.erb.deface +3 -0
  100. data/app/overrides/decidim/proposals/admin/proposals/show/add_private_body.html.erb.deface +7 -0
  101. data/app/overrides/decidim/proposals/admin/proposals/show/replace_body.html.erb.deface +5 -0
  102. data/app/overrides/decidim/proposals/proposals/_proposal_aside/limit_amendments_modal.html.erb.deface +5 -0
  103. data/app/overrides/decidim/proposals/proposals/_vote_button/replace_vote_button.html.erb.deface +7 -0
  104. data/app/overrides/decidim/proposals/proposals/_votes_count/replace_counter.html.erb.deface +10 -0
  105. data/app/overrides/decidim/system/organizations/_advanced_settings/add_awesome_config.html.erb.deface +9 -0
  106. data/app/{views/layouts/decidim/_head.html.erb → overrides/layouts/decidim/_decidim_javascript/add_awesome_tags.html.erb.deface} +2 -1
  107. data/app/overrides/layouts/decidim/_head/add_awesome_tags.html.erb.deface +7 -0
  108. data/app/overrides/layouts/decidim/admin/_header/add_awesome_custom_styles.html.erb.deface +3 -0
  109. data/app/overrides/layouts/decidim/admin/_header/add_awesome_tags.html.erb.deface +10 -0
  110. data/app/packs/entrypoints/decidim_admin_decidim_awesome.js +2 -2
  111. data/app/packs/entrypoints/decidim_admin_decidim_awesome_global.js +4 -0
  112. data/app/packs/entrypoints/decidim_admin_decidim_awesome_global.scss +1 -0
  113. data/app/packs/entrypoints/decidim_admin_decidim_awesome_search_form.scss +1 -0
  114. data/app/packs/entrypoints/decidim_decidim_awesome.js +2 -2
  115. data/app/packs/entrypoints/decidim_decidim_awesome_map.scss +1 -1
  116. data/app/packs/entrypoints/decidim_editor.js +14 -0
  117. data/app/packs/images/decidim/decidim_awesome/handcard.svg +14 -0
  118. data/app/packs/images/decidim/decidim_awesome/handcheck.svg +17 -0
  119. data/app/packs/images/decidim/decidim_awesome/pokecode-logo.png +0 -0
  120. data/app/packs/src/decidim/decidim_awesome/admin/auto_edit.js +96 -69
  121. data/app/packs/src/decidim/decidim_awesome/admin/check_redirections.js +46 -41
  122. data/app/packs/src/decidim/decidim_awesome/admin/codemirror.js +3 -3
  123. data/app/packs/src/decidim/decidim_awesome/admin/constraint_form_events.js +115 -0
  124. data/app/packs/src/decidim/decidim_awesome/admin/custom_fields_builder.js +19 -14
  125. data/app/packs/src/decidim/decidim_awesome/admin/form_exit_warn.js +23 -11
  126. data/app/packs/src/decidim/decidim_awesome/admin/proposal_sortings.js +26 -0
  127. data/app/packs/src/decidim/decidim_awesome/admin/tabs_change.js +31 -0
  128. data/app/packs/src/decidim/decidim_awesome/admin/user_picker.js +34 -20
  129. data/app/packs/src/decidim/decidim_awesome/admin/verification_selects.js +21 -0
  130. data/app/packs/src/decidim/decidim_awesome/admin/verifications.js +43 -0
  131. data/app/packs/src/decidim/decidim_awesome/amendments/show_modal_on_limits.js +28 -0
  132. data/app/packs/src/decidim/decidim_awesome/awesome_admin.js +7 -16
  133. data/app/packs/src/decidim/decidim_awesome/awesome_admin_global.js +2 -0
  134. data/app/packs/src/decidim/decidim_awesome/awesome_application.js +2 -15
  135. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/fetcher.js +48 -23
  136. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/meetings_fetcher.js +9 -12
  137. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/proposals_fetcher.js +28 -0
  138. data/app/packs/src/decidim/decidim_awesome/awesome_map/awesome_map.js +15 -15
  139. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/controller.js +70 -37
  140. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/meetings_controller.js +11 -7
  141. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/proposals_controller.js +9 -16
  142. data/app/packs/src/decidim/decidim_awesome/awesome_map/controls_ui.js +75 -45
  143. data/app/packs/src/decidim/decidim_awesome/awesome_map/load_map.js +28 -18
  144. data/app/packs/src/decidim/decidim_awesome/editor/index.js +94 -0
  145. data/app/packs/src/decidim/decidim_awesome/forms/autosave.js +29 -28
  146. data/app/packs/src/decidim/decidim_awesome/forms/custom_fields_renderer.js +55 -42
  147. data/app/packs/src/decidim/decidim_awesome/forms/rich_text_plugin.js +30 -32
  148. data/app/packs/src/decidim/decidim_awesome/proposals/custom_fields.js +32 -16
  149. data/app/packs/src/decidim/decidim_awesome/proposals/images.js +16 -10
  150. data/app/packs/src/decidim/decidim_awesome/voting/voting_cards.js +72 -0
  151. data/app/packs/stylesheets/decidim/decidim_awesome/admin/admin_accountability.scss +67 -0
  152. data/app/packs/stylesheets/decidim/decidim_awesome/admin/auto_edits.scss +11 -12
  153. data/app/packs/stylesheets/decidim/decidim_awesome/admin/check_redirections.scss +15 -0
  154. data/app/packs/stylesheets/decidim/decidim_awesome/admin/codemirror.scss +24 -12
  155. data/app/packs/stylesheets/decidim/decidim_awesome/admin/constraints.scss +49 -29
  156. data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_fields.scss +28 -71
  157. data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_styles.scss +48 -0
  158. data/app/packs/stylesheets/decidim/decidim_awesome/admin/intergram_fixes.scss +11 -0
  159. data/app/packs/stylesheets/decidim/decidim_awesome/admin/user_picker.scss +17 -26
  160. data/app/packs/stylesheets/decidim/decidim_awesome/admin/verifications.scss +99 -0
  161. data/app/packs/stylesheets/decidim/decidim_awesome/amendments/modal.scss +5 -0
  162. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin.scss +14 -49
  163. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin_global.scss +20 -0
  164. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_application.scss +4 -18
  165. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_iframe/iframe.scss +1 -1
  166. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_map/map.scss +41 -35
  167. data/app/packs/stylesheets/decidim/decidim_awesome/forms/autosave.scss +6 -6
  168. data/app/packs/stylesheets/decidim/decidim_awesome/forms/custom_fields.scss +118 -0
  169. data/app/packs/stylesheets/decidim/decidim_awesome/shared/spinner.scss +26 -0
  170. data/app/packs/stylesheets/decidim/decidim_awesome/voting/voting_cards.scss +205 -0
  171. data/app/permissions/decidim/decidim_awesome/admin/permissions.rb +57 -1
  172. data/app/permissions/decidim/decidim_awesome/permissions.rb +11 -6
  173. data/app/presenters/concerns/decidim/decidim_awesome/breadcrumb_root_menu_item_presenter_override.rb +23 -0
  174. data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_item_presenter_override.rb +10 -2
  175. data/app/presenters/{decidim → concerns/decidim}/decidim_awesome/menu_presenter_override.rb +8 -0
  176. data/app/presenters/concerns/decidim/decidim_awesome/proposals/proposal_presenter_override.rb +20 -0
  177. data/app/presenters/decidim/decidim_awesome/admin_log/component_presenter_override.rb +28 -0
  178. data/app/presenters/decidim/decidim_awesome/admin_log/user_presenter_override.rb +46 -0
  179. data/app/presenters/decidim/decidim_awesome/paper_trail_base_presenter.rb +28 -0
  180. data/app/presenters/decidim/decidim_awesome/participatory_space_role_presenter.rb +45 -0
  181. data/app/presenters/decidim/decidim_awesome/private_data_presenter.rb +70 -0
  182. data/app/presenters/decidim/decidim_awesome/role_base_presenter.rb +102 -0
  183. data/app/presenters/decidim/decidim_awesome/user_entity_presenter.rb +50 -0
  184. data/app/queries/decidim/decidim_awesome/private_data_finder.rb +19 -0
  185. data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_methods.rb +72 -0
  186. data/app/serializers/concerns/decidim/decidim_awesome/proposals/proposal_serializer_override.rb +38 -0
  187. data/app/serializers/decidim/decidim_awesome/paper_trail_version_serializer.rb +37 -0
  188. data/app/serializers/decidim/decidim_awesome/proposals/private_proposal_serializer.rb +34 -0
  189. data/app/types/concerns/decidim/decidim_awesome/add_proposal_type_custom_fields.rb +59 -0
  190. data/app/types/concerns/decidim/decidim_awesome/add_proposal_type_vote_weights.rb +20 -0
  191. data/app/uploaders/decidim/decidim_awesome/image_uploader.rb +12 -0
  192. data/app/validators/concerns/decidim/decidim_awesome/etiquette_validator_override.rb +41 -0
  193. data/app/views/decidim/decidim_awesome/account/_timezone_select.html.erb +3 -0
  194. data/app/views/decidim/decidim_awesome/admin/admin_accountability/index.html.erb +71 -0
  195. data/app/views/decidim/decidim_awesome/admin/admin_authorizations/authorization.html.erb +20 -0
  196. data/app/views/decidim/decidim_awesome/admin/admin_authorizations/callout.html.erb +3 -0
  197. data/app/views/decidim/decidim_awesome/admin/admin_authorizations/conflict.html.erb +5 -0
  198. data/app/views/decidim/decidim_awesome/admin/admin_authorizations/edit.html.erb +41 -0
  199. data/app/views/decidim/decidim_awesome/admin/checks/_assets_tester.html.erb +2 -0
  200. data/app/views/decidim/decidim_awesome/admin/checks/index.html.erb +51 -48
  201. data/app/views/decidim/decidim_awesome/admin/config/_autoedit_box_label.html.erb +7 -2
  202. data/app/views/decidim/decidim_awesome/admin/config/_constraints.html.erb +25 -18
  203. data/app/views/decidim/decidim_awesome/admin/config/_form_admins.html.erb +7 -6
  204. data/app/views/decidim/decidim_awesome/admin/config/_form_editors.html.erb +12 -16
  205. data/app/views/decidim/decidim_awesome/admin/config/_form_livechat.html.erb +39 -23
  206. data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_custom_fields.html.erb +35 -17
  207. data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_private_custom_fields.html.erb +1 -0
  208. data/app/views/decidim/decidim_awesome/admin/config/_form_proposals.html.erb +92 -6
  209. data/app/views/decidim/decidim_awesome/admin/config/_form_scoped_admin_styles.html.erb +1 -0
  210. data/app/views/decidim/decidim_awesome/admin/config/_form_scoped_styles.html.erb +48 -0
  211. data/app/views/decidim/decidim_awesome/admin/config/_form_surveys.html.erb +16 -6
  212. data/app/views/decidim/decidim_awesome/admin/config/_form_verifications.html.erb +15 -0
  213. data/app/views/decidim/decidim_awesome/admin/config/show.html.erb +22 -12
  214. data/app/views/decidim/decidim_awesome/admin/constraints/_form.html.erb +1 -49
  215. data/app/views/decidim/decidim_awesome/admin/constraints/new.html.erb +14 -9
  216. data/app/views/decidim/decidim_awesome/admin/constraints/no_permissions.html.erb +6 -0
  217. data/app/views/decidim/decidim_awesome/admin/constraints/show.html.erb +14 -9
  218. data/app/views/decidim/decidim_awesome/admin/custom_redirects/_form.html.erb +20 -5
  219. data/app/views/decidim/decidim_awesome/admin/custom_redirects/edit.html.erb +5 -5
  220. data/app/views/decidim/decidim_awesome/admin/custom_redirects/index.html.erb +14 -13
  221. data/app/views/decidim/decidim_awesome/admin/custom_redirects/new.html.erb +5 -5
  222. data/app/views/decidim/decidim_awesome/admin/maintenance/_private_data.html.erb +44 -0
  223. data/app/views/decidim/decidim_awesome/admin/maintenance/show.html.erb +44 -0
  224. data/app/views/decidim/decidim_awesome/admin/menu_hacks/_form.html.erb +6 -6
  225. data/app/views/decidim/decidim_awesome/admin/menu_hacks/edit.html.erb +21 -12
  226. data/app/views/decidim/decidim_awesome/admin/menu_hacks/index.html.erb +39 -42
  227. data/app/views/decidim/decidim_awesome/admin/menu_hacks/new.html.erb +21 -12
  228. data/app/views/decidim/decidim_awesome/admin/officializations/_participants_td.html.erb +25 -0
  229. data/app/views/decidim/decidim_awesome/admin/officializations/_participants_th.html.erb +1 -0
  230. data/app/views/decidim/decidim_awesome/admin/officializations/_verification_modal.html.erb +9 -0
  231. data/app/views/decidim/decidim_awesome/admin/proposals/_editor.html.erb +8 -5
  232. data/app/views/decidim/decidim_awesome/admin/proposals/_private_body.html.erb +20 -0
  233. data/app/views/decidim/decidim_awesome/admin/shared/_filters_with_date.html.erb +61 -0
  234. data/app/views/decidim/decidim_awesome/amendments/_modal.html.erb +23 -0
  235. data/app/views/decidim/decidim_awesome/custom_fields/_form_render.html.erb +8 -2
  236. data/app/views/decidim/decidim_awesome/iframe_component/iframe/show.html.erb +7 -12
  237. data/app/views/decidim/decidim_awesome/map_component/map/_map_template.html.erb +53 -37
  238. data/app/views/decidim/decidim_awesome/map_component/map/show.html.erb +14 -5
  239. data/app/views/decidim/decidim_awesome/required_authorizations/index.html.erb +66 -0
  240. data/app/views/decidim/decidim_awesome/system/organizations/_admin_allowed_authorizations.html.erb +5 -0
  241. data/app/views/decidim/decidim_awesome/voting/voting_cards/_show_vote_button.html.erb +3 -0
  242. data/app/views/decidim/decidim_awesome/voting/voting_cards/_show_votes_count.html.erb +1 -0
  243. data/app/views/layouts/decidim/decidim_awesome/_awesome_config.html.erb +11 -8
  244. data/app/views/layouts/decidim/decidim_awesome/_custom_styles.html.erb +1 -1
  245. data/app/views/layouts/decidim/decidim_awesome/_intergram_widget.html.erb +9 -6
  246. data/app/views/layouts/decidim/decidim_awesome/admin/_base.html.erb +12 -0
  247. data/app/views/layouts/decidim/decidim_awesome/admin/_custom_styles.html.erb +3 -0
  248. data/app/views/layouts/decidim/decidim_awesome/admin/admin_authorizations.html.erb +7 -0
  249. data/app/views/layouts/decidim/decidim_awesome/admin/application.html.erb +3 -0
  250. data/app/views/layouts/decidim/decidim_awesome/admin/maintenance.html.erb +19 -0
  251. data/config/assets.rb +5 -34
  252. data/config/i18n-tasks.yml +30 -0
  253. data/config/locales/ca.yml +335 -26
  254. data/config/locales/cs.yml +331 -22
  255. data/config/locales/de.yml +642 -0
  256. data/config/locales/en.yml +403 -33
  257. data/config/locales/es.yml +333 -24
  258. data/config/locales/eu.yml +623 -20
  259. data/config/locales/fr.yml +282 -23
  260. data/config/locales/hu.yml +268 -0
  261. data/config/locales/it.yml +155 -24
  262. data/config/locales/ja.yml +334 -25
  263. data/config/locales/lt.yml +94 -0
  264. data/config/locales/nl.yml +20 -19
  265. data/config/locales/pt-BR.yml +31 -24
  266. data/config/locales/ro-RO.yml +152 -0
  267. data/config/locales/sv.yml +28 -12
  268. data/config/rubocop/disabled.yml +11 -0
  269. data/config/rubocop/faker.yml +480 -0
  270. data/config/rubocop/rails.yml +88 -0
  271. data/config/rubocop/rspec.yml +65 -0
  272. data/config/rubocop/ruby.yml +1210 -0
  273. data/db/migrate/20231006113837_create_decidim_awesome_vote_weights.rb +13 -0
  274. data/db/migrate/20231006113841_create_decidim_awesome_proposal_extra_fields.rb +14 -0
  275. data/db/migrate/20240306175331_rename_editor_images_awesome_config.rb +18 -0
  276. data/db/migrate/20240531224204_add_decidim_awesome_proposal_private_fields.rb +29 -0
  277. data/db/migrate/20240729164227_add_decidim_awesome_proposal_private_fields_date.rb +20 -0
  278. data/db/seeds.rb +4 -4
  279. data/lib/decidim/decidim_awesome/admin_engine.rb +41 -6
  280. data/lib/decidim/decidim_awesome/api/types/localized_custom_fields_type.rb +22 -0
  281. data/lib/decidim/decidim_awesome/api/types/translated_custom_fields_type.rb +51 -0
  282. data/lib/decidim/decidim_awesome/authorizator.rb +34 -0
  283. data/lib/decidim/decidim_awesome/awesome.rb +236 -29
  284. data/lib/decidim/decidim_awesome/awesome_helpers.rb +57 -17
  285. data/lib/decidim/decidim_awesome/checksums.yml +95 -20
  286. data/lib/decidim/decidim_awesome/config.rb +25 -17
  287. data/lib/decidim/decidim_awesome/context_analyzers/request_analyzer.rb +3 -3
  288. data/lib/decidim/decidim_awesome/custom_fields.rb +13 -5
  289. data/lib/decidim/decidim_awesome/engine.rb +250 -19
  290. data/lib/decidim/decidim_awesome/iframe_component/component.rb +4 -4
  291. data/lib/decidim/decidim_awesome/lock.rb +47 -0
  292. data/lib/decidim/decidim_awesome/map_component/component.rb +2 -2
  293. data/lib/decidim/decidim_awesome/menu.rb +201 -0
  294. data/lib/decidim/decidim_awesome/menu_hacker.rb +7 -5
  295. data/{app/middleware/decidim/decidim_awesome → lib/decidim/decidim_awesome/middleware}/current_config.rb +5 -3
  296. data/lib/decidim/decidim_awesome/request_memoizer.rb +16 -0
  297. data/lib/decidim/decidim_awesome/system_checker.rb +6 -2
  298. data/lib/decidim/decidim_awesome/test/factories.rb +31 -9
  299. data/lib/decidim/decidim_awesome/test/initializer.rb +22 -6
  300. data/lib/decidim/decidim_awesome/test/layouts/decidim/_head.html.erb +2 -2
  301. data/lib/decidim/decidim_awesome/test/layouts/decidim/admin/_header.html.erb +2 -2
  302. data/lib/decidim/decidim_awesome/test/shared_examples/action_log_presenter_examples.rb +61 -0
  303. data/lib/decidim/decidim_awesome/test/shared_examples/{box_label_editor.rb → box_label_editor_examples.rb} +22 -22
  304. data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +24 -6
  305. data/lib/decidim/decidim_awesome/test/shared_examples/custom_fields_examples.rb +155 -0
  306. data/lib/decidim/decidim_awesome/test/shared_examples/custom_redirects_contexts.rb +7 -7
  307. data/lib/decidim/decidim_awesome/test/shared_examples/custom_styles_examples.rb +156 -0
  308. data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +42 -58
  309. data/lib/decidim/decidim_awesome/test/shared_examples/menu_hack_contexts.rb +9 -8
  310. data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +40 -29
  311. data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +129 -38
  312. data/lib/decidim/decidim_awesome/version.rb +2 -2
  313. data/lib/decidim/decidim_awesome/voting_manifest.rb +55 -0
  314. data/lib/decidim/decidim_awesome.rb +1 -3
  315. data/lib/tasks/decidim_awesome_upgrade_tasks.rake +9 -0
  316. data/lib/tasks/decidim_awesome_webpacker_tasks.rake +2 -0
  317. data/package.json +54 -0
  318. metadata +192 -86
  319. data/app/forms/decidim/decidim_awesome/proposals/proposal_wizard_create_step_form_override.rb +0 -38
  320. data/app/helpers/decidim/decidim_awesome/amendments_helper_override.rb +0 -48
  321. data/app/helpers/decidim/decidim_awesome/proposals/application_helper_override.rb +0 -78
  322. data/app/jobs/decidim/decidim_awesome/migrate_legacy_images_job.rb +0 -106
  323. data/app/packs/entrypoints/decidim_admin_decidim_awesome_custom_fields.js +0 -2
  324. data/app/packs/entrypoints/decidim_decidim_awesome_admin_form_exit_warn.js +0 -1
  325. data/app/packs/images/decidim/decidim_awesome/platoniq-logo.png +0 -0
  326. data/app/packs/src/decidim/decidim_awesome/admin/constraints.js +0 -55
  327. data/app/packs/src/decidim/decidim_awesome/editors/editor.js +0 -190
  328. data/app/packs/src/decidim/decidim_awesome/editors/tabs_focus.js +0 -22
  329. data/app/packs/src/vendor/image-resize.min.js +0 -1
  330. data/app/packs/src/vendor/image-upload.min.js +0 -6
  331. data/app/packs/src/vendor/leaflet.featuregroup.subgroup.js +0 -184
  332. data/app/packs/stylesheets/decidim/decidim_awesome/editors/markdown_editor.scss +0 -19
  333. data/app/packs/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss +0 -58
  334. data/app/packs/stylesheets/vendor/select2-foundation-theme.scss +0 -348
  335. data/app/uploaders/decidim/cw/decidim_awesome/image_uploader.rb +0 -26
  336. data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +0 -26
  337. data/app/views/decidim/decidim_awesome/admin/config/_modal.html.erb +0 -11
  338. data/app/views/decidim/proposals/admin/proposals/_form.html.erb +0 -101
  339. data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +0 -83
  340. data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +0 -1
  341. data/app/views/layouts/decidim/admin/_header.html.erb +0 -5
  342. data/app/views/layouts/decidim/admin/decidim_awesome.html.erb +0 -75
  343. data/app/views/v0.25/decidim/proposals/collaborative_drafts/_show.html.erb +0 -128
  344. data/app/views/v0.25/layouts/decidim/_head.html.erb +0 -41
  345. data/app/views/v0.25/layouts/decidim/admin/_header.html.erb +0 -11
  346. data/app/views/v0.26/decidim/proposals/collaborative_drafts/_show.html.erb +0 -128
  347. data/app/views/v0.26/layouts/decidim/_head.html.erb +0 -45
  348. data/app/views/v0.26/layouts/decidim/admin/_header.html.erb +0 -11
  349. data/lib/decidim/decidim_awesome/content_parsers/editor_images_parser.rb +0 -39
  350. data/lib/tasks/decidim_awesome_active_storage_migrations_tasks.rake +0 -37
  351. /data/app/models/{decidim → concerns/decidim}/decidim_awesome/user_override.rb +0 -0
data/README.md CHANGED
@@ -1,24 +1,20 @@
1
1
  # Decidim::DecidimAwesome
2
2
 
3
- [![[CI] Test](https://github.com/Platoniq/decidim-module-decidim_awesome/actions/workflows/test.yml/badge.svg)](https://github.com/Platoniq/decidim-module-decidim_awesome/actions/workflows/test.yml)
4
- [![Maintainability](https://api.codeclimate.com/v1/badges/2dada53525dd5a944089/maintainability)](https://codeclimate.com/github/Platoniq/decidim-module-decidim_awesome/maintainability)
5
- [![Test Coverage](https://codecov.io/gh/Platoniq/decidim-module-decidim_awesome/branch/master/graph/badge.svg?token=TFBMCLLZJG)](https://codecov.io/gh/Platoniq/decidim-module-decidim_awesome)
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)
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)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/2dada53525dd5a944089/maintainability)](https://codeclimate.com/github/decidim-ice/decidim-module-decidim_awesome/maintainability)
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)
6
7
 
7
- Usability and UX tweaks for Decidim.
8
+ **Usability and UX tweaks for Decidim.**
8
9
 
9
10
  This plugin allows the administrators to expand the possibilities of Decidim beyond some existing limitations.
10
- 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).
11
12
 
12
- **DISCLAIMER: This module is heavily tested and widely used, howevever we do not accept any responsibility for breaking anything. Feedback is appreciated though.**
13
+ **DISCLAIMER: This module is heavily tested and widely used, however we do not accept any responsibility for breaking anything. Feedback is appreciated though.**
13
14
 
14
15
  ## Why this plugin?
15
16
 
16
- At Platoniq, we like to explore and combine open tools for enriching democracy in many levels. And also for organizations or companies, not only governments.
17
- Currently we are working very closely with the team behind [Decidim](https://decidim.org) because we believe that it is a great software.
18
-
19
- However in Platoniq we have this slogan: "Democracy is fun if you take it seriously" (feel free to ask for T-shirts 😉).
20
- And, let's face it, sometimes we feel that Decidim lacks a bit of the "fun" part so we created this.
21
- Because Decidim is awesome and so is this!
17
+ Decidim is an awesome platform, but it has some limitations that can be annoying for the users or the admins. This plugin tries to solve some of them. See the list of tweaks below.
22
18
 
23
19
  ## Usage
24
20
 
@@ -33,13 +29,13 @@ Each hack can be scoped to one or more specific participatory spaces or componen
33
29
 
34
30
  ### Tweaks:
35
31
 
36
- #### 1. Image support for the Quill editor
32
+ #### 1. Image support for the RichText editor
37
33
 
38
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).
39
35
 
40
36
  This feature allows you use images in newsletters as well.
41
37
 
42
- ![Images in Quill Editor](examples/quill-images.png)
38
+ ![Images in RichText Editor](examples/quill-images.png)
43
39
 
44
40
  #### 2. Auto-save for surveys and forms
45
41
 
@@ -49,27 +45,23 @@ It works purely in the client side by using LocalStorage capabilities of the bro
49
45
 
50
46
  Saving the form removes the stored data.
51
47
 
52
- ![Auto save in forms](examples/auto-save.png)
48
+ ![Auto save in forms](examples/auto-save.gif)
53
49
 
54
50
  #### 3. Images in proposals
55
51
 
56
- 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.
57
53
 
58
54
  ![Proposal images](examples/proposal-images.png)
59
55
 
60
- #### 4. Markdown editor for proposals
61
-
62
- Allows to use markdown when creating proposals instead of a bare textarea.
63
-
64
- #### 5. Admin scope configuration
56
+ #### 4. Restrict scope for tweaks
65
57
 
66
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.
67
59
 
68
- 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.
69
61
 
70
- ![Admin tweaks for editors](examples/admin-editors.png)
62
+ ![Tweak scopes](examples/tweak-scopes.png)
71
63
 
72
- #### 6. Awesome map component
64
+ #### 5. Awesome map component
73
65
 
74
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.
75
67
 
@@ -77,25 +69,31 @@ It also provides a simple search by category, each category is assigned to a dif
77
69
 
78
70
  ![Awesome map](examples/awesome-map.png)
79
71
 
80
- #### 7. Fullscreen Iframe component
72
+ #### 6. Fullscreen Iframe component
81
73
 
82
74
  Another simple component that can be used to embed and Iframe with any external content in it that fills all the viewport.
83
75
 
84
76
  ![Fullscreen iframe](examples/fullscreen-iframe.png)
85
77
 
86
- #### 8. Live support chat
78
+ #### 7. Live support chat
87
79
 
88
- 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).
89
81
 
90
82
  ![Intergram screenshot](examples/intergram.png)
91
83
 
92
- #### 9. Custom CSS applied only according scoped restrictions
84
+ #### 8. Custom CSS applied only according scoped restrictions
85
+
86
+ ##### 8.1 Public styles
87
+ With this feature you can create directly in the admin a CSS snipped that is only applied in the public frontend, in a particular assembly or even a single proposal!
88
+
89
+ ![CSS screenshot](examples/custom_styles_public.png)
93
90
 
94
- 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!
91
+ ##### 8.2 Admin styles
92
+ With this feature you can create directly in the admin a CSS snipped that is only applied in the admin panel, in a particular assembly or even a single proposal!
95
93
 
96
- ![CSS screenshot](examples/custom_styles.png)
94
+ ![CSS screenshot](examples/custom_styles_admin.png)
97
95
 
98
- #### 10. Change the main menu of Decidim entirely!
96
+ #### 9. Change the main menu of Decidim entirely!
99
97
 
100
98
  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.
101
99
 
@@ -104,15 +102,15 @@ Feel free to hide, modify or add items in the Decidim's main menu. You can also
104
102
  ![Menu hacks screenshot](examples/menu-3.png)
105
103
  ![Menu hacks screenshot](examples/menu-4.png)
106
104
 
107
- #### 11. Assign admins to specific scopes and prevent them modify anything else
105
+ #### 10. Assign admins to specific scopes and prevent them modify anything else
108
106
 
109
- Convert any user on the platform (that is not currently an admin) to a limited subset of participatory spaces or event compoponents. Just add users to a box and scope them to some constraints. These users will se the "Edit" button in everywhere they have permissions. Any access to unallowed zones will redirect the user to the admin index page.
107
+ 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.
110
108
 
111
109
  ![Scoped admins authorized](examples/scoped_admins_authorized.png)
112
110
  ![Scoped admins unauthorized](examples/scoped_admins_unauthorized.png)
113
111
  ![Scoped admins configuration](examples/scoped_admins_config.png)
114
112
 
115
- #### 12. Custom fields for proposals
113
+ #### 11. Custom fields for proposals
116
114
 
117
115
  Now admins can substitute the body of a proposal with a set of form fields.
118
116
  Edition is make with a Drag & Drop interface in the admin and can (and should) be scoped to apply only to certain proposal components.
@@ -123,12 +121,79 @@ Technically, the content is stored in the database as an XML document compatible
123
121
  ![Custom fields screenshot](examples/custom-fields-2.png)
124
122
  ![Custom fields screenshot](examples/custom-fields-1.gif)
125
123
 
126
- #### 13. Custom Redirections (or URL shortener feature)
124
+ 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/.
125
+ If you wish to provide an alternative place for those files, you can configure the variable `form_builder_langs_location` in an initializer:
126
+
127
+ ```ruby
128
+ # config/initializers/awesome_defaults.rb
129
+
130
+ # A URL where to obtain the translations for the FormBuilder component
131
+ # you can a custom place if you are worried about the CDN geolocation
132
+ # Download them from https://github.com/kevinchappell/formBuilder-languages
133
+
134
+ # For instance, copy them to your /public/fb_locales/ directory and set the path here:
135
+ Decidim::DecidimAwesome.configure do |config|
136
+ config.form_builder_langs_location = "/fb_locales/"
137
+ end
138
+ ```
139
+
140
+ ##### 11.1. GraphQL types for custom fields
141
+
142
+ #### 11.1. GraphQL types for custom fields
143
+
144
+ Custom fields are displayed in the GaphQL API according to their definition in a formatted array of objects in the attribute `bodyFields`.
145
+
146
+ A query to extract this information could look like this (see that the original `body` is also available):
147
+
148
+ ```graphql
149
+ {
150
+ component(id: 999) {
151
+ ... on Proposals {
152
+ proposals {
153
+ edges {
154
+ node {
155
+ id
156
+ bodyFields {
157
+ locales
158
+ translation(locale: "en")
159
+ translations {
160
+ locale
161
+ fields
162
+ machineTranslated
163
+ }
164
+ }
165
+ body {
166
+ locales
167
+ translations {
168
+ locale
169
+ text
170
+ machineTranslated
171
+ }
172
+ }
173
+ }
174
+ }
175
+ }
176
+ }
177
+ }
178
+ }
179
+ ```
180
+
181
+ You can then use this custom type in your GraphQL queries and mutations to handle the custom fields in proposals.
182
+
183
+
184
+ ##### 11.2. Private Custom fields
185
+
186
+ 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).
187
+ Data is stored encrypted in the database.
188
+
189
+ ![Private Custom fields screenshot](examples/private_custom_fields.png)
190
+
191
+ #### 12. Custom Redirections (or URL shortener feature)
127
192
 
128
193
  Admins can create custom paths that redirect to other places. Destinations can be internal absolute paths or external sites.
129
194
  There's also possible to choose to sanitize (ie: remove) any query string or to maintain it (so you can decide to use).
130
195
 
131
- For instance you can create a redirection like
196
+ For instance you can create a redirection like
132
197
 
133
198
  * `/take-me-somewhere` => `/processes/canary-islands`
134
199
 
@@ -138,67 +203,289 @@ Using a link with a query string (ie: `/take-me-somewhere?locale=es`) that will
138
203
  * `/processes/canary-islands?locale=es` if query string is not sanitized
139
204
 
140
205
  > Redirections work only after all other routes have been processed, you cannot override an existing route.
141
- > The admin panel comes with a button to check if the redirection works (meaning that no other route is used by te application).
206
+ > The admin panel comes with a button to check if the redirection works (meaning that no other route is used by the application).
142
207
  > Non-working routes will simply be ignored.
143
208
 
144
209
  ![Custom redirections screenshot](examples/custom-redirections.png)
145
210
 
146
- #### To be continued...
211
+ #### 13. Custom validation rules for title and body in proposals
147
212
 
148
- We're not done! Please check the [issues](/Platoniq/decidim-module-decidim_awesome/issues) (and participate) to see what's on our mind
213
+ Configure as you wish how the fields "title" and "body" are validated in proposals creation.
149
214
 
150
- Also feel free to propose something! or even better send a PR!
215
+ Rules available:
151
216
 
152
- ## Installation
217
+ * Minimum title and body length (defaults to 15 chars).
218
+ * Maximum percentage of capital letters for title and body (defaults to 25%).
219
+ * Maximum number of "marks" (aka: exclamation and interrogation signs) that can be consecutive in the title or the body (defaults to 1).
220
+ * Enable/disable forcing to start the title or the body with a capital letter (defaults to "enabled").
153
221
 
154
- Add this line to your application's Gemfile:
222
+ ![Custom validations](examples/custom_validations.png)
223
+
224
+ #### 14. Admin accountability
225
+
226
+ 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.
227
+
228
+ Results can be filtered by role and by time range and also exported as CSV or other formats.
229
+
230
+ ![Admin accountability](examples/admin_accountability.png)
231
+
232
+ #### 15. Additional proposal sortings
233
+
234
+ ![Proposal sorting](examples/proposal_sorting.png)
235
+ ![Proposal sorting admin](examples/proposal_sorting-admin.png)
236
+
237
+ This feature allows you to add additional sorting options to the proposals component. By default 4 additional sortings are included:
238
+
239
+ - `supported_first`: Sort proposals supported by me first.
240
+ - `supported_last`: Sort proposals supported by me last.
241
+ - `az`: Sort proposals alphabetically.
242
+ - `za`: Sort proposals alphabetically (reverse).
243
+
244
+ By enabling this feature the user choosed sorting method will be stored in the browser's session. This means that if the user changes the sorting method and then navigates to another page, the same sorting will be applied.
245
+
246
+ You can disable or configure the available sorting types by setting the variable `additional_proposal_sortings` configuration in an initializer:
155
247
 
156
248
  ```ruby
157
- gem "decidim-decidim_awesome"
249
+ # config/initializers/awesome_defaults.rb
250
+ Decidim::DecidimAwesome.configure do |config|
251
+ config.additional_proposal_sortings = :disabled
252
+ end
253
+
254
+ # Or, to disable alphabetical sorting:
255
+
256
+ Decidim::DecidimAwesome.configure do |config|
257
+ config.additional_proposal_sortings = [:supported_first, :supported_last]
258
+ end
158
259
  ```
159
260
 
160
- And then execute:
261
+ #### 16. Weighted voting
161
262
 
162
- ```bash
163
- bundle
164
- bundle exec rails decidim_decidim_awesome:install:migrations
165
- bundle exec rails decidim_decidim_awesome:webpacker:install
166
- bundle exec rails db:migrate
263
+ 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.
264
+
265
+ Weighted voting can have different presentations that can be registered in a manifest. Admins can then choose between what type of voting they want for their proposals according to the different manifests registered (classic is always available).
266
+
267
+ Some manifests are included by default in Decidim Awesome, if you consider to create (or pay) for a new one, please open a PR or contact us.
268
+
269
+ For instance, here is how the 3-flag voting system looks like:
270
+
271
+ ![Weighted voting](examples/weighted_voting.png)
272
+
273
+ ##### Creating a new manifest for weighted voting
274
+
275
+ A manifest is defined in a initializer in this way:
276
+
277
+ ```ruby
278
+ if Decidim::DecidimAwesome.enabled?(:weighted_proposal_voting)
279
+ # register available processors
280
+ Decidim::DecidimAwesome.voting_registry.register(:no_admins_vote) do |voting|
281
+ voting.show_vote_button_view = "decidim/decidim_awesome/voting/no_admins_vote/show_vote_button"
282
+ voting.show_votes_count_view = "decidim/decidim_awesome/voting/no_admins_vote/show_votes_count"
283
+ # voting.show_votes_count_view = "" # hide votes count if needed
284
+ voting.proposal_metadata_cell = "decidim/decidim_awesome/voting/proposal_metadata"
285
+ # define a weight validator (optional, by default all weights are valid)
286
+ voting.weight_validator do |weight, context|
287
+ # don't allow admins to vote
288
+ next if context[:user].admin?
289
+ # don't allow to vote official proposals
290
+ next if context[:proposal].official?
291
+
292
+ weight.in? [1, 2, 3, 5]
293
+ end
294
+
295
+ # optionally, define a label generator block
296
+ # by default labels are extracted from a I18n key following this rule
297
+ # "decidim.decidim_awesome.voting.{MANIFEST_NAME}.weights.weight_{WEIGHT}"
298
+ #
299
+ # voting.label_generator do |weight, context|
300
+ # "Weight #{weight.round}"
301
+ # end
302
+ end
303
+ end
167
304
  ```
168
305
 
169
- > NOTE: the `decidim_decidim_awesome:webpacker:install` is only necessary for Decidim versions starting at 0.25.
306
+ A manifest must define a vote button view for the main proposal view, a vote count view for the proposal list view, a footer for the proposal cell (used in lists) and a validator for the weight value.
307
+
308
+ All views are optional, if set to `nil` they will use the original ones. If set to an empty string `""` they will be hidden.
170
309
 
171
- 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:
310
+ 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.
172
311
 
173
- ![Check image migrations](examples/check_image_migrations.png)
312
+ **Notes for view `show_vote_button_view`**
174
313
 
175
- If you are a system admin, you can also perform this task by executing this rake task in the console:
314
+ 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:
176
315
 
316
+ - If there's a `current_user` logged in
317
+ - If votes are blocked `if current_settings.votes_blocked?`
318
+ - If the user has already voted `if @voted_proposals ? @voted_proposals.include?(proposal.id) : proposal.voted_by?(current_user)`
319
+ - If maximum votes have already reached `if proposal.maximum_votes_reached?`
320
+ - If the proposal can accumulate supports beyond maximum `if proposal.can_accumulate_votes_beyond_threshold`
321
+ - If the current component allows the user to participate `if current_component.participatory_space.can_participate?(current_user)`
322
+ - 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.
323
+
324
+ 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:
325
+
326
+ ```erb
327
+ <%= link_to "Vote with weight=3", proposal_proposal_vote_path(proposal_id: proposal, from_proposals_list: from_proposals_list, weight: 3), remote: true, method: :post %>
177
328
  ```
178
- RAILS_ENV=production bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave
329
+
330
+ To delete a vote, you just need to change the method to `:delete`
331
+
332
+ **Notes for view `show_votes_count_view`**
333
+
334
+ This view must implement the number of votes already cast. It requires an HTML tag with the id `proposal-<%= proposal.id %>-votes-count`, this is used by the Ajax vote re-loader feature: It will replace it's content with the new number.
335
+
336
+ 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).
337
+
338
+ **Notes for cell `voting.proposal_metadata_cell`**
339
+
340
+ 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**.
341
+
342
+ 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.
343
+
344
+ ##### 16.1 GraphQL Types for weighted voting
345
+
346
+ When a weighed voting mechanism is selected, the GraphQL API will show those weights separated in each proposal.
347
+ The attribute that holds this information is `vote_weights`, a query example could look like this:
348
+
349
+ ```graphql
350
+ {
351
+ component(id: 999) {
352
+ ... on Proposals {
353
+ proposals {
354
+ edges {
355
+ node {
356
+ id
357
+ voteWeights
358
+ }
359
+ }
360
+ }
361
+ }
362
+ }
363
+ }
179
364
  ```
180
365
 
181
- Or check your migration status with:
366
+ #### 17. Limiting amendments in proposals
367
+
368
+ By default, when proposals can be amended, any number of amendments can be created.
369
+
370
+ This feature allows admins to configure a specific Proposal's component to limit the number of evaluating amendments that can be created to one.
371
+ Note that this only applies to amendments being in the state "evaluating", not to accepted or rejected.
372
+
373
+ This option is disable by default, must be enabled in the component's configuration:
374
+
375
+ ![Limiting amendments](examples/limit_amendments.png)
376
+
377
+ #### 18. Maintenance tools
378
+
379
+ The awesome admin provides with some maintenance tools (more to come in the future);
380
+
381
+ ##### 18.1 Old private data removal
382
+
383
+ These tools are designed to help remove old data as required by laws such as GDPR, particularly in relation to private custom fields.
384
+ This menu will show if there's any data older than 6 months (configurable) and will let admins remove it component by component.
385
+
386
+ ![Private data](examples/private_data.png)
387
+
388
+ #### 19. User custom timezone
389
+
390
+ If your organization spans across multiple timezones, you can enable this feature under the "Surveys & Forms" section in the Awesome admin panel. This allows users to set their own timezone, which will be used to display dates and times throughout the platform according to their preference.
391
+
392
+ ![User time zone select](examples/user_timezone.png)
393
+
394
+ #### 20. Mandatory verifications
395
+
396
+ This feature allows admins to enforce mandatory verifications for users before they can access the platform. Admins can configure which verifications are required.
397
+
398
+ Admins can manage these settings in the Awesome admin panel under the "Verifications" section.
399
+
400
+ ![Forced verifications admin side](examples/forced_verifications_admin.png)
401
+ ![Forced verifications public side](examples/forced_verifications_public.png)
402
+
403
+ Note that some pages are allowed, you can even configure which controller are allowed by creating an initializer ("required_authorizations" and "authorizations" are always allowed):
404
+
405
+ ```ruby
406
+ # config/initializers/decidim_awesome.rb
407
+
408
+ Decidim::DecidimAwesome.configure do |config|
409
+ # default controllers are "account" and "pages"
410
+ config.force_authorization_allowed_controller_names = %w(account pages homepage)
182
411
  ```
183
- RAILS_ENV=production bin/rails decidim_awesome:active_storage_migrations:check_migration_from_carrierwave
412
+
413
+ #### 21. Manual verifications
414
+
415
+ The admin will be allowed to manually authorize users using the methods specified in the `/system` admin section.
416
+ Currently, only form based handlers are supported (Direct methods).
417
+ Admins can manually override or verify users in the participants list but they still have to fulfill the requirements of the verifier (although they will be allowed to force the authorization even if some of them fails).
418
+
419
+ Admin logs are also created in each action for accountability.
420
+
421
+ System configuration:
422
+
423
+ ![System manual authorization config](examples/manual_verifications_system.png)
424
+ ![List of authorizations](examples/manual_verifications_1.png)
425
+ ![Removing an authorization](examples/manual_verifications_2.png)
426
+ ![Creating an authorization](examples/manual_verifications_3.png)
427
+
428
+ #### To be continued...
429
+
430
+ We're not done! Please check the [issues](/decidim-ice/decidim-module-decidim_awesome/issues) (and participate) to see what's on our mind
431
+
432
+ Also feel free to propose something! or even better send a PR!
433
+
434
+ ## Installation
435
+
436
+ Add this line to your application's Gemfile:
437
+
438
+ ```ruby
439
+ gem "decidim-decidim_awesome"
184
440
  ```
185
441
 
442
+ And then execute:
443
+
444
+ ```bash
445
+ bundle
446
+ bin/rails decidim:upgrade
447
+ bin/rails db:migrate
448
+ ```
449
+
450
+ > In production mode you must also precompile the assets:
451
+ >
452
+ > ```
453
+ > bin/rails assets:precompile
454
+ > ```
455
+
456
+ Go to `yourdomain/admin/decidim_awesome` and start tweaking things!
457
+
458
+ > **EXPERTS ONLY**
459
+ >
460
+ > 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):
461
+ >
462
+ > ```bash
463
+ > bin/rails decidim_decidim_awesome:install:migrations
464
+ > bin/rails decidim_decidim_awesome:webpacker:install
465
+ > ```
186
466
 
187
467
  The correct version of Decidim Awesome should resolved automatically by the Bundler.
188
- However you can force some specific version using `gem "decidim-decidim_awesome", "~> 0.8.0"` in the Gemfile.
468
+ However you can force some specific version using `gem "decidim-decidim_awesome", "~> 0.12.0"` in the Gemfile.
189
469
 
190
470
  Depending on your Decidim version, choose the corresponding Awesome version to ensure compatibility:
191
471
 
192
472
  | Awesome version | Compatible Decidim versions |
193
473
  |---|---|
474
+ | 0.12.x | 0.29.x |
475
+ | 0.11.x | 0.28.x |
476
+ | 0.10.x | >= 0.26.7, >= 0.27.x |
477
+ | 0.9.2 | >= 0.26.7, >= 0.27.3 |
478
+ | 0.9.x | 0.26.x, 0.27.x |
194
479
  | 0.8.x | 0.25.x, 0.26.x |
195
480
  | 0.7.x | 0.23.x, 0.24.x |
196
481
  | 0.6.x | 0.22.x, 0.23.x |
197
482
  | 0.5.x | 0.21.x, 0.22.x |
198
483
 
199
- > *Heads up!*
484
+ > *Heads up!*
485
+ > * version 0.11.0 is only compatible with Decidim v0.28 as a major redesign makes backward compatibility impractical.
486
+ > * version 0.10.0 requires database migrations! Don't forget the migrations step when updating.
200
487
  > * 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.
201
- > * 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
488
+ > * 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
202
489
  `bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave`
203
490
  > * version 0.7.1 requires database migrations! Don't forget the migrations step when updating.
204
491
 
@@ -217,13 +504,10 @@ In order to personalize default values, create an initializer such as:
217
504
  # Change some variables defaults
218
505
  Decidim::DecidimAwesome.configure do |config|
219
506
  # Enabled by default to all scopes, admins can still limit it's scope
220
- config.allow_images_in_full_editor = true
507
+ config.allow_images_in_editors = true
221
508
 
222
509
  # Disabled by default to all scopes, admins can enable it and limit it's scope
223
- config.allow_images_in_small_editor = false
224
-
225
- # De-activated, admins don't even see it as an option
226
- config.use_markdown_editor = :disabled
510
+ config.allow_videos_in_editors = false
227
511
 
228
512
  # Disable scoped admins
229
513
  config.scoped_admins = :disabled
@@ -301,7 +585,6 @@ bundle exec rubocop
301
585
  To ease up following the style guide, you should install the plugin to your
302
586
  favorite editor, such as:
303
587
 
304
- - Atom - [linter-rubocop](https://atom.io/packages/linter-rubocop)
305
588
  - Sublime Text - [Sublime RuboCop](https://github.com/pderichs/sublime_rubocop)
306
589
  - Visual Studio Code - [Rubocop for Visual Studio Code](https://github.com/misogi/vscode-ruby-rubocop)
307
590
 
@@ -315,22 +598,36 @@ DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec rake test_
315
598
  DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec rspec
316
599
  ```
317
600
 
318
- However, this project also make use of the gem [Appraisals](https://github.com/thoughtbot/appraisal) in order to test against several versions of Decidim. The idea is to support same supported versions of Decidim.
601
+ > Note: the following is not currently applicable as from version v0.11 this plugin is compatible one version at the time.
602
+ > This is left here for future reference.
319
603
 
320
- You can run run all tests against all Decidim versions by using:
604
+ 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.
605
+
606
+ You can run run tests against the legacy Decidim versions by using:
321
607
 
322
608
  ```bash
323
- bundle exec appraisal install
324
- DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec appraisal rake test_app
325
- DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec appraisal rspec
609
+ export DATABASE_USERNAME=<username>
610
+ export DATABASE_PASSWORD=<password>
611
+ RBENV_VERSION=3.2.2 BUNDLE_GEMFILE=Gemfile.legacy bundle
612
+ RBENV_VERSION=3.2.2 BUNDLE_GEMFILE=Gemfile.legacy bundle exec rake test_app
613
+ RBENV_VERSION=3.2.2 BUNDLE_GEMFILE=Gemfile.legacy bundle exec rspec
326
614
  ```
327
615
 
328
- To test a specific apprasail configured version do the following:
616
+ For convenience, you can use the scripts `bin/test` and `bin/test-legacy` to run tests against one or the other version:
329
617
 
618
+ ```bash
619
+ bin/test spec/
620
+ bin/test-legacy spec/
330
621
  ```
331
- DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec appraisal decidim-0.25 rake test_app
332
- DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec appraisal decidim-0.25 rspec
333
- ```
622
+
623
+ - Rbenv is required for this script to work.
624
+
625
+ > **NOTE:** Remember to reset the database when changing between tests:
626
+ > ```bash
627
+ > bin/test --reset
628
+ > bin/test-legacy --reset
629
+ > ```
630
+
334
631
 
335
632
  Note that the database user has to have rights to create and drop a database in
336
633
  order to create the dummy test app database.
@@ -343,35 +640,13 @@ commands shown above.
343
640
 
344
641
  ### Test code coverage
345
642
 
346
- If you want to generate the code coverage report for the tests, you can use
347
- the `SIMPLECOV=1` environment variable in the rspec command as follows:
348
-
349
- ```bash
350
- SIMPLECOV=1 bundle exec rspec
351
- ```
352
-
353
- This will generate a folder named `coverage` in the project root which contains
643
+ Code coverage report is generated automatically in a folder named `coverage` in the project root which contains
354
644
  the code coverage report.
355
645
 
356
- ### Appraisals commands
357
-
358
- The [Appraisals](Appraisals) file contains the supported versions. In i each version defines the changes respect to the main `Gemfile`.
359
-
360
- Appraisal uses custom gems for testing in the folder `gemfiles`, these gemfiles are generated from the file `Appraisals`. To update definitions do:
361
-
362
- ```
363
- bundle exec appraisal install
364
- ```
365
-
366
- The former command will take care of updating all configured version. To update the Appraisal definitions manually (not usually necessary) do the following:
367
-
368
- ```
369
- cd gemfiles
370
- BUNDLE_GEMFILE=./decidim_0.XX.gemfile bundle update
646
+ ```bash
647
+ firefox coverage/index.html
371
648
  ```
372
649
 
373
- Where 0.XX is the supported version that needs to be updated.
374
-
375
650
  ### Localization
376
651
 
377
652
  If you would like to see this module in your own language, you can help with its
@@ -385,4 +660,4 @@ This engine is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
385
660
 
386
661
  ## Credits
387
662
 
388
- This plugin has been developed by ![Platoniq](app/packs/images/decidim/decidim_awesome/platoniq-logo.png)
663
+ This plugin maintainted by [![PokeCode](app/packs/images/decidim/decidim_awesome/pokecode-logo.png) PokeCode](https://pokecode.net/)