decidim-decidim_awesome 0.6.7 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +181 -0
  3. data/README.md +88 -36
  4. data/Rakefile +11 -12
  5. data/app/cells/decidim/decidim_awesome/content_blocks/map/error.erb +11 -0
  6. data/app/cells/decidim/decidim_awesome/content_blocks/map/show.erb +14 -0
  7. data/app/cells/decidim/decidim_awesome/content_blocks/map_cell.rb +65 -0
  8. data/app/cells/decidim/decidim_awesome/content_blocks/map_form/show.erb +65 -0
  9. data/app/cells/decidim/decidim_awesome/content_blocks/map_form_cell.rb +19 -0
  10. data/app/commands/concerns/decidim/decidim_awesome/admin/needs_constraint_helpers.rb +32 -0
  11. data/app/commands/decidim/decidim_awesome/admin/create_custom_redirect.rb +51 -0
  12. data/app/commands/decidim/decidim_awesome/admin/create_proposal_custom_field.rb +45 -0
  13. data/app/commands/decidim/decidim_awesome/admin/create_scoped_admin.rb +38 -0
  14. data/app/commands/decidim/decidim_awesome/admin/destroy_constraint.rb +4 -0
  15. data/app/commands/decidim/decidim_awesome/admin/destroy_custom_redirect.rb +47 -0
  16. data/app/commands/decidim/decidim_awesome/admin/destroy_proposal_custom_field.rb +40 -0
  17. data/app/commands/decidim/decidim_awesome/admin/destroy_scoped_admin.rb +40 -0
  18. data/app/commands/decidim/decidim_awesome/admin/destroy_scoped_style.rb +1 -1
  19. data/app/commands/decidim/decidim_awesome/admin/rename_scope_label.rb +58 -0
  20. data/app/commands/decidim/decidim_awesome/admin/update_config.rb +1 -0
  21. data/app/commands/decidim/decidim_awesome/admin/update_custom_redirect.rb +49 -0
  22. data/app/commands/decidim/decidim_awesome/create_editor_image.rb +12 -5
  23. data/app/controllers/concerns/decidim/decidim_awesome/not_found_redirect.rb +58 -0
  24. data/app/controllers/decidim/decidim_awesome/admin/checks_controller.rb +15 -22
  25. data/app/controllers/decidim/decidim_awesome/admin/config_controller.rb +39 -18
  26. data/app/controllers/decidim/decidim_awesome/admin/constraints_controller.rb +4 -0
  27. data/app/controllers/decidim/decidim_awesome/admin/custom_redirects_controller.rb +91 -0
  28. data/app/controllers/decidim/decidim_awesome/admin/menu_hacks_controller.rb +7 -10
  29. data/app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb +38 -0
  30. data/app/controllers/decidim/decidim_awesome/admin/scoped_admins_controller.rb +38 -0
  31. data/app/controllers/decidim/decidim_awesome/admin/scoped_styles_controller.rb +38 -0
  32. data/app/controllers/decidim/decidim_awesome/blank_component_controller.rb +19 -0
  33. data/app/controllers/decidim/decidim_awesome/editor_images_controller.rb +2 -3
  34. data/app/controllers/decidim/decidim_awesome/iframe_component/iframe_controller.rb +1 -1
  35. data/app/controllers/decidim/decidim_awesome/map_component/map_controller.rb +2 -9
  36. data/app/forms/decidim/decidim_awesome/admin/config_form.rb +41 -0
  37. data/app/forms/decidim/decidim_awesome/admin/constraint_form.rb +3 -1
  38. data/app/forms/decidim/decidim_awesome/admin/custom_redirect_form.rb +45 -0
  39. data/app/forms/decidim/decidim_awesome/editor_image_form.rb +3 -2
  40. data/app/forms/decidim/decidim_awesome/proposals/proposal_wizard_create_step_form_override.rb +38 -0
  41. data/app/helpers/decidim/decidim_awesome/admin/config_constraints_helpers.rb +32 -15
  42. data/app/helpers/decidim/decidim_awesome/admin/system_checker_helpers.rb +36 -0
  43. data/app/helpers/decidim/decidim_awesome/amendments_helper_override.rb +48 -0
  44. data/app/helpers/decidim/decidim_awesome/map_helper.rb +76 -63
  45. data/app/helpers/decidim/decidim_awesome/proposals/application_helper_override.rb +78 -0
  46. data/app/jobs/decidim/decidim_awesome/migrate_legacy_images_job.rb +106 -0
  47. data/app/middleware/decidim/decidim_awesome/current_config.rb +182 -0
  48. data/app/models/decidim/decidim_awesome/awesome_config.rb +15 -0
  49. data/app/models/decidim/decidim_awesome/editor_image.rb +4 -9
  50. data/app/models/decidim/decidim_awesome/user_override.rb +25 -0
  51. data/app/packs/entrypoints/decidim_admin_decidim_awesome.js +5 -0
  52. data/app/packs/entrypoints/decidim_admin_decidim_awesome.scss +1 -0
  53. data/app/packs/entrypoints/decidim_admin_decidim_awesome_custom_fields.js +2 -0
  54. data/app/packs/entrypoints/decidim_decidim_awesome.js +9 -0
  55. data/app/packs/entrypoints/decidim_decidim_awesome.scss +1 -0
  56. data/app/packs/entrypoints/decidim_decidim_awesome_admin_form_exit_warn.js +1 -0
  57. data/app/packs/entrypoints/decidim_decidim_awesome_custom_fields.js +1 -0
  58. data/app/packs/entrypoints/decidim_decidim_awesome_iframe.scss +1 -0
  59. data/app/packs/entrypoints/decidim_decidim_awesome_map.js +5 -0
  60. data/app/packs/entrypoints/decidim_decidim_awesome_map.scss +1 -0
  61. data/app/{assets → packs}/images/decidim/decidim_awesome/platoniq-logo.png +0 -0
  62. data/app/packs/src/decidim/decidim_awesome/admin/auto_edit.js +82 -0
  63. data/app/packs/src/decidim/decidim_awesome/admin/check_redirections.js +48 -0
  64. data/app/packs/src/decidim/decidim_awesome/admin/codemirror.js +14 -0
  65. data/app/packs/src/decidim/decidim_awesome/admin/constraints.js +55 -0
  66. data/app/packs/src/decidim/decidim_awesome/admin/custom_fields_builder.js +77 -0
  67. data/app/{assets/javascripts/decidim/decidim_awesome/admin/form_exit_warn.js.es6 → packs/src/decidim/decidim_awesome/admin/form_exit_warn.js} +0 -2
  68. data/app/packs/src/decidim/decidim_awesome/admin/user_picker.js +24 -0
  69. data/app/packs/src/decidim/decidim_awesome/awesome_admin.js +23 -0
  70. data/app/packs/src/decidim/decidim_awesome/awesome_application.js +17 -0
  71. data/app/{assets/javascripts/decidim/decidim_awesome/awesome_map/api_fetcher.js.es6 → packs/src/decidim/decidim_awesome/awesome_map/api/api_fetcher.js} +1 -15
  72. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/fetcher.js +131 -0
  73. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/meetings_fetcher.js +59 -0
  74. data/app/packs/src/decidim/decidim_awesome/awesome_map/api/proposals_fetcher.js +52 -0
  75. data/app/packs/src/decidim/decidim_awesome/awesome_map/awesome_map.js +130 -0
  76. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/controller.js +112 -0
  77. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/meetings_controller.js +31 -0
  78. data/app/packs/src/decidim/decidim_awesome/awesome_map/controllers/proposals_controller.js +88 -0
  79. data/app/packs/src/decidim/decidim_awesome/awesome_map/controls_ui.js +221 -0
  80. data/app/packs/src/decidim/decidim_awesome/awesome_map/load_map.js +51 -0
  81. data/app/packs/src/decidim/decidim_awesome/editors/editor.js +190 -0
  82. data/app/packs/src/decidim/decidim_awesome/editors/tabs_focus.js +22 -0
  83. data/app/{assets/javascripts/decidim/decidim_awesome/forms/autosave.js.es6 → packs/src/decidim/decidim_awesome/forms/autosave.js} +20 -17
  84. data/app/packs/src/decidim/decidim_awesome/forms/custom_fields_renderer.js +207 -0
  85. data/app/packs/src/decidim/decidim_awesome/forms/rich_text_plugin.js +107 -0
  86. data/app/packs/src/decidim/decidim_awesome/proposals/custom_fields.js +22 -0
  87. data/app/packs/src/decidim/decidim_awesome/proposals/images.js +25 -0
  88. data/{vendor/assets/javascripts → app/packs/src/vendor}/image-resize.min.js +0 -0
  89. data/{vendor/assets/javascripts → app/packs/src/vendor}/image-upload.min.js +0 -0
  90. data/{vendor/assets/javascripts → app/packs/src/vendor}/jquery.truncate.js +0 -0
  91. data/app/packs/src/vendor/leaflet.featuregroup.subgroup.js +184 -0
  92. data/app/packs/stylesheets/decidim/decidim_awesome/admin/auto_edits.scss +16 -0
  93. data/app/packs/stylesheets/decidim/decidim_awesome/admin/check_redirections.scss +28 -0
  94. data/app/packs/stylesheets/decidim/decidim_awesome/admin/codemirror.scss +29 -0
  95. data/app/{assets → packs}/stylesheets/decidim/decidim_awesome/admin/constraints.scss +21 -9
  96. data/app/packs/stylesheets/decidim/decidim_awesome/admin/custom_fields.scss +93 -0
  97. data/app/packs/stylesheets/decidim/decidim_awesome/admin/user_picker.scss +41 -0
  98. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_admin.scss +71 -0
  99. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_application.scss +19 -0
  100. data/app/{assets → packs}/stylesheets/decidim/decidim_awesome/awesome_iframe/iframe.scss +3 -3
  101. data/app/packs/stylesheets/decidim/decidim_awesome/awesome_map/map.scss +176 -0
  102. data/app/{assets → packs}/stylesheets/decidim/decidim_awesome/editors/markdown_editor.scss +6 -4
  103. data/app/packs/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss +58 -0
  104. data/app/{assets → packs}/stylesheets/decidim/decidim_awesome/forms/autosave.scss +2 -2
  105. data/app/packs/stylesheets/vendor/select2-foundation-theme.scss +348 -0
  106. data/app/permissions/decidim/decidim_awesome/admin/permissions.rb +2 -0
  107. data/app/presenters/decidim/decidim_awesome/menu_item_presenter_override.rb +25 -0
  108. data/app/presenters/decidim/decidim_awesome/menu_presenter_override.rb +23 -0
  109. data/app/uploaders/decidim/cw/decidim_awesome/image_uploader.rb +26 -0
  110. data/app/uploaders/decidim/decidim_awesome/image_uploader.rb +4 -21
  111. data/app/views/decidim/decidim_awesome/admin/checks/index.html.erb +28 -22
  112. data/app/views/decidim/decidim_awesome/admin/config/_autoedit_box_label.html.erb +7 -0
  113. data/app/views/decidim/decidim_awesome/admin/config/_constraints.html.erb +3 -3
  114. data/app/views/decidim/decidim_awesome/admin/config/_form_admins.html.erb +21 -0
  115. data/app/views/decidim/decidim_awesome/admin/config/_form_editors.html.erb +1 -3
  116. data/app/views/decidim/decidim_awesome/admin/config/_form_proposal_custom_fields.html.erb +25 -0
  117. data/app/views/decidim/decidim_awesome/admin/config/_form_proposals.html.erb +0 -2
  118. data/app/views/decidim/decidim_awesome/admin/config/_form_styles.html.erb +11 -13
  119. data/app/views/decidim/decidim_awesome/admin/config/_modal.html.erb +1 -1
  120. data/app/views/decidim/decidim_awesome/admin/config/show.html.erb +3 -3
  121. data/app/views/decidim/decidim_awesome/admin/constraints/new.html.erb +1 -1
  122. data/app/views/decidim/decidim_awesome/admin/custom_redirects/_form.html.erb +6 -0
  123. data/app/views/decidim/decidim_awesome/admin/custom_redirects/edit.html.erb +13 -0
  124. data/app/views/decidim/decidim_awesome/admin/custom_redirects/index.html.erb +37 -0
  125. data/app/views/decidim/decidim_awesome/admin/custom_redirects/new.html.erb +13 -0
  126. data/app/views/decidim/decidim_awesome/admin/menu_hacks/edit.html.erb +1 -1
  127. data/app/views/decidim/decidim_awesome/admin/menu_hacks/new.html.erb +1 -1
  128. data/app/views/decidim/decidim_awesome/admin/proposals/_editor.html.erb +6 -0
  129. data/app/views/decidim/decidim_awesome/custom_fields/_form_render.html.erb +6 -0
  130. data/app/views/decidim/decidim_awesome/iframe_component/iframe/show.html.erb +1 -1
  131. data/app/views/decidim/decidim_awesome/map_component/map/_api_ready.html.erb +3 -0
  132. data/app/views/decidim/decidim_awesome/map_component/map/_map_template.html.erb +68 -0
  133. data/app/views/decidim/decidim_awesome/map_component/map/{error.erb → error.html.erb} +2 -0
  134. data/app/views/decidim/decidim_awesome/map_component/map/show.html.erb +3 -99
  135. data/app/views/decidim/proposals/admin/proposals/_form.html.erb +101 -0
  136. data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +83 -0
  137. data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +1 -0
  138. data/app/views/layouts/decidim/admin/decidim_awesome.html.erb +34 -16
  139. data/app/views/layouts/decidim/decidim_awesome/_awesome_config.html.erb +2 -0
  140. data/app/views/layouts/decidim/decidim_awesome/_custom_styles.html.erb +1 -1
  141. data/app/views/v0.25/decidim/proposals/collaborative_drafts/_show.html.erb +128 -0
  142. data/app/views/{v0.23 → v0.25}/layouts/decidim/_head.html.erb +12 -10
  143. data/app/views/v0.25/layouts/decidim/admin/_header.html.erb +11 -0
  144. data/app/views/v0.26/decidim/proposals/collaborative_drafts/_show.html.erb +128 -0
  145. data/app/views/{v0.22 → v0.26}/layouts/decidim/_head.html.erb +18 -10
  146. data/app/views/v0.26/layouts/decidim/admin/_header.html.erb +11 -0
  147. data/config/assets.rb +46 -0
  148. data/config/i18n-tasks.yml +6 -0
  149. data/config/locales/ca.yml +135 -14
  150. data/config/locales/cs.yml +124 -3
  151. data/config/locales/en.yml +156 -11
  152. data/config/locales/es.yml +123 -2
  153. data/config/locales/eu.yml +1 -174
  154. data/config/locales/fr.yml +136 -15
  155. data/config/locales/it.yml +346 -0
  156. data/config/locales/ja.yml +345 -0
  157. data/config/locales/nl.yml +23 -5
  158. data/config/locales/pt-BR.yml +346 -0
  159. data/config/locales/pt-PT.yml +7 -0
  160. data/config/locales/pt.yml +7 -0
  161. data/config/locales/sv.yml +75 -131
  162. data/db/migrate/20210628150825_change_awesome_config_var_type.rb +12 -0
  163. data/lib/decidim/decidim_awesome/admin_engine.rb +19 -12
  164. data/lib/decidim/decidim_awesome/awesome.rb +214 -0
  165. data/lib/decidim/decidim_awesome/awesome_helpers.rb +17 -17
  166. data/lib/decidim/decidim_awesome/checksums.yml +23 -16
  167. data/lib/decidim/decidim_awesome/config.rb +55 -9
  168. data/lib/decidim/decidim_awesome/content_parsers/editor_images_parser.rb +39 -0
  169. data/lib/decidim/decidim_awesome/context_analyzers/request_analyzer.rb +27 -21
  170. data/lib/decidim/decidim_awesome/custom_fields.rb +94 -0
  171. data/lib/decidim/decidim_awesome/engine.rb +42 -14
  172. data/lib/decidim/decidim_awesome/iframe_component/admin_engine.rb +23 -0
  173. data/lib/decidim/decidim_awesome/iframe_component/component.rb +6 -6
  174. data/lib/decidim/decidim_awesome/map_component/admin_engine.rb +23 -0
  175. data/lib/decidim/decidim_awesome/map_component/component.rb +6 -5
  176. data/lib/decidim/decidim_awesome/map_component/engine.rb +34 -0
  177. data/lib/decidim/decidim_awesome/menu_hacker.rb +2 -1
  178. data/lib/decidim/decidim_awesome/system_checker.rb +1 -1
  179. data/lib/decidim/decidim_awesome/test/factories.rb +2 -2
  180. data/lib/decidim/decidim_awesome/test/initializer.rb +25 -0
  181. data/lib/decidim/decidim_awesome/test/layouts/decidim/_head.html.erb +30 -2
  182. data/lib/decidim/decidim_awesome/test/layouts/decidim/admin/_header.html.erb +7 -2
  183. data/lib/decidim/decidim_awesome/test/shared_examples/box_label_editor.rb +116 -0
  184. data/lib/decidim/decidim_awesome/test/shared_examples/config_examples.rb +18 -0
  185. data/lib/decidim/decidim_awesome/test/shared_examples/controller_examples.rb +13 -0
  186. data/lib/decidim/decidim_awesome/test/shared_examples/current_config_examples.rb +143 -0
  187. data/lib/decidim/decidim_awesome/test/shared_examples/custom_redirects_contexts.rb +47 -0
  188. data/lib/decidim/decidim_awesome/test/shared_examples/editor_examples.rb +4 -0
  189. data/lib/decidim/decidim_awesome/test/shared_examples/menu_hack_contexts.rb +0 -17
  190. data/lib/decidim/decidim_awesome/test/shared_examples/scoped_admins_examples.rb +420 -0
  191. data/lib/decidim/decidim_awesome/test/shared_examples/summary_examples.rb +202 -0
  192. data/lib/decidim/decidim_awesome/version.rb +2 -2
  193. data/lib/decidim/decidim_awesome.rb +4 -119
  194. data/lib/tasks/decidim_awesome_active_storage_migrations_tasks.rake +37 -0
  195. data/lib/tasks/decidim_awesome_webpacker_tasks.rake +64 -0
  196. data/package.json +211 -0
  197. metadata +149 -107
  198. data/app/assets/config/decidim_admin_decidim_awesome_manifest.css +0 -3
  199. data/app/assets/config/decidim_admin_decidim_awesome_manifest.js +0 -2
  200. data/app/assets/config/decidim_decidim_awesome_manifest.css +0 -5
  201. data/app/assets/config/decidim_decidim_awesome_manifest.js +0 -3
  202. data/app/assets/images/decidim/decidim_awesome/loading.gif +0 -0
  203. data/app/assets/javascripts/decidim/decidim_awesome/admin/codemirror.js.es6 +0 -15
  204. data/app/assets/javascripts/decidim/decidim_awesome/admin/constraints.js.es6 +0 -54
  205. data/app/assets/javascripts/decidim/decidim_awesome/admin.js +0 -3
  206. data/app/assets/javascripts/decidim/decidim_awesome/application.js +0 -4
  207. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/categories.js.es6 +0 -25
  208. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/hashtags.js.es6 +0 -48
  209. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/layers.js.es6 +0 -106
  210. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/legacy_map.js.es6 +0 -218
  211. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/legacy_proposals.js.es6 +0 -83
  212. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/map.js.es6 +0 -211
  213. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/markers.js.es6 +0 -56
  214. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/meetings.js.es6 +0 -132
  215. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/proposals.js.es6 +0 -107
  216. data/app/assets/javascripts/decidim/decidim_awesome/awesome_map/utilities.js.es6 +0 -48
  217. data/app/assets/javascripts/decidim/decidim_awesome/editors/markdown_view.js.es6 +0 -12
  218. data/app/assets/javascripts/decidim/decidim_awesome/editors/quill_editor.js.es6 +0 -160
  219. data/app/assets/javascripts/decidim/decidim_awesome/proposals/images.js.es6 +0 -25
  220. data/app/assets/stylesheets/decidim/decidim_awesome/admin/codemirror.scss +0 -16
  221. data/app/assets/stylesheets/decidim/decidim_awesome/admin.scss +0 -52
  222. data/app/assets/stylesheets/decidim/decidim_awesome/application.scss +0 -8
  223. data/app/assets/stylesheets/decidim/decidim_awesome/awesome_map/leaflet.scss.erb +0 -18
  224. data/app/assets/stylesheets/decidim/decidim_awesome/awesome_map/map.scss +0 -161
  225. data/app/assets/stylesheets/decidim/decidim_awesome/editors/markdown_view.scss +0 -27
  226. data/app/assets/stylesheets/decidim/decidim_awesome/editors/quill_editor.scss +0 -7
  227. data/app/awesome_overrides/presenters/decidim/menu_presenter_override.rb +0 -39
  228. data/app/awesome_overrides/presenters/decidim/proposals/proposal_presenter_override.rb +0 -64
  229. data/app/controllers/decidim/decidim_awesome/iframe_component/application_controller.rb +0 -15
  230. data/app/controllers/decidim/decidim_awesome/map_component/application_controller.rb +0 -15
  231. data/app/views/v0.22/layouts/decidim/admin/_header.html.erb +0 -11
  232. data/app/views/v0.23/layouts/decidim/admin/_header.html.erb +0 -12
  233. data/lib/decidim/decidim_awesome/content_renderers/markdown_renderer.rb +0 -18
  234. data/lib/decidim/decidim_awesome/content_renderers.rb +0 -9
  235. data/lib/decidim/decidim_awesome/test/themes/css.lvh.me.css +0 -3
  236. data/lib/decidim/decidim_awesome/test/themes/erb.lvh.me.scss.erb +0 -2
  237. data/lib/decidim/decidim_awesome/test/themes/scss.lvh.me.scss +0 -1
  238. data/lib/decidim/decidim_awesome/test/themes/test-theme/body.scss +0 -4
  239. data/vendor/assets/images/layers-2x.png +0 -0
  240. data/vendor/assets/images/layers.png +0 -0
  241. data/vendor/assets/images/marker-icon.png +0 -0
  242. data/vendor/assets/javascripts/codemirror-4.inline-attachment.js +0 -89
  243. data/vendor/assets/javascripts/codemirror.js +0 -9801
  244. data/vendor/assets/javascripts/form-storage.js +0 -824
  245. data/vendor/assets/javascripts/highlight.min.js +0 -44
  246. data/vendor/assets/javascripts/inline-attachment.js +0 -399
  247. data/vendor/assets/javascripts/inscrybmde.min.js +0 -7
  248. data/vendor/assets/javascripts/jquery.inline-attachment.js +0 -66
  249. data/vendor/assets/javascripts/jsrender.min.js +0 -4
  250. data/vendor/assets/javascripts/keymap/sublime.js +0 -720
  251. data/vendor/assets/javascripts/leaflet.featuregroup.subgroup.js +0 -6
  252. data/vendor/assets/javascripts/mode/css/css.js +0 -864
  253. data/vendor/assets/stylesheets/codemirror.css +0 -350
  254. data/vendor/assets/stylesheets/default.min.css +0 -1
  255. data/vendor/assets/stylesheets/foundation.min.css +0 -1
  256. data/vendor/assets/stylesheets/github.min.css +0 -2
  257. data/vendor/assets/stylesheets/inscrybmde.min.scss +0 -180
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 32cc1fc0147bd8a5daf75a5deab25f18ede902f0ceb8c9a4a0073528dec97568
4
- data.tar.gz: 2ed32bdc25c0e2ab7b5b8b7362adad7a191634290b896e6f3e0f630687ba0824
3
+ metadata.gz: a04e8fa0ca3025c7bdd3f21508e1bcf3046546483782fd0f9348f804e6f6b137
4
+ data.tar.gz: 400190dfe91cf0bd6e06ec4c58594c11981191a7b8b63d83b6f9e0aee220d61c
5
5
  SHA512:
6
- metadata.gz: df2b4b28994f8ad2f11e87080c683edb9fc8f215c76a7b6e15ebd27df018317fb64daf5f1c9b3910d2bd6c676d746caadec6defdaeb57716509cb9b3b33b67d8
7
- data.tar.gz: 95a51e3cf9e87c8b2c9756ad6ab11ab1ee90d252b16f99740a20e190742bb0017e88bb36357ac2031d588bcf792b86d1337fe0685c7dfb309789beb4a7aa6797
6
+ metadata.gz: 0e06d6ae9a8698e51dfc11d16349e4c6906c9a8037d6bb53cbf700ed7b39c7550e6ad0c923f9675fd3f2bd28729e22e24dcdcb085a1f168511e41be0f88fee56
7
+ data.tar.gz: 769c204652bf08908913b06f834e4eef814b08b07e7c7869f7ea2a2d4741a57a6e86fb8bbf355b2066ecbba32bb7dbda57e57ae614b58b56413ccff95bab778b
data/CHANGELOG.md ADDED
@@ -0,0 +1,181 @@
1
+ CHANGELOG
2
+ =========
3
+
4
+ v0.8.0
5
+ ------
6
+
7
+ Compatibility:
8
+ - Decidim v0.26.x
9
+ - Decidim v0.25.x
10
+
11
+ Features:
12
+ - Several bug fixing related to deactivating features (now there's a test for it).
13
+ - Now awesome components can be disabled using the `disabled_components` configuration var.
14
+ - Feature: Custom redirections editor: Create shorter URL redirections to other places, inside or outside Decidim.
15
+ - Update to webpacker compatiblity and Decidim 0.25
16
+ - Added tasks `bin/rails decidim_awesome:active_storage_migrations:check_migration_from_carrierwave` and `bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave` (also accessible as a backgroundjob from the awesome admin checks)
17
+ - REMOVED: SCSS themes are not available anymore (the alternative is to use custom styles). This is mostly because of webpacker.
18
+
19
+ v0.7.2
20
+ ------
21
+
22
+ Compatibility:
23
+ - Decidim v0.24.x
24
+ - Decidim v0.23.x
25
+
26
+ Features:
27
+ - Added custom fields (with admin interface and scopable) to replace normal body in proposals.
28
+ - Change Markdown editor behaviour: now it is converted to HTML before storing in the database. This makes the editor compatible with all Rich Text editors.
29
+ - Added icons in the awesome config menu
30
+ - Fixes scoped admins accessing process groups
31
+
32
+ v0.7.1
33
+ ------
34
+
35
+ Compatibility:
36
+ - Decidim v0.24.x
37
+ - Decidim v0.23.x
38
+
39
+ Features:
40
+ - Fix CSS custom styles when using html characters
41
+ - Add Awesome Map content block for the homepage
42
+ - Added processes groups constraint for different scoped tweaks
43
+ - Added "Never" constraint to deactivated scoped tweaks temporarily
44
+ - Change Markdown editor behaviour: now it is converted to HTML before storing in the database. This makes the editor compatible with all Rich Text editors. This also takes this feature out the the "experimental" zone as the resulting edited text is fully compatible with standard Decidim.
45
+ - Added scoped admins feature: Any user can be turned into a limited admin and scoped to one or more participatory spaces.
46
+ - Fix allowing access to participatory space admins (only full admins can access the module).
47
+ - Added `participatory_spaces_routes_context` config variable to specify additional routes correspondences to participatory spaces.
48
+
49
+ v0.7.0
50
+ ------
51
+
52
+ Compatibility:
53
+ - Decidim v0.24
54
+ - Decidim v0.23.x
55
+ - Decidim v0.23
56
+
57
+ v0.6.7
58
+ ------
59
+
60
+ Compatibility:
61
+ - Decidim v0.23.x
62
+ - Decidim v0.23
63
+ - Decidim v0.22
64
+
65
+ Features:
66
+ - Feature: Truncate description in map popups to configurable character limit
67
+ - Add CSS validation and syntax highlighting in CSS boxes editors
68
+ - Fix: filter awesome map by hash takes into account the status of categories
69
+
70
+ v0.6.6
71
+ ------
72
+
73
+ Compatibility:
74
+ - Decidim v0.23.3
75
+ - Decidim v0.23.2
76
+ - Decidim v0.23.1
77
+ - Decidim v0.23
78
+ - Decidim v0.22
79
+
80
+ Features:
81
+ - Fix: Prevents overrides for menus not specified in awesome config
82
+ - Fix: Respect original @if condition for menu presenter for native menus
83
+
84
+ v0.6.5
85
+ ------
86
+
87
+ Compatibility:
88
+ - Decidim v0.23.3
89
+ - Decidim v0.23.2
90
+ - Decidim v0.23.1
91
+ - Decidim v0.23
92
+ - Decidim v0.22
93
+
94
+ Features:
95
+ - Allow admins to modify the main Decidim menu
96
+
97
+ v0.6.4
98
+ ------
99
+
100
+ Compatibility:
101
+ - Decidim v0.23.3
102
+ - Decidim v0.23.2
103
+ - Decidim v0.23.1
104
+ - Decidim v0.23
105
+ - Decidim v0.22
106
+
107
+ Features:
108
+ - Fixes a 500 error when custom styles is empty
109
+ - Fixes removal of existing css boxes when other configuration are changed
110
+
111
+ v0.6.3
112
+ ------
113
+
114
+ Compatibility:
115
+ - Decidim v0.23.3
116
+ - Decidim v0.23.2
117
+ - Decidim v0.23.1
118
+ - Decidim v0.23
119
+ - Decidim v0.22
120
+
121
+ Features:
122
+ - Adds custom scoped styles
123
+
124
+ v0.6.2
125
+ ------
126
+
127
+ Compatibility:
128
+ - Decidim release/0.23-stable
129
+ - Decidim v0.23.1
130
+ - Decidim v0.23
131
+ - Decidim v0.22
132
+
133
+ Features:
134
+ - Fixes compatibility with proposals in branch `release/0.23-stable`
135
+
136
+ v0.6.1
137
+ ------
138
+
139
+ Compatibility:
140
+ - Decidim v0.23
141
+ - Decidim v0.22
142
+
143
+ Features:
144
+ - Improve awesome map categories visualization
145
+ - Fix image uploader
146
+ - Adds announcements for full screen iframes
147
+
148
+ v0.6
149
+ ----
150
+
151
+ Compatibility:
152
+ - Decidim v0.23
153
+ - Decidim v0.22
154
+
155
+ Features:
156
+ - Full screen iframe component
157
+ - live support chat linked with Telegram
158
+
159
+ v0.4, 0.5
160
+ ----
161
+
162
+ Compatibility:
163
+ - Decidim v0.22
164
+ - Decidim v0.21
165
+
166
+ Features:
167
+ - Decidim CSS themes for tenants
168
+
169
+ v0.3
170
+ ----
171
+
172
+ Compatibility:
173
+ - Decidim v0.21
174
+ - Decidim v0.20
175
+
176
+ Features:
177
+ - Awesome map
178
+ - Images in rich text editors
179
+ - Images in textarea editors
180
+ - Autosave forms
181
+ - Scoped constraints for each feature
data/README.md CHANGED
@@ -1,15 +1,15 @@
1
1
  # Decidim::DecidimAwesome
2
2
 
3
- [![Build](https://github.com/Platoniq/decidim-module-decidim_awesome/workflows/Build/badge.svg)](https://github.com/Platoniq/decidim-module-decidim_awesome/actions)
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
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)](undefined)
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)
6
6
 
7
7
  Usability and UX tweaks for Decidim.
8
8
 
9
9
  This plugin allows the administrators to expand the possibilities of Decidim beyond some existing limitations.
10
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
11
 
12
- **This in beta status, we do not accept any responsibility for breaking anything. Feedback is appreciated though.**
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
13
 
14
14
  ## Why this plugin?
15
15
 
@@ -24,6 +24,8 @@ Because Decidim is awesome and so is this!
24
24
 
25
25
  Read the [CHANGELOG](CHANGELOG.md) for Decidim compatibility.
26
26
 
27
+ > **TL;DR people**: Jump to the [installation part](#installation)
28
+
27
29
  DecidimAwesome is a module that hacks Decidim in order to provide more features or improve some aspects of it.
28
30
 
29
31
  It generates and admin module that allows to choose what hacks to apply.
@@ -75,44 +77,25 @@ It also provides a simple search by category, each category is assigned to a dif
75
77
 
76
78
  ![Awesome map](examples/awesome-map.png)
77
79
 
78
- #### 7. Allow Decidim to use custom CSS themes for every tenant
79
-
80
- When customizing CSS for a Decidim installation, each change affects all the organizations (tenant).
81
-
82
- This feature allows to customize each organization css without affecting the others in the same Decidim installation.
83
-
84
- ##### To create a theme
85
-
86
- 1. Get your hostname for the organization, theme search will be based on this (e.g: `myorganization.com`)
87
- 2. Create in you Decidim application this folder: `app/assets/themes/`
88
- 3. Create a file in that folder with the same name as the host and suffixed `.css` or `.scss` (e.g: `app/assets/themes/myorganization.com.scss`)
89
- 4. Modify that file as you like, you can use any SASS function available (such as `@import`)
90
- 5. Restart your server, enjoy!
91
-
92
- See an example here:
93
- https://github.com/Platoniq/decidim-demo/tree/master/app/assets/themes
94
-
95
- NOTE: Files presents in the `app/assets/themes` folder are added automatically into the precompile list of Rails by this plugin.
96
-
97
- #### 8. Fullscreen Iframe component
80
+ #### 7. Fullscreen Iframe component
98
81
 
99
82
  Another simple component that can be used to embed and Iframe with any external content in it that fills all the viewport.
100
83
 
101
84
  ![Fullscreen iframe](examples/fullscreen-iframe.png)
102
85
 
103
- #### 9. Live support chat
86
+ #### 8. Live support chat
104
87
 
105
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).
106
89
 
107
90
  ![Intergram screenshot](examples/intergram.png)
108
91
 
109
- #### 10. Custom CSS applied only according scoped restrictions
92
+ #### 9. Custom CSS applied only according scoped restrictions
110
93
 
111
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!
112
95
 
113
96
  ![CSS screenshot](examples/custom_styles.png)
114
97
 
115
- #### 11. Change the main menu of Decidim entirely!
98
+ #### 10. Change the main menu of Decidim entirely!
116
99
 
117
100
  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.
118
101
 
@@ -121,21 +104,57 @@ Feel free to hide, modify or add items in the Decidim's main menu. You can also
121
104
  ![Menu hacks screenshot](examples/menu-3.png)
122
105
  ![Menu hacks screenshot](examples/menu-4.png)
123
106
 
107
+ #### 11. Assign admins to specific scopes and prevent them modify anything else
108
+
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.
110
+
111
+ ![Scoped admins authorized](examples/scoped_admins_authorized.png)
112
+ ![Scoped admins unauthorized](examples/scoped_admins_unauthorized.png)
113
+ ![Scoped admins configuration](examples/scoped_admins_config.png)
114
+
115
+ #### 12. Custom fields for proposals
116
+
117
+ Now admins can substitute the body of a proposal with a set of form fields.
118
+ Edition is make with a Drag & Drop interface in the admin and can (and should) be scoped to apply only to certain proposal components.
119
+
120
+ Technically, the content is stored in the database as an XML document compatible with normal HTML (it uses the DL/DT/DD elements).
121
+
122
+ ![Custom fields screenshot](examples/custom-fields-1.png)
123
+ ![Custom fields screenshot](examples/custom-fields-2.png)
124
+ ![Custom fields screenshot](examples/custom-fields-1.gif)
125
+
126
+ #### 13. Custom Redirections (or URL shortener feature)
127
+
128
+ Admins can create custom paths that redirect to other places. Destinations can be internal absolute paths or external sites.
129
+ There's also possible to choose to sanitize (ie: remove) any query string or to maintain it (so you can decide to use).
130
+
131
+ For instance you can create a redirection like
132
+
133
+ * `/take-me-somewhere` => `/processes/canary-islands`
134
+
135
+ Using a link with a query string (ie: `/take-me-somewhere?locale=es`) that will redirect the user to:
136
+
137
+ * `/processes/canary-islands` if query string is sanitized
138
+ * `/processes/canary-islands?locale=es` if query string is not sanitized
139
+
140
+ > 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).
142
+ > Non-working routes will simply be ignored.
143
+
144
+ ![Custom redirections screenshot](examples/custom-redirections.png)
145
+
124
146
  #### To be continued...
125
147
 
126
- Some things in the road-map:
148
+ We're not done! Please check the [issues](/Platoniq/decidim-module-decidim_awesome/issues) (and participate) to see what's on our mind
127
149
 
128
- 1. Improve the conversation in comments by allowing images
129
- 1. Allow to create non-private surveys where the responding user is known by admins
130
- 1. Manipulate menus (reorder, change texts, add new items)
131
- 1. Propose something! or even better send a PR!
150
+ Also feel free to propose something! or even better send a PR!
132
151
 
133
152
  ## Installation
134
153
 
135
154
  Add this line to your application's Gemfile:
136
155
 
137
156
  ```ruby
138
- gem "decidim-decidim_awesome", "~> 0.6.6"
157
+ gem "decidim-decidim_awesome"
139
158
  ```
140
159
 
141
160
  And then execute:
@@ -143,15 +162,45 @@ And then execute:
143
162
  ```bash
144
163
  bundle
145
164
  bundle exec rails decidim_decidim_awesome:install:migrations
165
+ bundle exec rails decidim_decidim_awesome:webpacker:install
146
166
  bundle exec rails db:migrate
147
167
  ```
148
168
 
169
+ > NOTE: the `decidim_decidim_awesome:webpacker:install` is only necessary for Decidim versions starting at 0.25.
170
+
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:
172
+
173
+ ![Check image migrations](examples/check_image_migrations.png)
174
+
175
+ If you are a system admin, you can also perform this task by executing this rake task in the console:
176
+
177
+ ```
178
+ RAILS_ENV=production bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave
179
+ ```
180
+
181
+ Or check your migration status with:
182
+ ```
183
+ RAILS_ENV=production bin/rails decidim_awesome:active_storage_migrations:check_migration_from_carrierwave
184
+ ```
185
+
186
+
187
+ 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.
189
+
149
190
  Depending on your Decidim version, choose the corresponding Awesome version to ensure compatibility:
150
191
 
151
192
  | Awesome version | Compatible Decidim versions |
152
193
  |---|---|
153
- | 0.5.x | 0.21.x, 0.22.x |
194
+ | 0.8.x | 0.25.x, 0.26.x |
195
+ | 0.7.x | 0.23.x, 0.24.x |
154
196
  | 0.6.x | 0.22.x, 0.23.x |
197
+ | 0.5.x | 0.21.x, 0.22.x |
198
+
199
+ > *Heads up!*
200
+ > * 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
202
+ `bin/rails decidim_awesome:active_storage_migrations:migrate_from_carrierwave`
203
+ > * version 0.7.1 requires database migrations! Don't forget the migrations step when updating.
155
204
 
156
205
  ## Configuration
157
206
 
@@ -176,6 +225,9 @@ Decidim::DecidimAwesome.configure do |config|
176
225
  # De-activated, admins don't even see it as an option
177
226
  config.use_markdown_editor = :disabled
178
227
 
228
+ # Disable scoped admins
229
+ config.scoped_admins = :disabled
230
+
179
231
  # any other config var from lib/decidim/decidim_awesome.rb
180
232
  ...
181
233
  end
@@ -276,8 +328,8 @@ DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec appraisal
276
328
  To test a specific apprasail configured version do the following:
277
329
 
278
330
  ```
279
- DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec appraisal decidim-0.23 rake test_app
280
- DATABASE_USERNAME=<username> DATABASE_PASSWORD=<password> bundle exec appraisal decidim-0.23 rspec
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
281
333
  ```
282
334
 
283
335
  Note that the database user has to have rights to create and drop a database in
@@ -333,4 +385,4 @@ This engine is distributed under the GNU AFFERO GENERAL PUBLIC LICENSE.
333
385
 
334
386
  ## Credits
335
387
 
336
- This plugin has been developed by ![Platoniq](app/assets/images/decidim/decidim_awesome/platoniq-logo.png)
388
+ This plugin has been developed by ![Platoniq](app/packs/images/decidim/decidim_awesome/platoniq-logo.png)
data/Rakefile CHANGED
@@ -10,32 +10,30 @@ def install_module(path)
10
10
  end
11
11
  end
12
12
 
13
- def seed_db(path)
13
+ def override_webpacker_config_files(path)
14
14
  Dir.chdir(path) do
15
- system("bundle exec rake db:seed")
15
+ system("bundle exec rake decidim_decidim_awesome:webpacker:install")
16
16
  end
17
17
  end
18
18
 
19
- def copy_themes
20
- FileUtils.cp_r "lib/decidim/decidim_awesome/test/themes", "spec/decidim_dummy_app/app/assets/themes", verbose: true
19
+ def seed_db(path)
20
+ Dir.chdir(path) do
21
+ system("bundle exec rake db:seed")
22
+ end
21
23
  end
22
24
 
23
- def copy_headers
25
+ def copy_helpers
24
26
  FileUtils.mkdir_p "spec/decidim_dummy_app/app/views/v0.11", verbose: true
25
27
  FileUtils.cp_r "lib/decidim/decidim_awesome/test/layouts", "spec/decidim_dummy_app/app/views/v0.11/layouts", verbose: true
26
- end
27
-
28
- desc "copy test theme files"
29
- task :copy_themes do
30
- copy_themes
28
+ FileUtils.cp "lib/decidim/decidim_awesome/test/initializer.rb", "spec/decidim_dummy_app/config/initializers/decidim_awesome.rb", verbose: true
31
29
  end
32
30
 
33
31
  desc "Generates a dummy app for testing"
34
32
  task test_app: "decidim:generate_external_test_app" do
35
33
  ENV["RAILS_ENV"] = "test"
36
34
  install_module("spec/decidim_dummy_app")
37
- copy_themes
38
- copy_headers
35
+ override_webpacker_config_files("spec/decidim_dummy_app")
36
+ copy_helpers
39
37
  end
40
38
 
41
39
  desc "Generates a development app."
@@ -54,4 +52,5 @@ task :development_app do
54
52
 
55
53
  install_module("development_app")
56
54
  seed_db("development_app")
55
+ override_webpacker_config_files("development_app")
57
56
  end
@@ -0,0 +1,11 @@
1
+ <section class="wrapper-home map-block home-section">
2
+ <div class="row">
3
+ <div class="columns">
4
+ <div class="callout alert">
5
+ <p><%= t("unavailable", scope: "decidim.decidim_awesome.map_component.map.error") %></p>
6
+ </div>
7
+
8
+ <%= render partial: "decidim/decidim_awesome/map_component/map/api_ready.html" %>
9
+ </div>
10
+ </div>
11
+ </div>
@@ -0,0 +1,14 @@
1
+ <section class="wrapper-home map-block home-section">
2
+ <div class="row">
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>
14
+ </section>
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module ContentBlocks
6
+ class MapCell < Decidim::ViewModel
7
+ include Cell::ViewModel::Partial
8
+ include Decidim::DecidimAwesome::MapHelper
9
+ include Decidim::CardHelper
10
+
11
+ delegate :snippets, to: :controller
12
+ delegate :settings, to: :model
13
+ alias current_settings settings
14
+
15
+ def show
16
+ return error unless Decidim::Map.configured?
17
+
18
+ render
19
+ end
20
+
21
+ def error
22
+ render
23
+ end
24
+
25
+ def hide_controls
26
+ true
27
+ end
28
+
29
+ def all_categories
30
+ return if @all_categories.present?
31
+
32
+ @category_ids ||= Decidim::Category.pluck(:id, :decidim_participatory_space_type, :decidim_participatory_space_id).select do |category|
33
+ _id, space_type, space_id = category
34
+ space = space_type.constantize.find(space_id)
35
+ space.organization == current_organization
36
+ end.map(&:first)
37
+
38
+ @all_categories ||= Decidim::Category.where(id: @category_ids)
39
+ end
40
+
41
+ def global_map_components
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
48
+ else
49
+ false
50
+ end
51
+ end
52
+ end
53
+
54
+ def section_title
55
+ return if model.settings.title.blank?
56
+ return if model.settings.title.values.join.blank?
57
+
58
+ content_tag :h3, class: "section-heading" do
59
+ translated_attribute(model.settings.title)
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,65 @@
1
+ <% form.fields_for :settings, form.object.settings do |settings_fields| %>
2
+ <h3><%= t("text_settings", scope: i18n_scope) %></h3>
3
+
4
+ <div class="row">
5
+ <%= settings_fields.translated :text_field, :title, label: t("title", scope: i18n_scope) %>
6
+ </div>
7
+
8
+ <h3 class="mt-m"><%= t("map_settings", scope: i18n_scope) %></h3>
9
+
10
+ <div class="row two-buttons">
11
+ <div>
12
+ <%= settings_fields.number_field :truncate, label: t("truncate", scope: i18n_scope) %>
13
+ </div>
14
+ <div>
15
+ <%= settings_fields.number_field :map_height, label: t("map_height", scope: i18n_scope) %>
16
+ </div>
17
+ </div>
18
+
19
+ <div class="row two-buttons">
20
+ <div>
21
+ <%= settings_fields.text_field :map_center, label: t("map_center", scope: i18n_scope) %>
22
+ <p class="help-text"><%= t("map_center_help", scope: i18n_scope) %></p>
23
+ </div>
24
+ <div><%= settings_fields.number_field :map_zoom, label: t("map_zoom", scope: i18n_scope) %>
25
+ <p class="help-text"><%= t("map_zoom_help", scope: i18n_scope) %></p>
26
+ </div>
27
+ </div>
28
+ <div class="row two-buttons">
29
+ <div>
30
+ <%= settings_fields.check_box :menu_amendments, label: t("menu_amendments", scope: i18n_scope) %>
31
+ </div>
32
+ <div><%= settings_fields.check_box :menu_meetings, label: t("menu_meetings", scope: i18n_scope) %>
33
+ </div>
34
+ </div>
35
+ <div class="row two-buttons">
36
+ <div><%= settings_fields.check_box :show_not_answered, label: t("show_not_answered", scope: i18n_scope) %></div>
37
+ <div><%= settings_fields.check_box :show_accepted, label: t("show_accepted", scope: i18n_scope) %>
38
+ </div>
39
+ </div>
40
+ <div class="row two-buttons">
41
+ <div><%= settings_fields.check_box :show_withdrawn, label: t("show_withdrawn", scope: i18n_scope) %></div>
42
+ <div><%= settings_fields.check_box :show_evaluating, label: t("show_evaluating", scope: i18n_scope) %>
43
+ </div>
44
+ </div>
45
+ <div class="row two-buttons">
46
+ <div><%= settings_fields.check_box :show_rejected, label: t("show_rejected", scope: i18n_scope) %></div>
47
+ <div><%= settings_fields.check_box :menu_merge_components, label: t("menu_merge_components", scope: i18n_scope) %></div>
48
+ </div>
49
+ <% end %>
50
+
51
+ <style>
52
+ .two-buttons {
53
+ width: 100%;
54
+ display: flex;
55
+ justify-content: center;
56
+ align-items: center;
57
+ gap: 1em;
58
+ }
59
+ .two-buttons > div {
60
+ width: 50%;
61
+ }
62
+ .help-text {
63
+ margin-top: -1.5em;
64
+ }
65
+ </style>
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module ContentBlocks
6
+ class MapFormCell < Decidim::ViewModel
7
+ alias form model
8
+
9
+ def content_block
10
+ options[:content_block]
11
+ end
12
+
13
+ def i18n_scope
14
+ "decidim.decidim_awesome.content_blocks.map"
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module DecidimAwesome
5
+ module Admin
6
+ module NeedsConstraintHelpers
7
+ private
8
+
9
+ def create_constraint_never(var)
10
+ settings = { "participatory_space_manifest" => "none" }
11
+ subconfig = AwesomeConfig.find_or_initialize_by(var: "#{var}_#{@ident}", organization: @organization)
12
+ @constraint = ConfigConstraint.create!(
13
+ awesome_config: subconfig,
14
+ settings: settings
15
+ )
16
+ end
17
+
18
+ def constraint_can_be_destroyed?(constraint)
19
+ return true if constraint.awesome_config.blank?
20
+ return true if constraint.awesome_config.constraints.count > 1
21
+
22
+ case constraint.awesome_config.var.to_s
23
+ when /^proposal_custom_field/
24
+ false
25
+ else
26
+ true
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end