decidim-admin 0.28.5 → 0.29.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (244) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +13 -0
  3. data/app/cells/decidim/admin/content_block_cell.rb +0 -1
  4. data/app/cells/decidim/admin/results_per_page/show.erb +2 -2
  5. data/app/cells/decidim/admin/results_per_page_cell.rb +0 -2
  6. data/app/commands/decidim/admin/block_user.rb +0 -1
  7. data/app/commands/decidim/admin/create_area.rb +4 -32
  8. data/app/commands/decidim/admin/create_area_type.rb +4 -33
  9. data/app/commands/decidim/admin/create_attachment.rb +5 -4
  10. data/app/commands/decidim/admin/create_attachment_collection.rb +3 -3
  11. data/app/commands/decidim/admin/create_category.rb +4 -37
  12. data/app/commands/decidim/admin/create_component.rb +7 -40
  13. data/app/commands/decidim/admin/create_newsletter.rb +11 -29
  14. data/app/commands/decidim/admin/create_participatory_space_private_user.rb +4 -4
  15. data/app/commands/decidim/admin/create_scope.rb +15 -32
  16. data/app/commands/decidim/admin/create_scope_type.rb +3 -32
  17. data/app/commands/decidim/admin/create_static_page.rb +6 -47
  18. data/app/commands/decidim/admin/create_static_page_topic.rb +4 -26
  19. data/app/commands/decidim/admin/deliver_newsletter.rb +4 -5
  20. data/app/commands/decidim/admin/destroy_area.rb +2 -25
  21. data/app/commands/decidim/admin/destroy_category.rb +4 -29
  22. data/app/commands/decidim/admin/destroy_component.rb +5 -43
  23. data/app/commands/decidim/admin/destroy_newsletter.rb +2 -30
  24. data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +5 -32
  25. data/app/commands/decidim/admin/destroy_scope.rb +6 -33
  26. data/app/commands/decidim/admin/officialize_user.rb +1 -1
  27. data/app/commands/decidim/admin/participatory_space/create_admin.rb +4 -4
  28. data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +5 -4
  29. data/app/commands/decidim/admin/promote_managed_user.rb +4 -5
  30. data/app/commands/decidim/admin/unofficialize_user.rb +1 -1
  31. data/app/commands/decidim/admin/update_area.rb +2 -41
  32. data/app/commands/decidim/admin/update_area_type.rb +2 -42
  33. data/app/commands/decidim/admin/update_attachment.rb +10 -7
  34. data/app/commands/decidim/admin/update_attachment_collection.rb +3 -3
  35. data/app/commands/decidim/admin/update_category.rb +2 -45
  36. data/app/commands/decidim/admin/update_component.rb +4 -5
  37. data/app/commands/decidim/admin/update_component_permissions.rb +3 -3
  38. data/app/commands/decidim/admin/{update_external_domain_whitelist.rb → update_external_domain_allowlist.rb} +6 -5
  39. data/app/commands/decidim/admin/update_help_sections.rb +6 -3
  40. data/app/commands/decidim/admin/update_newsletter.rb +8 -8
  41. data/app/commands/decidim/admin/update_organization.rb +9 -53
  42. data/app/commands/decidim/admin/update_organization_appearance.rb +10 -81
  43. data/app/commands/decidim/admin/update_scope.rb +7 -40
  44. data/app/commands/decidim/admin/update_scope_type.rb +2 -42
  45. data/app/commands/decidim/admin/update_static_page.rb +5 -46
  46. data/app/commands/decidim/admin/update_static_page_topic.rb +2 -43
  47. data/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
  48. data/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb +2 -2
  49. data/app/controllers/concerns/decidim/admin/filterable.rb +79 -4
  50. data/app/controllers/concerns/decidim/admin/global_moderation_context.rb +1 -1
  51. data/app/controllers/concerns/decidim/admin/needs_admin_tos_accepted.rb +0 -7
  52. data/app/controllers/concerns/decidim/admin/paginable.rb +20 -0
  53. data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +1 -1
  54. data/app/controllers/decidim/admin/application_controller.rb +2 -1
  55. data/app/controllers/decidim/admin/area_types_controller.rb +8 -9
  56. data/app/controllers/decidim/admin/areas_controller.rb +1 -1
  57. data/app/controllers/decidim/admin/authorization_workflows_controller.rb +1 -1
  58. data/app/controllers/decidim/admin/block_user_controller.rb +1 -1
  59. data/app/controllers/decidim/admin/categories_controller.rb +2 -2
  60. data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
  61. data/app/controllers/decidim/admin/components_controller.rb +2 -2
  62. data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +2 -2
  63. data/app/controllers/decidim/admin/concerns/has_attachments.rb +2 -2
  64. data/app/controllers/decidim/admin/concerns/has_private_users.rb +1 -1
  65. data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +1 -1
  66. data/app/controllers/decidim/admin/conflicts_controller.rb +6 -14
  67. data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
  68. data/app/controllers/decidim/admin/impersonations_controller.rb +0 -1
  69. data/app/controllers/decidim/admin/managed_users/promotions_controller.rb +1 -1
  70. data/app/controllers/decidim/admin/moderations/reports_controller.rb +4 -4
  71. data/app/controllers/decidim/admin/moderations_controller.rb +7 -7
  72. data/app/controllers/decidim/admin/newsletter_templates_controller.rb +1 -1
  73. data/app/controllers/decidim/admin/newsletters_controller.rb +6 -7
  74. data/app/controllers/decidim/admin/organization_appearance_controller.rb +1 -1
  75. data/app/controllers/decidim/admin/organization_controller.rb +1 -1
  76. data/app/controllers/decidim/admin/{organization_external_domain_whitelist_controller.rb → organization_external_domain_allowlist_controller.rb} +7 -7
  77. data/app/controllers/decidim/admin/scope_types_controller.rb +7 -8
  78. data/app/controllers/decidim/admin/scopes_controller.rb +1 -1
  79. data/app/controllers/decidim/admin/share_tokens_controller.rb +1 -1
  80. data/app/controllers/decidim/admin/static_page_topics_controller.rb +2 -2
  81. data/app/controllers/decidim/admin/static_pages_controller.rb +2 -2
  82. data/app/forms/decidim/admin/attachment_form.rb +7 -1
  83. data/app/forms/decidim/admin/help_section_form.rb +1 -1
  84. data/app/forms/decidim/admin/impersonate_user_form.rb +0 -5
  85. data/app/forms/decidim/admin/organization_appearance_form.rb +2 -5
  86. data/app/forms/decidim/admin/{organization_external_domain_whitelist_form.rb → organization_external_domain_allowlist_form.rb} +3 -3
  87. data/app/forms/decidim/admin/organization_form.rb +4 -4
  88. data/app/forms/decidim/admin/static_page_form.rb +1 -2
  89. data/app/forms/decidim/admin/transfer_user_form.rb +0 -15
  90. data/app/helpers/decidim/admin/application_helper.rb +0 -13
  91. data/app/helpers/decidim/admin/filterable_helper.rb +19 -3
  92. data/app/helpers/decidim/admin/moderations/reports_helper.rb +3 -1
  93. data/app/helpers/decidim/admin/newsletters_helper.rb +3 -3
  94. data/app/helpers/decidim/admin/paginable/per_page_helper.rb +22 -0
  95. data/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb +2 -2
  96. data/app/packs/entrypoints/decidim_admin.js +4 -1
  97. data/app/packs/src/decidim/admin/application.js +19 -15
  98. data/app/packs/src/decidim/admin/css_preview.js +39 -0
  99. data/app/packs/src/decidim/admin/form.js +18 -1
  100. data/app/packs/src/decidim/admin/newsletters.js +9 -18
  101. data/app/packs/src/decidim/admin/participatory_space_search.js +1 -1
  102. data/app/packs/src/decidim/admin/proposal_infinite_edit.js +2 -2
  103. data/app/packs/src/decidim/admin/sync_radio_buttons.js +27 -0
  104. data/app/packs/src/decidim/admin/text_copy.js +19 -0
  105. data/app/packs/stylesheets/decidim/admin/_cards.scss +1 -1
  106. data/app/packs/stylesheets/decidim/admin/_datepicker.scss +62 -0
  107. data/app/packs/stylesheets/decidim/admin/_item_edit.scss +1 -1
  108. data/app/packs/stylesheets/decidim/admin/_item_show.scss +8 -0
  109. data/app/packs/stylesheets/decidim/admin/_moderations.scss +0 -8
  110. data/app/packs/stylesheets/decidim/admin/_proposal_status.scss +5 -0
  111. data/app/packs/stylesheets/decidim/admin/application.scss +2 -0
  112. data/app/permissions/decidim/admin/permissions.rb +2 -2
  113. data/app/queries/decidim/admin/newsletter_recipients.rb +5 -9
  114. data/app/queries/decidim/admin/user_filter.rb +4 -4
  115. data/app/queries/decidim/admin/user_groups_evaluation.rb +1 -1
  116. data/app/views/decidim/admin/attachment_collections/index.html.erb +1 -1
  117. data/app/views/decidim/admin/attachments/_form.html.erb +21 -2
  118. data/app/views/decidim/admin/attachments/index.html.erb +2 -2
  119. data/app/views/decidim/admin/authorization_workflows/index.html.erb +26 -8
  120. data/app/views/decidim/admin/block_user/new.html.erb +1 -1
  121. data/app/views/decidim/admin/categories/index.html.erb +2 -2
  122. data/app/views/decidim/admin/components/_form.html.erb +1 -1
  123. data/app/views/decidim/admin/components/index.html.erb +1 -5
  124. data/app/views/decidim/admin/conflicts/edit.html.erb +11 -21
  125. data/app/views/decidim/admin/conflicts/index.html.erb +6 -29
  126. data/app/views/decidim/admin/dashboard/_pending_moderations.html.erb +1 -1
  127. data/app/views/decidim/admin/dashboard/show.html.erb +1 -1
  128. data/app/views/decidim/admin/exports/_dropdown.html.erb +6 -6
  129. data/app/views/decidim/admin/impersonatable_users/index.html.erb +3 -3
  130. data/app/views/decidim/admin/imports/_dropdown.html.erb +5 -7
  131. data/app/views/decidim/admin/imports/new.html.erb +6 -7
  132. data/app/views/decidim/admin/logs/_filters.html.erb +3 -3
  133. data/app/views/decidim/admin/managed_users/promotions/new.html.erb +1 -1
  134. data/app/views/decidim/admin/moderated_users/index.html.erb +4 -4
  135. data/app/views/decidim/admin/moderations/index.html.erb +5 -5
  136. data/app/views/decidim/admin/moderations/reports/index.html.erb +6 -6
  137. data/app/views/decidim/admin/moderations/reports/show.html.erb +4 -4
  138. data/app/views/decidim/admin/newsletter_templates/index.html.erb +3 -2
  139. data/app/views/decidim/admin/newsletter_templates/show.html.erb +7 -7
  140. data/app/views/decidim/admin/newsletters/index.html.erb +1 -1
  141. data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +6 -7
  142. data/app/views/decidim/admin/newsletters/show.html.erb +1 -1
  143. data/app/views/decidim/admin/organization/_form.html.erb +3 -3
  144. data/app/views/decidim/admin/organization_appearance/form/_colors.html.erb +0 -3
  145. data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -5
  146. data/app/views/decidim/admin/organization_appearance/form/_minimap.html.erb +3 -3
  147. data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/_external_domain.html.erb +4 -4
  148. data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/_form.html.erb +2 -2
  149. data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/edit.html.erb +2 -2
  150. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +1 -1
  151. data/app/views/decidim/admin/participatory_space_private_users_csv_imports/new.html.erb +1 -1
  152. data/app/views/decidim/admin/share_tokens/_share_tokens.html.erb +1 -1
  153. data/app/views/decidim/admin/shared/_adjacent_navigation.html.erb +30 -0
  154. data/app/views/decidim/admin/shared/_admin_confirm_modal.html.erb +7 -7
  155. data/app/views/decidim/admin/shared/_filters.html.erb +1 -1
  156. data/app/views/decidim/admin/shared/_gallery.html.erb +1 -1
  157. data/app/views/decidim/admin/shared/landing_page/_content_blocks.html.erb +2 -2
  158. data/app/views/decidim/admin/shared/landing_page_content_blocks/edit.html.erb +1 -1
  159. data/app/views/decidim/admin/static_page_topics/index.html.erb +1 -1
  160. data/app/views/decidim/admin/static_pages/_form.html.erb +0 -4
  161. data/app/views/decidim/admin/users_statistics/_users_count.html.erb +2 -2
  162. data/app/views/layouts/decidim/admin/_admin_timeout_modal.html.erb +2 -2
  163. data/app/views/layouts/decidim/admin/_application.html.erb +4 -4
  164. data/app/views/layouts/decidim/admin/_callouts_full.html.erb +1 -1
  165. data/app/views/layouts/decidim/admin/_js_configuration.html.erb +3 -1
  166. data/app/views/layouts/decidim/admin/_title_bar.html.erb +2 -2
  167. data/app/views/layouts/decidim/admin/_title_bar_responsive.html.erb +2 -2
  168. data/config/locales/ar.yml +1 -54
  169. data/config/locales/bg.yml +15 -12
  170. data/config/locales/ca.yml +18 -15
  171. data/config/locales/cs.yml +15 -17
  172. data/config/locales/de.yml +18 -15
  173. data/config/locales/el.yml +0 -11
  174. data/config/locales/en.yml +15 -12
  175. data/config/locales/es-MX.yml +17 -14
  176. data/config/locales/es-PY.yml +17 -14
  177. data/config/locales/es.yml +19 -16
  178. data/config/locales/eu.yml +145 -154
  179. data/config/locales/fi-plain.yml +18 -15
  180. data/config/locales/fi.yml +39 -36
  181. data/config/locales/fr-CA.yml +15 -12
  182. data/config/locales/fr.yml +13 -10
  183. data/config/locales/ga-IE.yml +0 -3
  184. data/config/locales/gl.yml +2 -6
  185. data/config/locales/hu.yml +9 -10
  186. data/config/locales/id-ID.yml +0 -7
  187. data/config/locales/is-IS.yml +0 -15
  188. data/config/locales/it.yml +3 -10
  189. data/config/locales/ja.yml +20 -17
  190. data/config/locales/kaa.yml +3 -3
  191. data/config/locales/ko.yml +1 -6
  192. data/config/locales/lb.yml +4 -11
  193. data/config/locales/lt.yml +0 -12
  194. data/config/locales/lv.yml +2 -6
  195. data/config/locales/nl.yml +1 -8
  196. data/config/locales/no.yml +1 -8
  197. data/config/locales/pl.yml +15 -10
  198. data/config/locales/pt-BR.yml +8 -12
  199. data/config/locales/pt.yml +0 -11
  200. data/config/locales/ro-RO.yml +5 -22
  201. data/config/locales/ru.yml +1 -6
  202. data/config/locales/sk.yml +2 -6
  203. data/config/locales/sl.yml +2 -0
  204. data/config/locales/sq-AL.yml +3 -3
  205. data/config/locales/sr-CS.yml +3 -6
  206. data/config/locales/sv.yml +209 -357
  207. data/config/locales/th-TH.yml +0 -13
  208. data/config/locales/tr-TR.yml +2 -6
  209. data/config/locales/uk.yml +0 -6
  210. data/config/locales/zh-CN.yml +6 -3
  211. data/config/locales/zh-TW.yml +0 -11
  212. data/config/routes.rb +2 -2
  213. data/decidim-admin.gemspec +2 -2
  214. data/lib/decidim/admin/engine.rb +0 -1
  215. data/lib/decidim/admin/import/creator.rb +1 -1
  216. data/lib/decidim/admin/import/importer_factory.rb +2 -2
  217. data/lib/decidim/admin/menu.rb +4 -4
  218. data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +3 -2
  219. data/lib/decidim/admin/test/commands/create_category_examples.rb +4 -2
  220. data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +3 -2
  221. data/lib/decidim/admin/test/commands/update_category_examples.rb +3 -2
  222. data/lib/decidim/admin/test/filterable_examples.rb +5 -3
  223. data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +5 -5
  224. data/lib/decidim/admin/test/invite_participatory_space_admins_shared_examples.rb +1 -1
  225. data/lib/decidim/admin/test/invite_participatory_space_users_shared_context.rb +0 -1
  226. data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +12 -12
  227. data/lib/decidim/admin/test/manage_attachments_examples.rb +52 -28
  228. data/lib/decidim/admin/test/manage_categories_examples.rb +13 -13
  229. data/lib/decidim/admin/test/manage_component_permissions_examples.rb +5 -5
  230. data/lib/decidim/admin/test/manage_hide_content_examples.rb +4 -4
  231. data/lib/decidim/admin/test/manage_moderations_examples.rb +21 -21
  232. data/lib/decidim/admin/test/manage_paginated_collection_examples.rb +5 -5
  233. data/lib/decidim/admin/test/manage_participatory_space_publications_examples.rb +2 -2
  234. data/lib/decidim/admin/version.rb +1 -1
  235. data/lib/decidim/admin.rb +15 -0
  236. metadata +28 -27
  237. data/app/commands/decidim/admin/destroy_share_token.rb +0 -46
  238. data/app/commands/decidim/admin/destroy_static_page.rb +0 -40
  239. data/app/commands/decidim/admin/destroy_static_page_topic.rb +0 -40
  240. data/app/controllers/concerns/decidim/admin/verification_conflicts/filterable.rb +0 -31
  241. data/app/views/layouts/decidim/admin/login.html.erb +0 -19
  242. data/config/locales/bn-BD.yml +0 -1
  243. data/config/locales/bs-BA.yml +0 -528
  244. /data/app/packs/src/decidim/admin/{external_domain_whitelist.js → external_domain_allowlist.js} +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Admin
5
- class OrganizationExternalDomainWhitelistController < Decidim::Admin::ApplicationController
5
+ class OrganizationExternalDomainAllowlistController < Decidim::Admin::ApplicationController
6
6
  layout "decidim/admin/settings"
7
7
 
8
8
  add_breadcrumb_item_from_menu :admin_settings_menu
@@ -11,20 +11,20 @@ module Decidim
11
11
 
12
12
  def edit
13
13
  enforce_permission_to :update, :organization, organization: current_organization
14
- @form = form(OrganizationExternalDomainWhitelistForm).from_model(current_organization)
14
+ @form = form(OrganizationExternalDomainAllowlistForm).from_model(current_organization)
15
15
  end
16
16
 
17
17
  def update
18
18
  enforce_permission_to :update, :organization, organization: current_organization
19
- @form = form(OrganizationExternalDomainWhitelistForm).from_params(params)
19
+ @form = form(OrganizationExternalDomainAllowlistForm).from_params(params)
20
20
 
21
- UpdateExternalDomainWhitelist.call(@form, current_organization, current_user) do
21
+ UpdateExternalDomainAllowlist.call(@form, current_organization, current_user) do
22
22
  on(:ok) do
23
- flash[:notice] = t("domain_whitelist.update.success", scope: "decidim.admin")
24
- redirect_to edit_organization_external_domain_whitelist_path
23
+ flash[:notice] = t("domain_allowlist.update.success", scope: "decidim.admin")
24
+ redirect_to edit_organization_external_domain_allowlist_path
25
25
  end
26
26
  on(:invalid) do
27
- flash[:notice] = t("domain_whitelist.update.error", scope: "decidim.admin")
27
+ flash[:notice] = t("domain_allowlist.update.error", scope: "decidim.admin")
28
28
  render action: "edit"
29
29
  end
30
30
  end
@@ -26,7 +26,7 @@ module Decidim
26
26
  enforce_permission_to :create, :scope_type
27
27
  @form = form(ScopeTypeForm).from_params(params)
28
28
 
29
- CreateScopeType.call(@form, current_user) do
29
+ CreateScopeType.call(@form) do
30
30
  on(:ok) do
31
31
  flash[:notice] = I18n.t("scope_types.create.success", scope: "decidim.admin")
32
32
  redirect_to scope_types_path
@@ -48,7 +48,7 @@ module Decidim
48
48
  enforce_permission_to(:update, :scope_type, scope_type:)
49
49
  @form = form(ScopeTypeForm).from_params(params)
50
50
 
51
- UpdateScopeType.call(scope_type, @form, current_user) do
51
+ UpdateScopeType.call(@form, scope_type) do
52
52
  on(:ok) do
53
53
  flash[:notice] = I18n.t("scope_types.update.success", scope: "decidim.admin")
54
54
  redirect_to scope_types_path
@@ -64,13 +64,12 @@ module Decidim
64
64
  def destroy
65
65
  enforce_permission_to(:destroy, :scope_type, scope_type:)
66
66
 
67
- Decidim.traceability.perform_action!("delete", scope_type, current_user) do
68
- scope_type.destroy!
67
+ Decidim::Commands::DestroyResource.call(scope_type, current_user) do
68
+ on(:ok) do
69
+ flash[:notice] = I18n.t("scope_types.destroy.success", scope: "decidim.admin")
70
+ redirect_to scope_types_path
71
+ end
69
72
  end
70
-
71
- flash[:notice] = I18n.t("scope_types.destroy.success", scope: "decidim.admin")
72
-
73
- redirect_to scope_types_path
74
73
  end
75
74
 
76
75
  private
@@ -49,7 +49,7 @@ module Decidim
49
49
  enforce_permission_to(:update, :scope, scope:)
50
50
  @form = form(ScopeForm).from_params(params)
51
51
 
52
- UpdateScope.call(scope, @form) do
52
+ UpdateScope.call(@form, scope) do
53
53
  on(:ok) do
54
54
  flash[:notice] = I18n.t("scopes.update.success", scope: "decidim.admin")
55
55
  redirect_to current_scopes_path
@@ -6,7 +6,7 @@ module Decidim
6
6
  def destroy
7
7
  enforce_permission_to(:destroy, :share_token, share_token:)
8
8
 
9
- DestroyShareToken.call(share_token, current_user) do
9
+ Decidim::Commands::DestroyResource.call(share_token, current_user) do
10
10
  on(:ok) do
11
11
  flash[:notice] = I18n.t("share_tokens.destroy.success", scope: "decidim.admin")
12
12
  end
@@ -44,7 +44,7 @@ module Decidim
44
44
  enforce_permission_to :update, :static_page_topic, static_page_topic: topic
45
45
  @form = form(StaticPageTopicForm).from_params(params["static_page_topic"])
46
46
 
47
- UpdateStaticPageTopic.call(topic, @form) do
47
+ UpdateStaticPageTopic.call(@form, topic) do
48
48
  on(:ok) do
49
49
  flash[:notice] = I18n.t("static_page_topics.update.success", scope: "decidim.admin")
50
50
  redirect_to static_page_topics_path
@@ -60,7 +60,7 @@ module Decidim
60
60
  def destroy
61
61
  enforce_permission_to :destroy, :static_page_topic, static_page_topic: topic
62
62
 
63
- DestroyStaticPageTopic.call(topic, current_user) do
63
+ Decidim::Commands::DestroyResource.call(topic, current_user) do
64
64
  on(:ok) do
65
65
  flash[:notice] = I18n.t("static_page_topics.destroy.success", scope: "decidim.admin")
66
66
  redirect_to static_page_topics_path
@@ -77,7 +77,7 @@ module Decidim
77
77
  enforce_permission_to :update, :static_page, static_page: page
78
78
  @form = form(StaticPageForm).from_params(form_params)
79
79
 
80
- UpdateStaticPage.call(page, @form) do
80
+ UpdateStaticPage.call(@form, page) do
81
81
  on(:ok) do
82
82
  flash[:notice] = I18n.t("static_pages.update.success", scope: "decidim.admin")
83
83
  redirect_to static_pages_path
@@ -93,7 +93,7 @@ module Decidim
93
93
  def destroy
94
94
  enforce_permission_to :destroy, :static_page, static_page: page
95
95
 
96
- DestroyStaticPage.call(page, current_user) do
96
+ Decidim::Commands::DestroyResource.call(page, current_user) do
97
97
  on(:ok) do
98
98
  flash[:notice] = I18n.t("static_pages.destroy.success", scope: "decidim.admin")
99
99
  redirect_to static_pages_path
@@ -12,10 +12,12 @@ module Decidim
12
12
  translatable_attribute :description, String
13
13
  attribute :weight, Integer, default: 0
14
14
  attribute :attachment_collection_id, Integer
15
+ attribute :link, String
15
16
 
16
17
  mimic :attachment
17
18
 
18
- validates :file, presence: true, unless: :persisted?
19
+ validates :file, presence: true, unless: :persisted_or_link?
20
+ validates :link, url: true
19
21
  validates :file, passthru: { to: Decidim::Attachment }
20
22
  validates :title, :description, translatable_presence: true
21
23
  validates :attachment_collection, presence: true, if: ->(form) { form.attachment_collection_id.present? }
@@ -25,6 +27,10 @@ module Decidim
25
27
 
26
28
  alias organization current_organization
27
29
 
30
+ def persisted_or_link?
31
+ persisted? || link.present?
32
+ end
33
+
28
34
  def attachment_collections
29
35
  @attachment_collections ||= attached_to.attachment_collections
30
36
  end
@@ -9,7 +9,7 @@ module Decidim
9
9
  include TranslationsHelper
10
10
 
11
11
  attribute :id, String
12
- translatable_attribute :content, Decidim::Attributes::RichText
12
+ translatable_attribute :content, String
13
13
 
14
14
  def name
15
15
  multi_translation("activerecord.models.#{manifest.model_class_name.underscore}.other")
@@ -14,7 +14,6 @@ module Decidim
14
14
  attribute :handler_name, String
15
15
 
16
16
  validates :user, presence: true
17
- validates :name, presence: true, unless: :persisted_user?
18
17
  validates :reason, presence: true, unless: :managed_user?
19
18
 
20
19
  private
@@ -22,10 +21,6 @@ module Decidim
22
21
  def managed_user?
23
22
  user && user.managed?
24
23
  end
25
-
26
- def persisted_user?
27
- user&.persisted?
28
- end
29
24
  end
30
25
  end
31
26
  end
@@ -30,14 +30,11 @@ module Decidim
30
30
  attribute :primary_color, String
31
31
  attribute :secondary_color, String
32
32
  attribute :tertiary_color, String
33
- attribute :success_color, String
34
- attribute :warning_color, String
35
- attribute :alert_color, String
36
33
 
37
34
  translatable_attribute :cta_button_text, String
38
- translatable_attribute :description, Decidim::Attributes::RichText
35
+ translatable_attribute :description, String
39
36
  translatable_attribute :highlighted_content_banner_title, String
40
- translatable_attribute :highlighted_content_banner_short_description, Decidim::Attributes::RichText
37
+ translatable_attribute :highlighted_content_banner_short_description, String
41
38
  translatable_attribute :highlighted_content_banner_action_title, String
42
39
  translatable_attribute :highlighted_content_banner_action_subtitle, String
43
40
  translatable_attribute :omnipresent_banner_title, String
@@ -2,20 +2,20 @@
2
2
 
3
3
  module Decidim
4
4
  module Admin
5
- class OrganizationExternalDomainWhitelistForm < Form
5
+ class OrganizationExternalDomainAllowlistForm < Form
6
6
  attribute :external_domains, Array[Decidim::Admin::ExternalDomainForm]
7
7
 
8
8
  validate :external_domains_validator
9
9
 
10
10
  def map_model(model)
11
- self.external_domains = model.external_domain_whitelist.map do |external_domain|
11
+ self.external_domains = model.external_domain_allowlist.map do |external_domain|
12
12
  ExternalDomainForm.new(value: external_domain)
13
13
  end
14
14
  end
15
15
 
16
16
  def external_domains_validator
17
17
  @external_domains_validator ||= external_domains.reject(&:deleted).each do |domain|
18
- errors.add(:external_domains, I18n.t("decidim.admin.domain_whitelist.form.domain_too_short")) if domain.value.length <= 3
18
+ errors.add(:external_domains, I18n.t("decidim.admin.domain_allowlist.form.domain_too_short")) if domain.value.length <= 3
19
19
  end.map(&:value).uniq
20
20
  end
21
21
  end
@@ -10,7 +10,7 @@ module Decidim
10
10
 
11
11
  mimic :organization
12
12
 
13
- attribute :name, String
13
+ translatable_attribute :name, String
14
14
  attribute :reference_prefix, String
15
15
  attribute :time_zone, String
16
16
  attribute :twitter_handler, String
@@ -31,13 +31,13 @@ module Decidim
31
31
  attribute :customize_welcome_notification, Boolean
32
32
 
33
33
  translatable_attribute :welcome_notification_subject, String
34
- translatable_attribute :welcome_notification_body, Decidim::Attributes::RichText
34
+ translatable_attribute :welcome_notification_body, String
35
35
 
36
- translatable_attribute :admin_terms_of_service_body, Decidim::Attributes::RichText
36
+ translatable_attribute :admin_terms_of_service_body, String
37
37
 
38
38
  validates :welcome_notification_subject, :welcome_notification_body, translatable_presence: true, if: proc { |form| form.customize_welcome_notification }
39
39
 
40
- validates :name, presence: true
40
+ validates :name, translatable_presence: true
41
41
  validates :time_zone, presence: true
42
42
  validates :time_zone, time_zone: true
43
43
  validates :default_locale, :reference_prefix, presence: true
@@ -9,9 +9,8 @@ module Decidim
9
9
  attribute :slug, String
10
10
  validates :title, translatable_presence: true
11
11
  translatable_attribute :title, String
12
- translatable_attribute :content, Decidim::Attributes::RichText
12
+ translatable_attribute :content, String
13
13
  attribute :changed_notably, Boolean
14
- attribute :show_in_footer, Boolean
15
14
  attribute :allow_public_access, Boolean
16
15
  attribute :weight, Integer
17
16
  attribute :topic_id, Integer
@@ -14,21 +14,6 @@ module Decidim
14
14
 
15
15
  validates :current_user, presence: true
16
16
  validates :conflict, presence: true
17
- validates :email, presence: true
18
- validate :unique_email
19
-
20
- private
21
-
22
- def unique_email
23
- return if conflict.blank?
24
- return true if Decidim::UserBaseEntity.where(
25
- organization: context.current_organization,
26
- email:
27
- ).where.not(id: [conflict.current_user.id, conflict.managed_user_id]).empty?
28
-
29
- errors.add :email, :taken
30
- false
31
- end
32
17
  end
33
18
  end
34
19
  end
@@ -16,19 +16,6 @@ module Decidim
16
16
  include Decidim::Admin::ResourceScopeHelper
17
17
  include Decidim::Admin::SearchFormHelper
18
18
 
19
- # Public: Overwrites the `cell` helper method to automatically set some
20
- # common context.
21
- #
22
- # name - the name of the cell to render
23
- # model - the cell model
24
- # options - a Hash with options
25
- #
26
- # Renders the cell contents.
27
- def cell(name, model, options = {}, &)
28
- options = { context: { view_context: self, current_user: } }.deep_merge(options)
29
- super
30
- end
31
-
32
19
  def participatory_space_active_link?(component)
33
20
  endpoints = component.manifest.admin_engine.try(:participatory_space_endpoints)
34
21
  endpoints && is_active_link?(decidim_admin_participatory_processes.components_path(current_participatory_space), %r{/\d+/manage/(#{endpoints.join("|")})\b})
@@ -32,7 +32,7 @@ module Decidim
32
32
  links.index_with { nil }
33
33
  end
34
34
 
35
- # To be overriden. Useful for adding links that do not match with the filter.
35
+ # To be overridden. Useful for adding links that do not match with the filter.
36
36
  # Must return an Array.
37
37
  def extra_dropdown_submenu_options_items(_filter, _i18n_scope)
38
38
  []
@@ -98,9 +98,14 @@ module Decidim
98
98
  end
99
99
 
100
100
  def applied_filters_tags(i18n_ctx)
101
- ransack_params.slice(*filters).map do |filter, value|
101
+ tags = ransack_params.slice(*filters).map do |filter, value|
102
102
  applied_filter_tag(filter, value, filterable_i18n_scope_from_ctx(i18n_ctx))
103
- end.join.html_safe
103
+ end
104
+ return if tags.blank?
105
+
106
+ tags << remove_all_filters_tag if tags.count > 1
107
+
108
+ tags.join.html_safe
104
109
  end
105
110
 
106
111
  def applied_filter_tag(filter, value, i18n_scope)
@@ -111,6 +116,13 @@ module Decidim
111
116
  end
112
117
  end
113
118
 
119
+ def remove_all_filters_tag
120
+ link_to(url_for(blank_query_params), class: "label bg-transparent") do
121
+ concat t("decidim.admin.filters.remove_all")
122
+ concat icon("delete-bin-line", aria_label: t("decidim.admin.filters.remove_all"), role: "img")
123
+ end
124
+ end
125
+
114
126
  def remove_filter_icon_link(filter)
115
127
  icon_link_to(
116
128
  "delete-bin-line",
@@ -125,6 +137,10 @@ module Decidim
125
137
  i18n_scope += ".#{i18n_ctx}" if i18n_ctx
126
138
  i18n_scope
127
139
  end
140
+
141
+ def filtered_adjacent_paths(item, path_method)
142
+ adjacent_items(item).transform_values(&method(path_method))
143
+ end
128
144
  end
129
145
  end
130
146
  end
@@ -25,9 +25,11 @@ module Decidim
25
25
  when Decidim::Meetings::Meeting
26
26
  content_tag :li do
27
27
  link_to resource_locator(author).path, target: "_blank", rel: "noopener" do
28
- decidim_sanitize(translated_attribute(author.title))
28
+ decidim_sanitize_translated(author.title)
29
29
  end
30
30
  end
31
+ when Decidim::Organization
32
+ content_tag :li, organization_name(author)
31
33
  else
32
34
  content_tag(:li, author.name)
33
35
  end
@@ -65,7 +65,7 @@ module Decidim
65
65
 
66
66
  def sent_to_spaces(newsletter)
67
67
  html = "<p style='margin-bottom:0;'> "
68
- newsletter.sended_to_partipatory_spaces.try(:each) do |type|
68
+ newsletter.sent_to_participatory_spaces.try(:each) do |type|
69
69
  next if type["ids"].blank?
70
70
 
71
71
  html += t("index.segmented_to", scope: "decidim.admin.newsletters", subject: t("activerecord.models.decidim/#{type["manifest_name"].singularize}.other"))
@@ -74,7 +74,7 @@ module Decidim
74
74
  else
75
75
  Decidim.find_participatory_space_manifest(type["manifest_name"].to_sym)
76
76
  .participatory_spaces.call(current_organization).where(id: type["ids"]).each do |space|
77
- html += "<strong>#{decidim_html_escape(translated_attribute(space.title))}</strong>"
77
+ html += "<strong>#{decidim_escape_translated(space.title)}</strong>"
78
78
  end
79
79
  end
80
80
  html += "<br/>"
@@ -88,7 +88,7 @@ module Decidim
88
88
  concat t("index.segmented_to", scope: "decidim.admin.newsletters", subject: nil)
89
89
  if newsletter.sent_scopes.any?
90
90
  newsletter.sent_scopes.each do |scope|
91
- concat content_tag(:strong, decidim_html_escape(translated_attribute(scope.name)).to_s)
91
+ concat content_tag(:strong, decidim_escape_translated(scope.name).to_s)
92
92
  end
93
93
  else
94
94
  concat content_tag(:strong, t("index.no_scopes", scope: "decidim.admin.newsletters"))
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Admin
5
+ module Paginable
6
+ # This module includes helpers the :per_page cell's option
7
+ module PerPageHelper
8
+ def per_page_options
9
+ OpenStruct.new(
10
+ per_page:,
11
+ per_page_range: Decidim::Admin.per_page_range
12
+ )
13
+ end
14
+
15
+ # Renders the pagination dropdown menu in the admin panel.
16
+ def admin_filters_pagination
17
+ cell("decidim/admin/results_per_page", per_page_options)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -17,10 +17,10 @@ module Decidim
17
17
  private_user_form = ParticipatorySpacePrivateUserForm.from_params(params, privatable_to:)
18
18
  .with_context(
19
19
  current_user:,
20
- current_particiaptory_space: privatable_to
20
+ current_participatory_space: privatable_to
21
21
  )
22
22
 
23
- Decidim::Admin::CreateParticipatorySpacePrivateUser.call(private_user_form, current_user, privatable_to, via_csv: true)
23
+ Decidim::Admin::CreateParticipatorySpacePrivateUser.call(private_user_form, privatable_to, via_csv: true)
24
24
  end
25
25
  end
26
26
  end
@@ -8,7 +8,7 @@ import "src/decidim/admin/resources_permissions"
8
8
  import "src/decidim/admin/welcome_notification"
9
9
  import "src/decidim/admin/newsletters"
10
10
  import "src/decidim/admin/form"
11
- import "src/decidim/admin/external_domain_whitelist"
11
+ import "src/decidim/admin/external_domain_allowlist"
12
12
  import "src/decidim/admin/draggable-list"
13
13
  import "src/decidim/admin/sortable"
14
14
  import "src/decidim/admin/moderations"
@@ -17,6 +17,9 @@ import "src/decidim/slug_form"
17
17
  import "src/decidim/admin/admin_autocomplete"
18
18
  import "src/decidim/admin/triadic_color_picker"
19
19
  import "src/decidim/admin/participatory_space_search"
20
+ import "src/decidim/admin/css_preview"
21
+ import "src/decidim/admin/sync_radio_buttons"
22
+ import "src/decidim/admin/text_copy"
20
23
 
21
24
  // CSS
22
25
  import "entrypoints/decidim_admin.scss";
@@ -1,15 +1,15 @@
1
1
  /* eslint-disable no-invalid-this */
2
2
 
3
- import toggleNav from "src/decidim/admin/toggle_nav"
4
- import createSortList from "src/decidim/admin/sort_list.component"
5
- import FormFilterComponent from "src/decidim/form_filter"
6
- import Configuration from "src/decidim/configuration"
7
- import InputCharacterCounter from "src/decidim/input_character_counter"
8
- import managedUsersForm from "src/decidim/admin/managed_users"
3
+ import toggleNav from "src/decidim/admin/toggle_nav";
4
+ import createSortList from "src/decidim/admin/sort_list.component";
5
+ import FormFilterComponent from "src/decidim/form_filter";
6
+ import Configuration from "src/decidim/configuration";
7
+ import InputCharacterCounter from "src/decidim/input_character_counter";
8
+ import managedUsersForm from "src/decidim/admin/managed_users";
9
9
 
10
10
  window.Decidim = window.Decidim || {};
11
- window.Decidim.managedUsersForm = managedUsersForm
12
- window.Decidim.config = new Configuration()
11
+ window.Decidim.managedUsersForm = managedUsersForm;
12
+ window.Decidim.config = new Configuration();
13
13
  window.Decidim.InputCharacterCounter = InputCharacterCounter;
14
14
 
15
15
  // REDESIGN_PENDING: deprecated
@@ -31,23 +31,27 @@ $(() => {
31
31
  toggleNav();
32
32
 
33
33
  createSortList("#steps tbody", {
34
- placeholder: $('<tr style="border-style: dashed; border-color: #000"><td colspan="4">&nbsp;</td></tr>')[0],
34
+ placeholder: $(
35
+ '<tr style="border-style: dashed; border-color: #000"><td colspan="4">&nbsp;</td></tr>'
36
+ )[0],
35
37
  onSortUpdate: ($children) => {
36
- const sortUrl = $("#steps tbody").data("sort-url")
37
- const order = $children.map((index, child) => $(child).data("id")).toArray();
38
+ const sortUrl = $("#steps tbody").data("sort-url");
39
+ const order = $children.
40
+ map((index, child) => $(child).data("id")).
41
+ toArray();
38
42
 
39
43
  $.ajax({
40
44
  method: "POST",
41
45
  url: sortUrl,
42
46
  contentType: "application/json",
43
- data: JSON.stringify({ items_ids: order }) }, // eslint-disable-line camelcase
44
- );
47
+ data: JSON.stringify({ items_ids: order }) // eslint-disable-line camelcase
48
+ });
45
49
  }
46
- })
50
+ });
47
51
 
48
52
  $("form.new_filter").each(function () {
49
53
  const formFilter = new FormFilterComponent($(this));
50
54
 
51
55
  formFilter.mountComponent();
52
- })
56
+ });
53
57
  });
@@ -0,0 +1,39 @@
1
+ // Preview CSS changes in real time through data attributes when the change event is dispatched.
2
+ //
3
+ // @example
4
+ // ```erb
5
+ // <%= form.radio_button :text_color, "Blue"
6
+ // data: {
7
+ // "css-preview" => true,
8
+ // "css-preview-updates" => "[data-css-example]:color:blue;"
9
+ // } %>
10
+ //
11
+ // <%= form.radio_button :text_color, "Red"
12
+ // data: {
13
+ // "css-preview" => true,
14
+ // "css-preview-updates" => "[data-css-example]:color:red;"
15
+ // } %>
16
+ //
17
+ // <div data-css-example>This is an example</div>
18
+ // ```
19
+ //
20
+ // It supports multiple rules separated by semicolons:
21
+ // selector:property:value; selector:property:value;
22
+ //
23
+ // for example:
24
+ // strong[data-css-example]:color:#0000ff; strong[data-css-example]:backgroundColor:#eeeeee;
25
+ //
26
+ window.addEventListener("DOMContentLoaded", () => {
27
+ document.querySelectorAll("input[data-css-preview=true]").forEach((element) => {
28
+ element.addEventListener("change", (event) => {
29
+ const updateRules = event.target.dataset.cssPreviewUpdates.split(";");
30
+
31
+ updateRules.forEach((rule) => {
32
+ const [target, property, value] = rule.split(":");
33
+ if (target !== "") {
34
+ document.querySelector(target).style[property.trim()] = value.trim();
35
+ }
36
+ });
37
+ })
38
+ })
39
+ })
@@ -28,7 +28,7 @@ $(() => {
28
28
  // - amendment_promotion_enabled
29
29
 
30
30
  // (1) Hides target fields if amendments_enabled component setting is NOT checked.
31
- // (2) Toggles visibilty of target fields when amendments_enabled component setting is clicked.
31
+ // (2) Toggles visibility of target fields when amendments_enabled component setting is clicked.
32
32
  const $amendmentsEnabled = $("input#component_settings_amendments_enabled");
33
33
 
34
34
  if ($amendmentsEnabled.length > 0) {
@@ -42,4 +42,21 @@ $(() => {
42
42
  $amendmentStepSettings.toggle();
43
43
  });
44
44
  }
45
+
46
+ // Toggles visibility of the attachments_allowed help text when the checkbox is clicked.
47
+ // Show the help text if the checkbox is checked.
48
+ const $attachmentsAllowedCheckbox = $("#component_settings_attachments_allowed");
49
+ const $attachmentsHelpText = $(".attachments_allowed_container .help-text");
50
+
51
+ if (!$attachmentsAllowedCheckbox.is(":checked")) {
52
+ $attachmentsHelpText.hide();
53
+ }
54
+
55
+ $attachmentsAllowedCheckbox.on("change", () => {
56
+ if ($attachmentsAllowedCheckbox.is(":checked")) {
57
+ $attachmentsHelpText.show();
58
+ } else {
59
+ $attachmentsHelpText.hide();
60
+ }
61
+ });
45
62
  });
@@ -54,9 +54,9 @@ $(() => {
54
54
  $participatorySpacesForSelect.hide();
55
55
  }
56
56
 
57
- $(".form .spaces-block-tag").each(function (_i, blockTag) {
57
+ $(".form .spaces-block-tag").each(function(_i, blockTag) {
58
58
  const selectTag = $(blockTag).find(".chosen-select")
59
- selectTag.change(function () {
59
+ selectTag.change(function() {
60
60
  let optionSelected = selectTag.find("option:selected").val()
61
61
  if (optionSelected === "all") {
62
62
  selectTag.find("option").not(":first").prop("selected", true);
@@ -67,25 +67,16 @@ $(() => {
67
67
  });
68
68
  })
69
69
 
70
- $form.on("change", function(event) {
71
- let formData = new FormData(event.target.closest("form"));
72
- let url = $form.data("recipients-count-newsletter-path");
70
+ $form.on("change", function() {
71
+ let $data = $form.serializeJSON().newsletter;
72
+ let $url = $form.data("recipients-count-newsletter-path");
73
73
  const $modal = $("#recipients_count_spinner");
74
74
  $modal.removeClass("hide");
75
-
76
- const xhr = new XMLHttpRequest();
77
- xhr.open("POST", url, true);
78
- xhr.onload = function() {
79
- if (xhr.status === 200) {
80
- $("#recipients_count").text(xhr.responseText);
81
- }
75
+ $.get($url, {data: $data}, function(recipientsCount) {
76
+ $("#recipients_count").text(recipientsCount);
77
+ }).always(function() {
82
78
  $modal.addClass("hide");
83
- };
84
- xhr.onerror = function() {
85
- $modal.addClass("hide");
86
- };
87
- // Send the form data
88
- xhr.send(formData);
79
+ });
89
80
  })
90
81
  }
91
82
  });
@@ -25,7 +25,7 @@ const apiRequest = (query) => {
25
25
  /**
26
26
  * Resolves the different root fields for listing different participatory spaces
27
27
  * available in the instance. Returns all LIST kind root fields that list
28
- * records implemeting the ParticipatorySpaceInterface.
28
+ * records implementing the ParticipatorySpaceInterface.
29
29
  *
30
30
  * @returns {Promise} A promise resolving the root fields for querying different
31
31
  * participatory spaces.