decidim-admin 0.27.9 → 0.28.0.rc4

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

Potentially problematic release.


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

Files changed (513) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/app/cells/decidim/admin/attachments_privacy_warning/show.erb +1 -1
  4. data/app/cells/decidim/admin/content_block/show.erb +11 -6
  5. data/app/cells/decidim/admin/content_block_cell.rb +21 -7
  6. data/app/cells/decidim/admin/homepage_content_block_cell.rb +19 -0
  7. data/app/cells/decidim/admin/results_per_page/show.erb +1 -1
  8. data/app/cells/decidim/admin/static_page_content_block_cell.rb +21 -0
  9. data/app/commands/decidim/admin/block_user.rb +15 -11
  10. data/app/commands/decidim/admin/close_session_managed_user.rb +1 -1
  11. data/app/commands/decidim/admin/content_blocks/create_content_block.rb +50 -0
  12. data/app/commands/decidim/admin/content_blocks/destroy_content_block.rb +36 -0
  13. data/app/commands/decidim/admin/content_blocks/reorder_content_blocks.rb +88 -0
  14. data/app/commands/decidim/admin/content_blocks/update_content_block.rb +81 -0
  15. data/app/commands/decidim/admin/create_area.rb +1 -1
  16. data/app/commands/decidim/admin/create_area_type.rb +1 -1
  17. data/app/commands/decidim/admin/create_attachment.rb +1 -1
  18. data/app/commands/decidim/admin/create_attachment_collection.rb +1 -1
  19. data/app/commands/decidim/admin/create_category.rb +1 -1
  20. data/app/commands/decidim/admin/create_newsletter.rb +1 -1
  21. data/app/commands/decidim/admin/create_participatory_space_private_user.rb +3 -3
  22. data/app/commands/decidim/admin/create_scope.rb +1 -1
  23. data/app/commands/decidim/admin/create_scope_type.rb +1 -1
  24. data/app/commands/decidim/admin/create_static_page.rb +1 -1
  25. data/app/commands/decidim/admin/create_static_page_topic.rb +1 -1
  26. data/app/commands/decidim/admin/destroy_area.rb +1 -1
  27. data/app/commands/decidim/admin/destroy_category.rb +2 -2
  28. data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +1 -1
  29. data/app/commands/decidim/admin/destroy_scope.rb +1 -1
  30. data/app/commands/decidim/admin/destroy_share_token.rb +1 -1
  31. data/app/commands/decidim/admin/destroy_static_page_topic.rb +1 -1
  32. data/app/commands/decidim/admin/hide_resource.rb +9 -35
  33. data/app/commands/decidim/admin/impersonate_user.rb +1 -1
  34. data/app/commands/decidim/admin/invite_admin.rb +1 -1
  35. data/app/commands/decidim/admin/participatory_space/create_admin.rb +132 -0
  36. data/app/commands/decidim/admin/participatory_space/destroy_admin.rb +61 -0
  37. data/app/commands/decidim/admin/participatory_space/publish.rb +41 -0
  38. data/app/commands/decidim/admin/participatory_space/unpublish.rb +41 -0
  39. data/app/commands/decidim/admin/participatory_space/update_admin.rb +72 -0
  40. data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +4 -6
  41. data/app/commands/decidim/admin/process_user_group_verification_csv.rb +4 -7
  42. data/app/commands/decidim/admin/promote_managed_user.rb +1 -1
  43. data/app/commands/decidim/admin/reject_user_group.rb +1 -1
  44. data/app/commands/decidim/admin/update_area.rb +1 -1
  45. data/app/commands/decidim/admin/update_area_type.rb +1 -1
  46. data/app/commands/decidim/admin/update_attachment.rb +1 -1
  47. data/app/commands/decidim/admin/update_attachment_collection.rb +1 -1
  48. data/app/commands/decidim/admin/update_category.rb +1 -1
  49. data/app/commands/decidim/admin/update_component_permissions.rb +2 -2
  50. data/app/commands/decidim/admin/update_newsletter.rb +1 -1
  51. data/app/commands/decidim/admin/update_organization.rb +2 -2
  52. data/app/commands/decidim/admin/update_organization_appearance.rb +5 -7
  53. data/app/commands/decidim/admin/update_organization_tos_version.rb +3 -3
  54. data/app/commands/decidim/admin/update_resource_permissions.rb +1 -1
  55. data/app/commands/decidim/admin/update_scope.rb +1 -1
  56. data/app/commands/decidim/admin/update_scope_type.rb +1 -1
  57. data/app/commands/decidim/admin/update_static_page.rb +1 -1
  58. data/app/commands/decidim/admin/update_static_page_topic.rb +1 -1
  59. data/app/commands/decidim/admin/update_user_groups.rb +1 -1
  60. data/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb +130 -0
  61. data/app/controllers/concerns/decidim/admin/content_blocks/landing_page_content_blocks.rb +158 -0
  62. data/app/controllers/concerns/decidim/admin/filterable.rb +3 -3
  63. data/app/controllers/concerns/decidim/admin/global_moderation_context.rb +1 -20
  64. data/app/controllers/concerns/decidim/admin/logs/filterable.rb +31 -0
  65. data/app/controllers/concerns/decidim/admin/participatory_space_admin_breadcrumb.rb +38 -0
  66. data/app/controllers/concerns/decidim/admin/participatory_space_admin_context.rb +3 -2
  67. data/app/controllers/decidim/admin/admin_terms_controller.rb +3 -3
  68. data/app/controllers/decidim/admin/application_controller.rb +6 -2
  69. data/app/controllers/decidim/admin/area_types_controller.rb +10 -3
  70. data/app/controllers/decidim/admin/areas_controller.rb +10 -3
  71. data/app/controllers/decidim/admin/authorization_workflows_controller.rb +1 -3
  72. data/app/controllers/decidim/admin/block_user_controller.rb +4 -3
  73. data/app/controllers/decidim/admin/categories_controller.rb +20 -12
  74. data/app/controllers/decidim/admin/component_permissions_controller.rb +2 -2
  75. data/app/controllers/decidim/admin/components/base_controller.rb +16 -1
  76. data/app/controllers/decidim/admin/components_controller.rb +13 -1
  77. data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +4 -10
  78. data/app/controllers/decidim/admin/concerns/has_attachments.rb +10 -16
  79. data/app/controllers/decidim/admin/concerns/has_breadcrumb_items.rb +27 -0
  80. data/app/controllers/decidim/admin/concerns/has_content_blocks.rb +23 -0
  81. data/app/controllers/decidim/admin/concerns/has_private_users.rb +4 -4
  82. data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +2 -2
  83. data/app/controllers/decidim/admin/concerns/has_tabbed_menu.rb +21 -0
  84. data/app/controllers/decidim/admin/conflicts_controller.rb +3 -9
  85. data/app/controllers/decidim/admin/dashboard_controller.rb +8 -3
  86. data/app/controllers/decidim/admin/exports_controller.rb +21 -4
  87. data/app/controllers/decidim/admin/help_sections_controller.rb +3 -1
  88. data/app/controllers/decidim/admin/impersonatable_users_controller.rb +3 -1
  89. data/app/controllers/decidim/admin/impersonations_controller.rb +8 -9
  90. data/app/controllers/decidim/admin/imports_controller.rb +24 -6
  91. data/app/controllers/decidim/admin/logs_controller.rb +20 -8
  92. data/app/controllers/decidim/admin/managed_users/impersonation_logs_controller.rb +1 -3
  93. data/app/controllers/decidim/admin/managed_users/promotions_controller.rb +2 -2
  94. data/app/controllers/decidim/admin/metrics_controller.rb +1 -1
  95. data/app/controllers/decidim/admin/moderated_users_controller.rb +7 -4
  96. data/app/controllers/decidim/admin/newsletters_controller.rb +16 -7
  97. data/app/controllers/decidim/admin/officializations_controller.rb +3 -3
  98. data/app/controllers/decidim/admin/organization_appearance_controller.rb +3 -0
  99. data/app/controllers/decidim/admin/organization_controller.rb +6 -7
  100. data/app/controllers/decidim/admin/organization_external_domain_whitelist_controller.rb +2 -0
  101. data/app/controllers/decidim/admin/organization_homepage_content_blocks_controller.rb +12 -41
  102. data/app/controllers/decidim/admin/organization_homepage_controller.rb +15 -33
  103. data/app/controllers/decidim/admin/participatory_space/user_role_controller.rb +119 -0
  104. data/app/controllers/decidim/admin/reminders_controller.rb +1 -1
  105. data/app/controllers/decidim/admin/resource_permissions_controller.rb +1 -1
  106. data/app/controllers/decidim/admin/scope_types_controller.rb +10 -3
  107. data/app/controllers/decidim/admin/scopes_controller.rb +10 -3
  108. data/app/controllers/decidim/admin/share_tokens_controller.rb +1 -1
  109. data/app/controllers/decidim/admin/space_publications_controller.rb +53 -0
  110. data/app/controllers/decidim/admin/static_page_content_blocks_controller.rb +40 -0
  111. data/app/controllers/decidim/admin/static_page_topics_controller.rb +18 -7
  112. data/app/controllers/decidim/admin/static_pages_controller.rb +33 -6
  113. data/app/controllers/decidim/admin/users_controller.rb +2 -2
  114. data/app/events/decidim/attachment_created_event.rb +1 -1
  115. data/app/events/decidim/component_published_event.rb +1 -12
  116. data/app/events/decidim/resource_hidden_event.rb +2 -6
  117. data/app/forms/decidim/admin/area_form.rb +1 -1
  118. data/app/forms/decidim/admin/block_user_form.rb +1 -0
  119. data/app/forms/decidim/admin/category_form.rb +1 -1
  120. data/app/forms/decidim/admin/managed_user_promotion_form.rb +1 -1
  121. data/app/forms/decidim/admin/organization_appearance_form.rb +7 -12
  122. data/app/forms/decidim/admin/organization_form.rb +2 -2
  123. data/app/forms/decidim/admin/participatory_space_admin_user_form.rb +16 -0
  124. data/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb +3 -5
  125. data/app/forms/decidim/admin/scope_form.rb +1 -1
  126. data/app/forms/decidim/admin/selective_newsletter_form.rb +1 -1
  127. data/app/forms/decidim/admin/static_page_form.rb +3 -3
  128. data/app/helpers/decidim/admin/admin_terms_helper.rb +10 -10
  129. data/app/helpers/decidim/admin/application_helper.rb +1 -14
  130. data/app/helpers/decidim/admin/attributes_display_helper.rb +1 -1
  131. data/app/helpers/decidim/admin/bulk_actions_helper.rb +2 -2
  132. data/app/helpers/decidim/admin/dashboard_helper.rb +3 -3
  133. data/app/helpers/decidim/admin/exports_helper.rb +26 -2
  134. data/app/helpers/decidim/admin/filterable_helper.rb +2 -2
  135. data/app/helpers/decidim/admin/icon_link_helper.rb +12 -11
  136. data/app/helpers/decidim/admin/icon_with_tooltip_helper.rb +22 -0
  137. data/app/helpers/decidim/admin/imports_helper.rb +1 -1
  138. data/app/helpers/decidim/admin/logs_helper.rb +18 -0
  139. data/app/helpers/decidim/admin/menu_helper.rb +61 -1
  140. data/app/helpers/decidim/admin/moderations/reports_helper.rb +3 -2
  141. data/app/helpers/decidim/admin/newsletters_helper.rb +4 -4
  142. data/app/helpers/decidim/admin/paginable/per_page_helper.rb +1 -1
  143. data/app/helpers/decidim/admin/resource_permissions_helper.rb +2 -2
  144. data/app/helpers/decidim/admin/search_form_helper.rb +19 -0
  145. data/app/helpers/decidim/admin/settings_helper.rb +9 -8
  146. data/app/jobs/decidim/admin/application_job.rb +1 -1
  147. data/app/jobs/decidim/admin/expire_impersonation_job.rb +1 -1
  148. data/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb +2 -2
  149. data/app/jobs/decidim/admin/newsletter_job.rb +1 -1
  150. data/app/mailers/decidim/admin/application_mailer.rb +12 -0
  151. data/app/packs/entrypoints/decidim_admin.js +2 -23
  152. data/app/packs/entrypoints/decidim_admin.scss +1 -1
  153. data/app/packs/src/decidim/admin/application.js +0 -12
  154. data/app/packs/src/decidim/admin/officializations.js +21 -3
  155. data/app/packs/src/decidim/admin/participatory_space_search.js +268 -0
  156. data/app/packs/src/decidim/admin/scope_picker_enabler.component.js +2 -2
  157. data/app/packs/src/decidim/admin/sortable.js +0 -2
  158. data/app/packs/src/decidim/admin/tab_focus.js +3 -3
  159. data/app/packs/src/decidim/admin/toggle_nav.js +1 -1
  160. data/app/packs/src/decidim/admin/triadic_color_picker.js +128 -0
  161. data/app/packs/stylesheets/decidim/admin/_bulk_actions.scss +16 -0
  162. data/app/packs/stylesheets/decidim/admin/_cards.scss +171 -0
  163. data/app/packs/stylesheets/decidim/admin/_color_picker.scss +61 -0
  164. data/app/packs/stylesheets/decidim/admin/_component-show.scss +95 -0
  165. data/app/packs/stylesheets/decidim/admin/_data_picker.scss +55 -0
  166. data/app/packs/stylesheets/decidim/admin/_dropdown.scss +35 -0
  167. data/app/packs/stylesheets/decidim/admin/_filters.scss +94 -0
  168. data/app/packs/stylesheets/decidim/admin/_forms.scss +81 -0
  169. data/app/packs/stylesheets/decidim/admin/_item_edit.scss +122 -0
  170. data/app/packs/stylesheets/decidim/admin/_item_show.scss +69 -0
  171. data/app/packs/stylesheets/decidim/admin/_layout.scss +79 -0
  172. data/app/packs/stylesheets/decidim/admin/_legacy_foundation.scss +482 -0
  173. data/app/packs/stylesheets/decidim/admin/_logs.scss +80 -0
  174. data/app/packs/stylesheets/decidim/admin/_main-nav.scss +93 -0
  175. data/app/packs/stylesheets/decidim/admin/_minimap.scss +59 -0
  176. data/app/packs/stylesheets/decidim/admin/_moderations.scss +36 -0
  177. data/app/packs/stylesheets/decidim/admin/_secondary-nav.scss +111 -0
  178. data/app/packs/stylesheets/decidim/admin/_show_email.scss +19 -0
  179. data/app/packs/stylesheets/decidim/admin/_sidebar-menu.scss +66 -0
  180. data/app/packs/stylesheets/decidim/admin/_table-list.scss +155 -0
  181. data/app/packs/stylesheets/decidim/admin/_tabs.scss +74 -0
  182. data/app/packs/stylesheets/decidim/admin/_title-bar.scss +62 -0
  183. data/app/packs/stylesheets/decidim/admin/_user-login.scss +9 -0
  184. data/app/packs/stylesheets/decidim/admin/application.scss +37 -21
  185. data/app/permissions/decidim/admin/permissions.rb +2 -2
  186. data/app/presenters/decidim/admin/aside_menu_presenter.rb +25 -0
  187. data/app/presenters/decidim/admin/dashboard_metric_charts_presenter.rb +0 -26
  188. data/app/presenters/decidim/admin/secondary_menu_presenter.rb +5 -9
  189. data/app/presenters/decidim/admin/simple_menu_presenter.rb +2 -2
  190. data/app/queries/decidim/admin/active_users_counter.rb +1 -1
  191. data/app/queries/decidim/admin/invites.rb +58 -0
  192. data/app/queries/decidim/admin/moderation_stats.rb +53 -0
  193. data/app/views/decidim/admin/admin_terms/show.html.erb +15 -10
  194. data/app/views/decidim/admin/area_types/_form.html.erb +11 -6
  195. data/app/views/decidim/admin/area_types/edit.html.erb +14 -12
  196. data/app/views/decidim/admin/area_types/index.html.erb +35 -33
  197. data/app/views/decidim/admin/area_types/new.html.erb +14 -12
  198. data/app/views/decidim/admin/areas/_form.html.erb +12 -8
  199. data/app/views/decidim/admin/areas/edit.html.erb +14 -12
  200. data/app/views/decidim/admin/areas/index.html.erb +40 -38
  201. data/app/views/decidim/admin/areas/new.html.erb +14 -12
  202. data/app/views/decidim/admin/attachment_collections/_form.html.erb +12 -14
  203. data/app/views/decidim/admin/attachment_collections/edit.html.erb +17 -5
  204. data/app/views/decidim/admin/attachment_collections/index.html.erb +35 -40
  205. data/app/views/decidim/admin/attachment_collections/new.html.erb +16 -5
  206. data/app/views/decidim/admin/attachments/_form.html.erb +18 -22
  207. data/app/views/decidim/admin/attachments/edit.html.erb +17 -5
  208. data/app/views/decidim/admin/attachments/index.html.erb +45 -48
  209. data/app/views/decidim/admin/attachments/new.html.erb +16 -5
  210. data/app/views/decidim/admin/authorization_workflows/index.html.erb +7 -0
  211. data/app/views/decidim/admin/block_user/new.html.erb +39 -18
  212. data/app/views/decidim/admin/categories/_form.html.erb +13 -15
  213. data/app/views/decidim/admin/categories/edit.html.erb +16 -5
  214. data/app/views/decidim/admin/categories/index.html.erb +44 -55
  215. data/app/views/decidim/admin/categories/new.html.erb +16 -5
  216. data/app/views/decidim/admin/components/_actions.html.erb +17 -16
  217. data/app/views/decidim/admin/components/_component.html.erb +5 -3
  218. data/app/views/decidim/admin/components/_form.html.erb +87 -47
  219. data/app/views/decidim/admin/components/_resource_action.html.erb +9 -0
  220. data/app/views/decidim/admin/components/_settings_fields.html.erb +11 -8
  221. data/app/views/decidim/admin/components/edit.html.erb +16 -5
  222. data/app/views/decidim/admin/components/index.html.erb +23 -18
  223. data/app/views/decidim/admin/components/new.html.erb +16 -5
  224. data/app/views/decidim/admin/conflicts/edit.html.erb +24 -26
  225. data/app/views/decidim/admin/conflicts/index.html.erb +23 -26
  226. data/app/views/decidim/admin/dashboard/_pending_moderations.html.erb +12 -0
  227. data/app/views/decidim/admin/dashboard/show.html.erb +26 -20
  228. data/app/views/decidim/admin/devise/mailers/password_change.html.erb +1 -1
  229. data/app/views/decidim/admin/devise/mailers/reset_password_instructions.html.erb +2 -2
  230. data/app/views/decidim/admin/exports/_dropdown.html.erb +11 -4
  231. data/app/views/decidim/admin/help_sections/_form.html.erb +34 -18
  232. data/app/views/decidim/admin/impersonatable_users/index.html.erb +46 -53
  233. data/app/views/decidim/admin/impersonations/_form.html.erb +53 -35
  234. data/app/views/decidim/admin/impersonations/new.html.erb +21 -19
  235. data/app/views/decidim/admin/imports/_dropdown.html.erb +5 -2
  236. data/app/views/decidim/admin/imports/new.html.erb +54 -43
  237. data/app/views/decidim/admin/logs/_filters.html.erb +37 -0
  238. data/app/views/decidim/admin/logs/_logs_list.html.erb +4 -3
  239. data/app/views/decidim/admin/logs/index.html.erb +3 -6
  240. data/app/views/decidim/admin/managed_users/impersonation_logs/index.html.erb +27 -28
  241. data/app/views/decidim/admin/managed_users/promotions/_form.html.erb +8 -2
  242. data/app/views/decidim/admin/managed_users/promotions/new.html.erb +17 -15
  243. data/app/views/decidim/admin/metrics/_metrics.html.erb +1 -6
  244. data/app/views/decidim/admin/metrics/index.html.erb +1 -1
  245. data/app/views/decidim/admin/moderated_users/_report.html.erb +1 -5
  246. data/app/views/decidim/admin/moderated_users/index.html.erb +58 -75
  247. data/app/views/decidim/admin/moderations/index.html.erb +91 -101
  248. data/app/views/decidim/admin/moderations/reports/index.html.erb +91 -92
  249. data/app/views/decidim/admin/moderations/reports/show.html.erb +51 -49
  250. data/app/views/decidim/admin/newsletter_templates/index.html.erb +12 -11
  251. data/app/views/decidim/admin/newsletter_templates/show.html.erb +8 -6
  252. data/app/views/decidim/admin/newsletters/_form.html.erb +10 -4
  253. data/app/views/decidim/admin/newsletters/edit.html.erb +21 -12
  254. data/app/views/decidim/admin/newsletters/index.html.erb +57 -57
  255. data/app/views/decidim/admin/newsletters/new.html.erb +20 -12
  256. data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +53 -55
  257. data/app/views/decidim/admin/newsletters/show.html.erb +24 -17
  258. data/app/views/decidim/admin/officializations/_show_email_modal.html.erb +20 -21
  259. data/app/views/decidim/admin/officializations/index.html.erb +55 -62
  260. data/app/views/decidim/admin/officializations/new.html.erb +24 -16
  261. data/app/views/decidim/admin/officializations/show_email.html.erb +0 -1
  262. data/app/views/decidim/admin/organization/_form.html.erb +76 -90
  263. data/app/views/decidim/admin/organization/edit.html.erb +19 -11
  264. data/app/views/decidim/admin/organization_appearance/_form.html.erb +72 -57
  265. data/app/views/decidim/admin/organization_appearance/edit.html.erb +17 -6
  266. data/app/views/decidim/admin/organization_appearance/form/_colors.html.erb +63 -24
  267. data/app/views/decidim/admin/organization_appearance/form/_header_snippets.html.erb +17 -0
  268. data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +39 -40
  269. data/app/views/decidim/admin/organization_appearance/form/_minimap.html.erb +5 -14
  270. data/app/views/decidim/admin/organization_external_domain_whitelist/_external_domain.html.erb +18 -13
  271. data/app/views/decidim/admin/organization_external_domain_whitelist/_form.html.erb +8 -10
  272. data/app/views/decidim/admin/organization_external_domain_whitelist/edit.html.erb +17 -6
  273. data/app/views/decidim/admin/participatory_space_private_users/_form.html.erb +10 -14
  274. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +59 -60
  275. data/app/views/decidim/admin/participatory_space_private_users/new.html.erb +17 -5
  276. data/app/views/decidim/admin/participatory_space_private_users_csv_imports/new.html.erb +28 -11
  277. data/app/views/decidim/admin/reminders/new.html.erb +18 -16
  278. data/app/views/decidim/admin/resource_permissions/edit.html.erb +46 -47
  279. data/app/views/decidim/admin/scope_types/_form.html.erb +9 -6
  280. data/app/views/decidim/admin/scope_types/edit.html.erb +17 -11
  281. data/app/views/decidim/admin/scope_types/index.html.erb +40 -34
  282. data/app/views/decidim/admin/scope_types/new.html.erb +17 -11
  283. data/app/views/decidim/admin/scopes/_form.html.erb +11 -9
  284. data/app/views/decidim/admin/scopes/edit.html.erb +17 -11
  285. data/app/views/decidim/admin/scopes/index.html.erb +39 -41
  286. data/app/views/decidim/admin/scopes/new.html.erb +17 -11
  287. data/app/views/decidim/admin/share_tokens/_share_tokens.html.erb +3 -15
  288. data/app/views/decidim/admin/shared/_admin_confirm_modal.html.erb +18 -0
  289. data/app/views/decidim/admin/shared/_filters.html.erb +6 -10
  290. data/app/views/decidim/admin/shared/_gallery.html.erb +8 -19
  291. data/app/views/decidim/admin/shared/_js-callout.html.erb +4 -2
  292. data/app/views/decidim/admin/shared/landing_page/_content_blocks.html.erb +68 -0
  293. data/app/views/decidim/admin/shared/landing_page/edit.html.erb +1 -47
  294. data/app/views/decidim/admin/shared/landing_page_content_blocks/edit.html.erb +24 -14
  295. data/app/views/decidim/admin/static_page_topics/_form.html.erb +2 -2
  296. data/app/views/decidim/admin/static_page_topics/edit.html.erb +21 -11
  297. data/app/views/decidim/admin/static_page_topics/index.html.erb +41 -0
  298. data/app/views/decidim/admin/static_page_topics/new.html.erb +21 -11
  299. data/app/views/decidim/admin/static_pages/_form.html.erb +41 -26
  300. data/app/views/decidim/admin/static_pages/_form_notable_changes.html.erb +2 -3
  301. data/app/views/decidim/admin/static_pages/_topic.html.erb +40 -44
  302. data/app/views/decidim/admin/static_pages/edit.html.erb +22 -12
  303. data/app/views/decidim/admin/static_pages/index.html.erb +14 -2
  304. data/app/views/decidim/admin/static_pages/new.html.erb +15 -11
  305. data/app/views/decidim/admin/user_groups/index.html.erb +58 -58
  306. data/app/views/decidim/admin/user_groups_csv_verifications/new.html.erb +28 -17
  307. data/app/views/decidim/admin/users/_form.html.erb +14 -8
  308. data/app/views/decidim/admin/users/index.html.erb +52 -54
  309. data/app/views/decidim/admin/users/new.html.erb +15 -12
  310. data/app/views/layouts/decidim/admin/_admin_timeout_modal.html.erb +24 -0
  311. data/app/views/layouts/decidim/admin/_application.html.erb +50 -12
  312. data/app/views/layouts/decidim/admin/_breadcrumb.html.erb +26 -0
  313. data/app/views/layouts/decidim/admin/_callouts_full.html.erb +2 -13
  314. data/app/views/layouts/decidim/admin/_header.html.erb +2 -6
  315. data/app/views/layouts/decidim/admin/_js_configuration.html.erb +3 -6
  316. data/app/views/layouts/decidim/admin/_sidebar_menu.html.erb +24 -0
  317. data/app/views/layouts/decidim/admin/_title_bar.html.erb +36 -37
  318. data/app/views/layouts/decidim/admin/_title_bar_responsive.html.erb +46 -0
  319. data/app/views/layouts/decidim/admin/global_moderations.html.erb +1 -3
  320. data/app/views/layouts/decidim/admin/newsletters.erb +0 -11
  321. data/app/views/layouts/decidim/admin/settings.html.erb +2 -3
  322. data/app/views/layouts/decidim/admin/users.html.erb +1 -3
  323. data/config/locales/ar-SA.yml +0 -3
  324. data/config/locales/ar.yml +9 -83
  325. data/config/locales/bg.yml +3 -990
  326. data/config/locales/ca.yml +121 -89
  327. data/config/locales/cs-CZ.yml +0 -3
  328. data/config/locales/cs.yml +120 -86
  329. data/config/locales/de.yml +123 -91
  330. data/config/locales/el.yml +90 -78
  331. data/config/locales/en.yml +123 -91
  332. data/config/locales/eo.yml +0 -2
  333. data/config/locales/es-MX.yml +121 -89
  334. data/config/locales/es-PY.yml +121 -89
  335. data/config/locales/es.yml +124 -92
  336. data/config/locales/eu.yml +126 -94
  337. data/config/locales/fi-pl.yml +0 -3
  338. data/config/locales/fi-plain.yml +112 -80
  339. data/config/locales/fi.yml +115 -83
  340. data/config/locales/fr-CA.yml +119 -87
  341. data/config/locales/fr-LU.yml +0 -3
  342. data/config/locales/fr.yml +119 -87
  343. data/config/locales/ga-IE.yml +4 -12
  344. data/config/locales/gl.yml +7 -99
  345. data/config/locales/hu.yml +93 -98
  346. data/config/locales/id-ID.yml +0 -64
  347. data/config/locales/is-IS.yml +0 -53
  348. data/config/locales/it.yml +9 -103
  349. data/config/locales/ja.yml +117 -88
  350. data/config/locales/kaa.yml +6 -13
  351. data/config/locales/ko.yml +0 -720
  352. data/config/locales/lb-LU.yml +0 -3
  353. data/config/locales/lb.yml +9 -104
  354. data/config/locales/lt.yml +90 -72
  355. data/config/locales/lv.yml +0 -79
  356. data/config/locales/nl.yml +14 -109
  357. data/config/locales/no.yml +8 -115
  358. data/config/locales/pl.yml +7 -158
  359. data/config/locales/pt-BR.yml +87 -106
  360. data/config/locales/pt.yml +9 -104
  361. data/config/locales/ro-RO.yml +86 -85
  362. data/config/locales/ru.yml +0 -55
  363. data/config/locales/sk-SK.yml +3 -6
  364. data/config/locales/sk.yml +0 -76
  365. data/config/locales/sl.yml +0 -8
  366. data/config/locales/sq-AL.yml +4 -486
  367. data/config/locales/sr-CS.yml +0 -60
  368. data/config/locales/sv.yml +99 -192
  369. data/config/locales/th-TH.yml +0 -100
  370. data/config/locales/tr-TR.yml +1 -89
  371. data/config/locales/uk.yml +0 -48
  372. data/config/locales/zh-CN.yml +0 -79
  373. data/config/locales/zh-TW.yml +74 -72
  374. data/config/routes.rb +12 -4
  375. data/lib/decidim/admin/components.rb +1 -1
  376. data/lib/decidim/admin/custom_import.rb +29 -0
  377. data/lib/decidim/admin/engine.rb +54 -216
  378. data/lib/decidim/admin/import/importer.rb +3 -3
  379. data/lib/decidim/admin/import/importer_factory.rb +1 -1
  380. data/lib/decidim/admin/import/readers/base.rb +1 -1
  381. data/lib/decidim/admin/import/readers/csv.rb +2 -2
  382. data/lib/decidim/admin/import/verifier.rb +4 -4
  383. data/lib/decidim/admin/menu.rb +281 -0
  384. data/lib/decidim/admin/search_form_builder.rb +39 -0
  385. data/lib/decidim/admin/test/admin_participatory_space_access_examples.rb +3 -2
  386. data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +3 -3
  387. data/lib/decidim/admin/test/commands/create_category_examples.rb +2 -2
  388. data/lib/decidim/admin/test/commands/destroy_category_examples.rb +4 -13
  389. data/lib/decidim/admin/test/commands/publish_participatory_space_examples.rb +102 -0
  390. data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +4 -4
  391. data/lib/decidim/admin/test/commands/update_category_examples.rb +3 -3
  392. data/lib/decidim/admin/test/destroy_admin_examples.rb +39 -0
  393. data/lib/decidim/admin/test/filterable_examples.rb +8 -8
  394. data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +12 -43
  395. data/lib/decidim/admin/test/filters_participatory_space_users_examples.rb +34 -43
  396. data/lib/decidim/admin/test/forms/attachment_collection_form_examples.rb +1 -1
  397. data/lib/decidim/admin/test/forms/attachment_form_examples.rb +1 -1
  398. data/lib/decidim/admin/test/forms/category_form_examples.rb +1 -1
  399. data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +21 -22
  400. data/lib/decidim/admin/test/manage_attachments_examples.rb +12 -12
  401. data/lib/decidim/admin/test/manage_categories_examples.rb +16 -19
  402. data/lib/decidim/admin/test/manage_component_permissions_examples.rb +24 -24
  403. data/lib/decidim/admin/test/manage_hide_content_examples.rb +59 -0
  404. data/lib/decidim/admin/test/manage_moderations_examples.rb +39 -21
  405. data/lib/decidim/admin/test/manage_paginated_collection_examples.rb +2 -2
  406. data/lib/decidim/admin/test/manage_participatory_space_publications_examples.rb +54 -0
  407. data/lib/decidim/admin/test/needs_admin_tos_accepted_examples.rb +1 -1
  408. data/lib/decidim/admin/test.rb +4 -0
  409. data/lib/decidim/admin/version.rb +1 -1
  410. data/lib/decidim/admin.rb +2 -0
  411. metadata +92 -117
  412. data/app/commands/decidim/admin/create_participatory_space_admin_user_actions.rb +0 -94
  413. data/app/commands/decidim/admin/reorder_content_blocks.rb +0 -100
  414. data/app/commands/decidim/admin/update_content_block.rb +0 -79
  415. data/app/controllers/concerns/decidim/admin/landing_page.rb +0 -105
  416. data/app/controllers/concerns/decidim/admin/landing_page_content_blocks.rb +0 -118
  417. data/app/packs/images/decidim/admin/.keep +0 -0
  418. data/app/packs/stylesheets/decidim/admin/_decidim.scss +0 -23
  419. data/app/packs/stylesheets/decidim/admin/_variables.scss +0 -18
  420. data/app/packs/stylesheets/decidim/admin/bundle.scss +0 -2
  421. data/app/packs/stylesheets/decidim/admin/components/_accordion.scss +0 -41
  422. data/app/packs/stylesheets/decidim/admin/components/_dropdown-menu.scss +0 -3
  423. data/app/packs/stylesheets/decidim/admin/components/_sortable.scss +0 -5
  424. data/app/packs/stylesheets/decidim/admin/extra/_action-icon.scss +0 -32
  425. data/app/packs/stylesheets/decidim/admin/extra/_block_user.scss +0 -5
  426. data/app/packs/stylesheets/decidim/admin/extra/_cards.scss +0 -24
  427. data/app/packs/stylesheets/decidim/admin/extra/_categories.scss +0 -5
  428. data/app/packs/stylesheets/decidim/admin/extra/_dropdown_inverted.scss +0 -47
  429. data/app/packs/stylesheets/decidim/admin/extra/_editor.scss +0 -1
  430. data/app/packs/stylesheets/decidim/admin/extra/_email_preview.scss +0 -5
  431. data/app/packs/stylesheets/decidim/admin/extra/_label-required.scss +0 -3
  432. data/app/packs/stylesheets/decidim/admin/extra/_login.scss +0 -37
  433. data/app/packs/stylesheets/decidim/admin/extra/_logs.scss +0 -122
  434. data/app/packs/stylesheets/decidim/admin/extra/_newsletter-templates-gallery.scss +0 -3
  435. data/app/packs/stylesheets/decidim/admin/extra/_organization-appearance.scss +0 -141
  436. data/app/packs/stylesheets/decidim/admin/extra/_quill.scss +0 -12
  437. data/app/packs/stylesheets/decidim/admin/extra/_select_multiple.scss +0 -3
  438. data/app/packs/stylesheets/decidim/admin/extra/_show_email.scss +0 -31
  439. data/app/packs/stylesheets/decidim/admin/extra/_sort.scss +0 -13
  440. data/app/packs/stylesheets/decidim/admin/extra/_title_bar.scss +0 -80
  441. data/app/packs/stylesheets/decidim/admin/modules/_action-icon.scss +0 -30
  442. data/app/packs/stylesheets/decidim/admin/modules/_agenda.scss +0 -34
  443. data/app/packs/stylesheets/decidim/admin/modules/_autocomplete.scss +0 -5
  444. data/app/packs/stylesheets/decidim/admin/modules/_buttons.scss +0 -86
  445. data/app/packs/stylesheets/decidim/admin/modules/_callouts.scss +0 -45
  446. data/app/packs/stylesheets/decidim/admin/modules/_card-grid.scss +0 -25
  447. data/app/packs/stylesheets/decidim/admin/modules/_cards.scss +0 -126
  448. data/app/packs/stylesheets/decidim/admin/modules/_char-counter.scss +0 -22
  449. data/app/packs/stylesheets/decidim/admin/modules/_component-counter.scss +0 -26
  450. data/app/packs/stylesheets/decidim/admin/modules/_draggable-list.scss +0 -27
  451. data/app/packs/stylesheets/decidim/admin/modules/_dropdown.scss +0 -20
  452. data/app/packs/stylesheets/decidim/admin/modules/_filters.scss +0 -83
  453. data/app/packs/stylesheets/decidim/admin/modules/_forms.scss +0 -164
  454. data/app/packs/stylesheets/decidim/admin/modules/_icons.scss +0 -68
  455. data/app/packs/stylesheets/decidim/admin/modules/_layout.scss +0 -75
  456. data/app/packs/stylesheets/decidim/admin/modules/_loading-spinner.scss +0 -19
  457. data/app/packs/stylesheets/decidim/admin/modules/_main-nav.scss +0 -45
  458. data/app/packs/stylesheets/decidim/admin/modules/_moderations.scss +0 -39
  459. data/app/packs/stylesheets/decidim/admin/modules/_modules.scss +0 -44
  460. data/app/packs/stylesheets/decidim/admin/modules/_pics.scss +0 -5
  461. data/app/packs/stylesheets/decidim/admin/modules/_process-header.scss +0 -13
  462. data/app/packs/stylesheets/decidim/admin/modules/_reveal.scss +0 -5
  463. data/app/packs/stylesheets/decidim/admin/modules/_secondary-nav.scss +0 -114
  464. data/app/packs/stylesheets/decidim/admin/modules/_table-list.scss +0 -146
  465. data/app/packs/stylesheets/decidim/admin/modules/_tabs.scss +0 -63
  466. data/app/packs/stylesheets/decidim/admin/modules/_title-bar.scss +0 -35
  467. data/app/packs/stylesheets/decidim/admin/modules/_typography.scss +0 -27
  468. data/app/packs/stylesheets/decidim/admin/modules/_upload_modal.scss +0 -42
  469. data/app/packs/stylesheets/decidim/admin/modules/_user-login.scss +0 -25
  470. data/app/packs/stylesheets/decidim/admin/modules/_users_statistics.scss +0 -18
  471. data/app/packs/stylesheets/decidim/admin/plugins/_foundation-datepicker.scss +0 -224
  472. data/app/packs/stylesheets/decidim/admin/plugins/jquery.auto-complete.css +0 -9
  473. data/app/packs/stylesheets/decidim/admin/user_moderations.scss +0 -3
  474. data/app/packs/stylesheets/decidim/admin/utils/_flex.scss +0 -60
  475. data/app/packs/stylesheets/decidim/admin/utils/_helpers.scss +0 -53
  476. data/app/packs/stylesheets/decidim/admin/utils/_keyframes.scss +0 -21
  477. data/app/packs/stylesheets/decidim/admin/utils/_mixins.scss +0 -151
  478. data/app/packs/stylesheets/decidim/admin/utils/_settings.scss +0 -882
  479. data/app/packs/stylesheets/decidim/admin/utils/_toggle-expand.scss +0 -9
  480. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/_constants.scss +0 -5
  481. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/_math.scss +0 -45
  482. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_acos.scss +0 -14
  483. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_asin.scss +0 -16
  484. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan.scss +0 -36
  485. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_atan2.scss +0 -46
  486. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_cos.scss +0 -17
  487. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_cot.scss +0 -12
  488. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_csc.scss +0 -12
  489. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_exp.scss +0 -16
  490. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_fact.scss +0 -21
  491. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_frexp.scss +0 -25
  492. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_ldexp.scss +0 -20
  493. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_log.scss +0 -39
  494. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_pow.scss +0 -34
  495. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_sec.scss +0 -12
  496. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_sin.scss +0 -10
  497. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_sqrt.scss +0 -21
  498. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/functions/_tan.scss +0 -12
  499. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/helpers/_deg-to-rad.scss +0 -6
  500. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/helpers/_rad-to-deg.scss +0 -6
  501. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/helpers/_strip-unit.scss +0 -11
  502. data/app/packs/stylesheets/decidim/admin/vendor/mathsass/helpers/_unitless-rad.scss +0 -19
  503. data/app/views/decidim/admin/attachment_collections/show.html.erb +0 -13
  504. data/app/views/decidim/admin/attachments/show.html.erb +0 -24
  505. data/app/views/decidim/admin/categories/show.html.erb +0 -12
  506. data/app/views/decidim/admin/organization_homepage/edit.html.erb +0 -43
  507. data/app/views/decidim/admin/organization_homepage_content_blocks/edit.html.erb +0 -13
  508. data/app/views/decidim/admin/static_pages/show.html.erb +0 -21
  509. data/app/views/layouts/decidim/admin/_template_bottom.html.erb +0 -2
  510. data/app/views/layouts/decidim/admin/_template_top.html.erb +0 -4
  511. data/app/views/layouts/decidim/admin/pages.html.erb +0 -15
  512. data/config/locales/he-IL.yml +0 -53
  513. data/decidim-admin.gemspec +0 -36
@@ -5,6 +5,7 @@ module Decidim
5
5
  # This controller allows admins to import resources from a file.
6
6
  class ImportsController < Decidim::Admin::ApplicationController
7
7
  include Decidim::ComponentPathHelper
8
+ before_action :set_import_breadcrumb_item
8
9
 
9
10
  helper_method :import_manifest
10
11
 
@@ -14,7 +15,7 @@ module Decidim
14
15
 
15
16
  @form = form(import_manifest.form_class).from_params(
16
17
  { name: import_manifest.name },
17
- current_component: current_component
18
+ current_component:
18
19
  )
19
20
  end
20
21
 
@@ -24,8 +25,8 @@ module Decidim
24
25
 
25
26
  @form = form(import_manifest.form_class).from_params(
26
27
  params,
27
- current_component: current_component,
28
- current_organization: current_organization
28
+ current_component:,
29
+ current_organization:
29
30
  )
30
31
 
31
32
  CreateImport.call(@form) do
@@ -48,8 +49,8 @@ module Decidim
48
49
  raise ActionController::RoutingError, "Not Found" unless import_manifest
49
50
 
50
51
  @form = form(Decidim::Admin::ImportExampleForm).from_params(params).with_context(
51
- current_component: current_component,
52
- current_organization: current_organization
52
+ current_component:,
53
+ current_organization:
53
54
  )
54
55
 
55
56
  respond_to do |format|
@@ -58,7 +59,7 @@ module Decidim
58
59
  CreateImportExample.call(@form) do
59
60
  on(:ok) do |data|
60
61
  filename = "#{current_component.manifest_name}-#{import_manifest.name}-example.#{key}"
61
- send_data data.read, disposition: :attachment, filename: filename, type: mime
62
+ send_data data.read, disposition: :attachment, filename:, type: mime
62
63
  end
63
64
 
64
65
  on(:invalid) do
@@ -86,6 +87,23 @@ module Decidim
86
87
  def current_component
87
88
  @current_component ||= current_participatory_space.components.find(params[:component_id])
88
89
  end
90
+
91
+ def parent_path
92
+ @parent_path ||= ::Decidim::EngineRouter.admin_proxy(current_participatory_space).components_path
93
+ end
94
+
95
+ def set_import_breadcrumb_item
96
+ context_breadcrumb_items << {
97
+ label: t("components", scope: "decidim.admin.menu"),
98
+ url: parent_path,
99
+ active: false
100
+ }
101
+ context_breadcrumb_items << {
102
+ label: translated_attribute(current_component.name),
103
+ url: ::Decidim::EngineRouter.admin_proxy(current_component).root_path,
104
+ active: true
105
+ }
106
+ end
89
107
  end
90
108
  end
91
109
  end
@@ -5,7 +5,9 @@ module Decidim
5
5
  # Controller that shows a simple dashboard.
6
6
  #
7
7
  class LogsController < Decidim::Admin::ApplicationController
8
- helper_method :logs
8
+ include Decidim::Admin::Logs::Filterable
9
+
10
+ helper_method :logs, :no_logs_available?
9
11
 
10
12
  def index
11
13
  enforce_permission_to :read, :admin_log
@@ -14,13 +16,23 @@ module Decidim
14
16
  private
15
17
 
16
18
  def logs
17
- @logs ||= Decidim::ActionLog
18
- .where(organization: current_organization)
19
- .includes(:participatory_space, :user, :resource, :component, :version)
20
- .for_admin
21
- .order(created_at: :desc)
22
- .page(params[:page])
23
- .per(20)
19
+ @logs ||= filtered_collection.order(created_at: :desc)
20
+ end
21
+
22
+ def no_logs_available?
23
+ root_query.none?
24
+ end
25
+
26
+ def base_query
27
+ root_query.includes(
28
+ :participatory_space, :user, :resource, :component, :version
29
+ )
30
+ end
31
+
32
+ def root_query
33
+ Decidim::ActionLog.where(
34
+ organization: current_organization
35
+ ).for_admin
24
36
  end
25
37
  end
26
38
  end
@@ -9,9 +9,7 @@ module Decidim
9
9
  layout "decidim/admin/users"
10
10
 
11
11
  def index
12
- enforce_permission_to :index, :impersonatable_user
13
-
14
- @impersonation_logs = Decidim::ImpersonationLog.where(user: user).order(started_at: :desc).page(params[:page]).per(15)
12
+ @impersonation_logs = Decidim::ImpersonationLog.where(user:).order(started_at: :desc).page(params[:page]).per(15)
15
13
  end
16
14
 
17
15
  private
@@ -9,12 +9,12 @@ module Decidim
9
9
  layout "decidim/admin/users"
10
10
 
11
11
  def new
12
- enforce_permission_to :promote, :managed_user, user: user
12
+ enforce_permission_to(:promote, :managed_user, user:)
13
13
  @form = form(ManagedUserPromotionForm).instance
14
14
  end
15
15
 
16
16
  def create
17
- enforce_permission_to :promote, :managed_user, user: user
17
+ enforce_permission_to(:promote, :managed_user, user:)
18
18
  @form = form(ManagedUserPromotionForm).from_params(params)
19
19
 
20
20
  PromoteManagedUser.call(@form, user, current_user) do
@@ -15,7 +15,7 @@ module Decidim
15
15
  @metrics_presenter ||= Decidim::Admin::DashboardMetricChartsPresenter.new(
16
16
  summary: false,
17
17
  organization: current_organization,
18
- view_context: view_context
18
+ view_context:
19
19
  )
20
20
  end
21
21
  end
@@ -5,7 +5,7 @@ module Decidim
5
5
  class ModeratedUsersController < Decidim::Admin::ApplicationController
6
6
  include Decidim::ModeratedUsers::Admin::Filterable
7
7
 
8
- layout "decidim/admin/users"
8
+ layout "decidim/admin/global_moderations"
9
9
 
10
10
  def index
11
11
  enforce_permission_to :read, :moderate_users
@@ -36,12 +36,15 @@ module Decidim
36
36
  end
37
37
 
38
38
  def base_query_finder
39
- UserModeration.joins(:user).where(decidim_users: { decidim_organization_id: current_organization.id })
39
+ Decidim::Admin::ModerationStats.new(current_user).user_reports
40
40
  end
41
41
 
42
42
  def collection
43
- target_scope = params[:blocked] && params[:blocked] == "true" ? :blocked : :unblocked
44
- base_query_finder.send(target_scope)
43
+ @collection ||= if params[:blocked]
44
+ base_query_finder.blocked
45
+ else
46
+ base_query_finder.unblocked
47
+ end
45
48
  end
46
49
  end
47
50
  end
@@ -21,12 +21,21 @@ module Decidim
21
21
  end
22
22
 
23
23
  def show
24
- enforce_permission_to :read, :newsletter, newsletter: newsletter
24
+ enforce_permission_to(:read, :newsletter, newsletter:)
25
25
  @email = NewsletterMailer.newsletter(current_user, newsletter)
26
26
  end
27
27
 
28
+ def send_to_user
29
+ enforce_permission_to :read, :newsletter, newsletter:
30
+
31
+ NewsletterMailer.newsletter(current_user, newsletter).deliver_later
32
+ flash[:notice] = I18n.t("newsletters.send_to_user.sent_successfully", scope: "decidim.admin", email: current_user.email)
33
+
34
+ redirect_back fallback_location: newsletters_path
35
+ end
36
+
28
37
  def preview
29
- enforce_permission_to :read, :newsletter, newsletter: newsletter
38
+ enforce_permission_to(:read, :newsletter, newsletter:)
30
39
 
31
40
  email = NewsletterMailer.newsletter(current_user, newsletter, preview: true)
32
41
  Premailer::Rails::Hook.perform(email)
@@ -53,12 +62,12 @@ module Decidim
53
62
  end
54
63
 
55
64
  def edit
56
- enforce_permission_to :update, :newsletter, newsletter: newsletter
65
+ enforce_permission_to(:update, :newsletter, newsletter:)
57
66
  @form = form(NewsletterForm).from_model(content_block)
58
67
  end
59
68
 
60
69
  def update
61
- enforce_permission_to :update, :newsletter, newsletter: newsletter
70
+ enforce_permission_to(:update, :newsletter, newsletter:)
62
71
  @form = form(NewsletterForm).from_params(params)
63
72
  @form.images = images_block_context unless has_images_block_context?
64
73
 
@@ -77,7 +86,7 @@ module Decidim
77
86
  end
78
87
 
79
88
  def destroy
80
- enforce_permission_to :destroy, :newsletter, newsletter: newsletter
89
+ enforce_permission_to(:destroy, :newsletter, newsletter:)
81
90
 
82
91
  DestroyNewsletter.call(newsletter, current_user) do
83
92
  on(:already_sent) do
@@ -93,7 +102,7 @@ module Decidim
93
102
  end
94
103
 
95
104
  def select_recipients_to_deliver
96
- enforce_permission_to :update, :newsletter, newsletter: newsletter
105
+ enforce_permission_to(:update, :newsletter, newsletter:)
97
106
  @form = form(SelectiveNewsletterForm).from_model(newsletter)
98
107
  @form.send_to_all_users = current_user.admin?
99
108
  end
@@ -105,7 +114,7 @@ module Decidim
105
114
  end
106
115
 
107
116
  def deliver
108
- enforce_permission_to :update, :newsletter, newsletter: newsletter
117
+ enforce_permission_to(:update, :newsletter, newsletter:)
109
118
  @form = form(SelectiveNewsletterForm).from_params(params)
110
119
 
111
120
  DeliverNewsletter.call(newsletter, @form, current_user) do
@@ -32,7 +32,7 @@ module Decidim
32
32
  on(:ok) do |user|
33
33
  notice = I18n.t("officializations.create.success", scope: "decidim.admin")
34
34
 
35
- redirect_to officializations_path(q: { name_or_nickname_or_email_cont: user.name }), notice: notice
35
+ redirect_to officializations_path(q: { name_or_nickname_or_email_cont: user.name }), notice:
36
36
  end
37
37
  end
38
38
  end
@@ -44,13 +44,13 @@ module Decidim
44
44
  on(:ok) do
45
45
  notice = I18n.t("officializations.destroy.success", scope: "decidim.admin")
46
46
 
47
- redirect_to officializations_path(q: { name_or_nickname_or_email_cont: user.name }), notice: notice
47
+ redirect_to officializations_path(q: { name_or_nickname_or_email_cont: user.name }), notice:
48
48
  end
49
49
  end
50
50
  end
51
51
 
52
52
  def show_email
53
- enforce_permission_to :show_email, :user, user: user
53
+ enforce_permission_to(:show_email, :user, user:)
54
54
 
55
55
  Decidim.traceability.perform_action! :show_email, user, current_user
56
56
 
@@ -5,6 +5,9 @@ module Decidim
5
5
  # Controller that allows managing the appearance of the organization.
6
6
  class OrganizationAppearanceController < Decidim::Admin::ApplicationController
7
7
  layout "decidim/admin/settings"
8
+
9
+ add_breadcrumb_item_from_menu :admin_settings_menu
10
+
8
11
  helper Decidim::Admin::UploaderImageDimensionsHelper
9
12
 
10
13
  def edit
@@ -7,6 +7,8 @@ module Decidim
7
7
  class OrganizationController < Decidim::Admin::ApplicationController
8
8
  layout "decidim/admin/settings"
9
9
 
10
+ add_breadcrumb_item_from_menu :admin_settings_menu
11
+
10
12
  def edit
11
13
  enforce_permission_to :update, :organization, organization: current_organization
12
14
  @form = form(OrganizationForm).from_model(current_organization)
@@ -44,16 +46,13 @@ module Decidim
44
46
  respond_to do |format|
45
47
  format.json do
46
48
  if (term = params[:term].to_s).present?
49
+ query = relation.order(name: :asc)
47
50
  query = if term.start_with?("@")
48
- nickname = term.delete("@")
49
- relation.where("nickname ILIKE ?", "#{nickname}%")
50
- .order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("similarity(nickname, '#{nickname}') DESC")))
51
+ query.where("nickname ILIKE ?", "#{term.delete("@")}%")
51
52
  else
52
- relation.where("name ILIKE ?", "%#{term}%").or(
53
- relation.where("email ILIKE ?", "%#{term}%")
53
+ query.where("name ILIKE ?", "%#{term}%").or(
54
+ query.where("email ILIKE ?", "%#{term}%")
54
55
  )
55
- .order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("GREATEST(similarity(name, '#{term}'), similarity(email, '#{term}')) DESC")))
56
- .order(Arel.sql(ActiveRecord::Base.sanitize_sql_array("(similarity(name, '#{term}') + similarity(email, '#{term}')) / 2 DESC")))
57
56
  end
58
57
  render json: query.all.collect { |u| { value: u.id, label: "#{u.name} (@#{u.nickname})" } }
59
58
  else
@@ -5,6 +5,8 @@ module Decidim
5
5
  class OrganizationExternalDomainWhitelistController < Decidim::Admin::ApplicationController
6
6
  layout "decidim/admin/settings"
7
7
 
8
+ add_breadcrumb_item_from_menu :admin_settings_menu
9
+
8
10
  helper_method :blank_external_domain
9
11
 
10
12
  def edit
@@ -4,61 +4,32 @@ module Decidim
4
4
  module Admin
5
5
  # Controller that allows managing the organization homepage content blocks
6
6
  class OrganizationHomepageContentBlocksController < Decidim::Admin::ApplicationController
7
+ include Decidim::Admin::ContentBlocks::LandingPageContentBlocks
8
+
7
9
  layout "decidim/admin/settings"
8
10
 
9
11
  helper_method :content_block
10
12
 
11
- def edit
12
- enforce_permission_to :update, :organization, organization: current_organization
13
- @form = form(ContentBlockForm).from_model(content_block)
14
- end
15
-
16
- def update
17
- enforce_permission_to :update, :organization, organization: current_organization
18
- @form = form(ContentBlockForm).from_params(params)
19
-
20
- UpdateContentBlock.call(@form, content_block, :homepage) do
21
- on(:ok) do
22
- redirect_to edit_organization_homepage_path
23
- end
24
- on(:invalid) do
25
- edit # Sets the model to the view so that it can render the form
26
- render :edit
27
- end
28
- end
29
- end
30
-
31
13
  private
32
14
 
33
- def content_block
34
- @content_block ||= content_blocks.find_by(manifest_name: params[:id]) ||
35
- content_block_from_manifest
15
+ def content_block_scope
16
+ :homepage
36
17
  end
37
18
 
38
- def content_block_manifest
39
- @content_block_manifest = unused_content_block_manifests.find { |manifest| manifest.name.to_s == params[:id] }
19
+ def scoped_resource
20
+ nil
40
21
  end
41
22
 
42
- def content_blocks
43
- @content_blocks ||= Decidim::ContentBlock.for_scope(:homepage, organization: current_organization)
44
- end
45
-
46
- def used_content_block_manifests
47
- @used_content_block_manifests ||= content_blocks.map(&:manifest_name)
23
+ def enforce_permission_to_update_resource
24
+ enforce_permission_to :update, :organization, organization: current_organization
48
25
  end
49
26
 
50
- def unused_content_block_manifests
51
- @unused_content_block_manifests ||= Decidim.content_blocks.for(:homepage).reject do |manifest|
52
- used_content_block_manifests.include?(manifest.name.to_s)
53
- end
27
+ def edit_resource_landing_page_path
28
+ edit_organization_homepage_path
54
29
  end
55
30
 
56
- def content_block_from_manifest
57
- Decidim::ContentBlock.create!(
58
- organization: current_organization,
59
- scope_name: :homepage,
60
- manifest_name: params[:id]
61
- )
31
+ def resource_landing_page_content_block_path
32
+ organization_homepage_content_block_path(params[:id])
62
33
  end
63
34
  end
64
35
  end
@@ -4,52 +4,34 @@ module Decidim
4
4
  module Admin
5
5
  # Controller that allows managing the organization homepage
6
6
  class OrganizationHomepageController < Decidim::Admin::ApplicationController
7
- layout "decidim/admin/settings"
8
-
9
- helper_method :active_blocks, :inactive_blocks
10
-
11
- def edit
12
- enforce_permission_to :update, :organization, organization: current_organization
13
- end
7
+ include Decidim::Admin::ContentBlocks::LandingPage
14
8
 
15
- def update
16
- enforce_permission_to :update, :organization, organization: current_organization
17
- ReorderContentBlocks.call(current_organization, :homepage, params[:manifests]) do
18
- on(:ok) do
19
- head :ok
20
- end
21
- on(:invalid) do
22
- head :bad_request
23
- end
24
- end
25
- end
9
+ layout "decidim/admin/settings"
26
10
 
27
- private
11
+ add_breadcrumb_item_from_menu :admin_settings_menu
28
12
 
29
- def content_blocks
30
- @content_blocks ||= Decidim::ContentBlock.for_scope(:homepage, organization: current_organization)
13
+ def content_block_scope
14
+ :homepage
31
15
  end
32
16
 
33
- def active_blocks
34
- @active_blocks ||= content_blocks.published.where(manifest_name: Decidim.content_blocks.for(:homepage).map(&:name))
17
+ def scoped_resource
18
+ nil
35
19
  end
36
20
 
37
- def unpublished_blocks
38
- @unpublished_blocks ||= content_blocks.unpublished.where(manifest_name: Decidim.content_blocks.for(:homepage).map(&:name))
21
+ def enforce_permission_to_update_resource
22
+ enforce_permission_to :update, :organization, organization: current_organization
39
23
  end
40
24
 
41
- def inactive_blocks
42
- @inactive_blocks ||= unpublished_blocks + unused_manifests
25
+ def resource_sort_url
26
+ organization_homepage_path
43
27
  end
44
28
 
45
- def used_manifests
46
- @used_manifests ||= content_blocks.map(&:manifest_name)
29
+ def resource_create_url(manifest_name)
30
+ organization_homepage_content_blocks_path(manifest_name:)
47
31
  end
48
32
 
49
- def unused_manifests
50
- @unused_manifests ||= Decidim.content_blocks.for(:homepage).reject do |manifest|
51
- used_manifests.include?(manifest.name.to_s)
52
- end
33
+ def resource_content_block_cell
34
+ "decidim/admin/homepage_content_block"
53
35
  end
54
36
  end
55
37
  end
@@ -0,0 +1,119 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/concern"
4
+
5
+ module Decidim
6
+ module Admin
7
+ module ParticipatorySpace
8
+ class UserRoleController < Decidim::Admin::ApplicationController
9
+ include Decidim::Admin::Officializations::Filterable
10
+
11
+ helper_method :filtered_collection
12
+
13
+ def index
14
+ enforce_permission_to :index, authorization_scope
15
+ @user_roles = filtered_collection
16
+ end
17
+
18
+ def new
19
+ enforce_permission_to :create, authorization_scope
20
+ @form = resource_form.instance
21
+ end
22
+
23
+ def edit
24
+ @user_role = collection.find(params[:id])
25
+ enforce_permission_to :update, authorization_scope, user_role: @user_role
26
+ @form = resource_form.from_model(@user_role.user)
27
+ end
28
+
29
+ def create
30
+ enforce_permission_to :create, authorization_scope
31
+ @form = resource_form.from_params(params)
32
+
33
+ create_command.call(@form, current_participatory_space, event_class:, event:, role_class:) do
34
+ on(:ok) do
35
+ flash[:notice] = I18n.t("create.success", scope: i18n_scope)
36
+ redirect_to space_index_path
37
+ end
38
+
39
+ on(:invalid) do
40
+ flash[:alert] = I18n.t("create.error", scope: i18n_scope)
41
+ render :new
42
+ end
43
+ end
44
+ end
45
+
46
+ def update
47
+ @user_role = collection.find(params[:id])
48
+ enforce_permission_to :update, authorization_scope, user_role: @user_role
49
+ @form = resource_form.from_params(params)
50
+
51
+ update_command.call(@form, @user_role, event_class:, event:) do
52
+ on(:ok) do
53
+ flash[:notice] = I18n.t("update.success", scope: i18n_scope)
54
+ redirect_to space_index_path
55
+ end
56
+
57
+ on(:invalid) do
58
+ flash.now[:alert] = I18n.t("update.error", scope: i18n_scope)
59
+ render :edit
60
+ end
61
+ end
62
+ end
63
+
64
+ def destroy
65
+ @user_role = collection.find(params[:id])
66
+ enforce_permission_to :destroy, authorization_scope, user_role: @user_role
67
+
68
+ destroy_command.call(@user_role, current_user) do
69
+ on(:ok) do
70
+ flash[:notice] = I18n.t("destroy.success", scope: i18n_scope)
71
+ redirect_to space_index_path
72
+ end
73
+ end
74
+ end
75
+
76
+ def resend_invitation
77
+ @user_role = collection.find(params[:id])
78
+ enforce_permission_to :invite, authorization_scope, user_role: @user_role
79
+
80
+ InviteUserAgain.call(@user_role.user, "invite_admin") do
81
+ on(:ok) do
82
+ flash[:notice] = I18n.t("users.resend_invitation.success", scope: "decidim.admin")
83
+ end
84
+
85
+ on(:invalid) do
86
+ flash[:alert] = I18n.t("users.resend_invitation.error", scope: "decidim.admin")
87
+ end
88
+ end
89
+
90
+ redirect_to space_index_path
91
+ end
92
+
93
+ private
94
+
95
+ def event = raise NotImplementedError, "Event method must be implemented for #{self.class.name}"
96
+
97
+ def event_class = raise NotImplementedError, "Event class method must be implemented for #{self.class.name}"
98
+
99
+ def collection
100
+ @collection ||= role_class.joins(:user).for_space(current_participatory_space)
101
+ end
102
+
103
+ def destroy_command = Decidim::Admin::ParticipatorySpace::DestroyAdmin
104
+
105
+ def update_command = Decidim::Admin::ParticipatorySpace::UpdateAdmin
106
+
107
+ def create_command = Decidim::Admin::ParticipatorySpace::CreateAdmin
108
+
109
+ def search_field_predicate
110
+ :name_or_nickname_or_email_cont
111
+ end
112
+
113
+ def filters
114
+ [:invitation_accepted_at_present, :last_sign_in_at_present]
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
@@ -37,7 +37,7 @@ module Decidim
37
37
  def reminder_form_from_params(params)
38
38
  form(reminder_manifest.form_class).from_params(
39
39
  params,
40
- current_component: current_component
40
+ current_component:
41
41
  )
42
42
  end
43
43
 
@@ -16,7 +16,7 @@ module Decidim
16
16
  end
17
17
 
18
18
  def update
19
- @permissions_form = PermissionsForm.from_params(params).with_context(current_organization: current_organization)
19
+ @permissions_form = PermissionsForm.from_params(params).with_context(current_organization:)
20
20
 
21
21
  UpdateResourcePermissions.call(@permissions_form, resource) do
22
22
  on(:ok) do
@@ -5,7 +5,12 @@ module Decidim
5
5
  # Controller that allows managing scopes types at the admin panel.
6
6
  #
7
7
  class ScopeTypesController < Decidim::Admin::ApplicationController
8
+ include Decidim::Admin::Concerns::HasTabbedMenu
9
+
8
10
  layout "decidim/admin/settings"
11
+
12
+ add_breadcrumb_item_from_menu :admin_settings_menu
13
+
9
14
  helper_method :scope_types
10
15
 
11
16
  def index
@@ -35,12 +40,12 @@ module Decidim
35
40
  end
36
41
 
37
42
  def edit
38
- enforce_permission_to :update, :scope_type, scope_type: scope_type
43
+ enforce_permission_to(:update, :scope_type, scope_type:)
39
44
  @form = form(ScopeTypeForm).from_model(scope_type)
40
45
  end
41
46
 
42
47
  def update
43
- enforce_permission_to :update, :scope_type, scope_type: scope_type
48
+ enforce_permission_to(:update, :scope_type, scope_type:)
44
49
  @form = form(ScopeTypeForm).from_params(params)
45
50
 
46
51
  UpdateScopeType.call(scope_type, @form, current_user) do
@@ -57,7 +62,7 @@ module Decidim
57
62
  end
58
63
 
59
64
  def destroy
60
- enforce_permission_to :destroy, :scope_type, scope_type: scope_type
65
+ enforce_permission_to(:destroy, :scope_type, scope_type:)
61
66
 
62
67
  Decidim.traceability.perform_action!("delete", scope_type, current_user) do
63
68
  scope_type.destroy!
@@ -70,6 +75,8 @@ module Decidim
70
75
 
71
76
  private
72
77
 
78
+ def tab_menu_name = :admin_scopes_menu
79
+
73
80
  def scope_type
74
81
  @scope_type ||= scope_types.find(params[:id])
75
82
  end