decidim-admin 0.31.6 → 0.32.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 (232) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -12
  3. data/app/cells/decidim/admin/attachments_privacy_warning/show.erb +1 -1
  4. data/app/cells/decidim/admin/attachments_privacy_warning_cell.rb +2 -6
  5. data/app/commands/decidim/admin/content_blocks/reorder_content_blocks.rb +1 -1
  6. data/app/commands/decidim/admin/create_newsletter.rb +1 -1
  7. data/app/commands/decidim/admin/create_taxonomy_filter.rb +2 -16
  8. data/app/commands/decidim/admin/participatory_space/create_member.rb +99 -0
  9. data/app/commands/decidim/admin/participatory_space/destroy_member.rb +30 -0
  10. data/app/commands/decidim/admin/participatory_space/import_member_csv.rb +46 -0
  11. data/app/commands/decidim/admin/participatory_space/publish_all_members.rb +52 -0
  12. data/app/commands/decidim/admin/participatory_space/unpublish_all_members.rb +52 -0
  13. data/app/commands/decidim/admin/participatory_space/update_member.rb +13 -0
  14. data/app/commands/decidim/admin/reorder_components.rb +1 -1
  15. data/app/commands/decidim/admin/reorder_taxonomies.rb +1 -1
  16. data/app/commands/decidim/admin/update_organization.rb +1 -1
  17. data/app/commands/decidim/admin/update_taxonomy_filter.rb +6 -24
  18. data/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb +1 -0
  19. data/app/controllers/concerns/decidim/admin/content_blocks/landing_page_content_blocks.rb +3 -2
  20. data/app/controllers/concerns/decidim/admin/filterable.rb +4 -4
  21. data/app/controllers/concerns/decidim/admin/participatory_space_admin_context.rb +1 -0
  22. data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +1 -1
  23. data/app/controllers/decidim/admin/area_types_controller.rb +2 -2
  24. data/app/controllers/decidim/admin/areas_controller.rb +3 -2
  25. data/app/controllers/decidim/admin/block_user_controller.rb +2 -4
  26. data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
  27. data/app/controllers/decidim/admin/components/base_controller.rb +13 -9
  28. data/app/controllers/decidim/admin/components_controller.rb +3 -2
  29. data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +2 -2
  30. data/app/controllers/decidim/admin/concerns/has_attachments.rb +2 -2
  31. data/app/controllers/decidim/admin/conflicts_controller.rb +1 -1
  32. data/app/controllers/decidim/admin/exports_controller.rb +1 -1
  33. data/app/controllers/decidim/admin/impersonations_controller.rb +1 -1
  34. data/app/controllers/decidim/admin/imports_controller.rb +2 -1
  35. data/app/controllers/decidim/admin/managed_users/promotions_controller.rb +1 -1
  36. data/app/controllers/decidim/admin/newsletters_controller.rb +9 -9
  37. data/app/controllers/decidim/admin/officializations_controller.rb +0 -2
  38. data/app/controllers/decidim/admin/organization_appearance_controller.rb +1 -1
  39. data/app/controllers/decidim/admin/organization_controller.rb +30 -1
  40. data/app/controllers/decidim/admin/organization_external_domain_allowlist_controller.rb +1 -1
  41. data/app/controllers/decidim/admin/participatory_space/concerns/has_members.rb +166 -0
  42. data/app/controllers/decidim/admin/participatory_space/concerns/has_members_csv_import.rb +67 -0
  43. data/app/controllers/decidim/admin/participatory_space/concerns/members_filterable.rb +36 -0
  44. data/app/controllers/decidim/admin/participatory_space/user_role_controller.rb +2 -2
  45. data/app/controllers/decidim/admin/reminders_controller.rb +1 -1
  46. data/app/controllers/decidim/admin/resource_permissions_controller.rb +1 -1
  47. data/app/controllers/decidim/admin/scope_types_controller.rb +2 -2
  48. data/app/controllers/decidim/admin/scopes_controller.rb +3 -2
  49. data/app/controllers/decidim/admin/share_tokens_controller.rb +2 -2
  50. data/app/controllers/decidim/admin/space_publications_controller.rb +2 -2
  51. data/app/controllers/decidim/admin/static_page_topics_controller.rb +2 -2
  52. data/app/controllers/decidim/admin/static_pages_controller.rb +2 -2
  53. data/app/controllers/decidim/admin/taxonomies_controller.rb +3 -3
  54. data/app/controllers/decidim/admin/taxonomy_filters_controller.rb +3 -3
  55. data/app/controllers/decidim/admin/taxonomy_items_controller.rb +3 -3
  56. data/app/controllers/decidim/admin/users_controller.rb +1 -1
  57. data/app/forms/decidim/admin/content_block_form.rb +28 -1
  58. data/app/forms/decidim/admin/organization_form.rb +0 -1
  59. data/app/forms/decidim/admin/participatory_space/member_csv_import_form.rb +33 -0
  60. data/app/forms/decidim/admin/participatory_space/member_form.rb +26 -0
  61. data/app/forms/decidim/admin/participatory_space_admin_user_form.rb +1 -1
  62. data/app/forms/decidim/admin/selective_newsletter_form.rb +7 -7
  63. data/app/forms/decidim/admin/taxonomy_filter_form.rb +10 -11
  64. data/app/helpers/decidim/admin/newsletters_helper.rb +8 -5
  65. data/app/helpers/decidim/admin/search_form_helper.rb +17 -0
  66. data/app/helpers/decidim/admin/settings_helper.rb +2 -0
  67. data/app/jobs/decidim/admin/newsletter_job.rb +2 -2
  68. data/app/jobs/decidim/admin/participatory_space/destroy_members_follows_job.rb +36 -0
  69. data/app/jobs/decidim/admin/participatory_space/import_member_csv_job.rb +29 -0
  70. data/app/packs/src/decidim/admin/admin_autocomplete.js +10 -16
  71. data/app/packs/src/decidim/admin/controllers/access_mode/access_mode.test.js +68 -0
  72. data/app/packs/src/decidim/admin/controllers/access_mode/controller.js +52 -0
  73. data/app/packs/src/decidim/admin/newsletters.js +2 -2
  74. data/app/packs/stylesheets/decidim/admin/_datepicker.scss +0 -4
  75. data/app/packs/stylesheets/decidim/admin/application.scss +1 -1
  76. data/app/queries/decidim/admin/newsletter_recipients.rb +8 -8
  77. data/app/views/decidim/admin/admin_terms/show.html.erb +3 -1
  78. data/app/views/decidim/admin/area_types/index.html.erb +3 -2
  79. data/app/views/decidim/admin/areas/index.html.erb +3 -2
  80. data/app/views/decidim/admin/attachment_collections/edit.html.erb +2 -2
  81. data/app/views/decidim/admin/attachment_collections/index.html.erb +3 -3
  82. data/app/views/decidim/admin/attachment_collections/new.html.erb +2 -2
  83. data/app/views/decidim/admin/attachments/index.html.erb +3 -2
  84. data/app/views/decidim/admin/authorization_workflows/index.html.erb +2 -2
  85. data/app/views/decidim/admin/block_user/new.html.erb +1 -0
  86. data/app/views/decidim/admin/components/_actions.html.erb +1 -1
  87. data/app/views/decidim/admin/components/index.html.erb +2 -2
  88. data/app/views/decidim/admin/components/manage_trash.html.erb +2 -2
  89. data/app/views/decidim/admin/conflicts/edit.html.erb +3 -1
  90. data/app/views/decidim/admin/conflicts/index.html.erb +3 -2
  91. data/app/views/decidim/admin/dashboard/show.html.erb +4 -4
  92. data/app/views/decidim/admin/help_sections/update.html.erb +2 -0
  93. data/app/views/decidim/admin/impersonatable_users/index.html.erb +3 -2
  94. data/app/views/decidim/admin/impersonations/_form.html.erb +2 -2
  95. data/app/views/decidim/admin/impersonations/new.html.erb +3 -2
  96. data/app/views/decidim/admin/imports/new.html.erb +1 -0
  97. data/app/views/decidim/admin/logs/_logs_list.html.erb +1 -1
  98. data/app/views/decidim/admin/logs/index.html.erb +1 -1
  99. data/app/views/decidim/admin/managed_users/impersonation_logs/index.html.erb +6 -5
  100. data/app/views/decidim/admin/managed_users/promotions/new.html.erb +3 -2
  101. data/app/views/decidim/admin/{participatory_space_private_users → members}/edit.html.erb +2 -2
  102. data/app/views/decidim/admin/{participatory_space_private_users → members}/index.html.erb +25 -25
  103. data/app/views/decidim/admin/{participatory_space_private_users → members}/new.html.erb +2 -2
  104. data/app/views/decidim/admin/{participatory_space_private_users_csv_imports → members_csv_imports}/new.html.erb +2 -2
  105. data/app/views/decidim/admin/moderations/_moderation-tr.html.erb +3 -7
  106. data/app/views/decidim/admin/moderations/_moderations-thead.html.erb +0 -1
  107. data/app/views/decidim/admin/moderations/reports/index.html.erb +1 -1
  108. data/app/views/decidim/admin/newsletter_templates/show.html.erb +3 -2
  109. data/app/views/decidim/admin/newsletters/confirm_recipients.html.erb +4 -6
  110. data/app/views/decidim/admin/newsletters/index.html.erb +2 -2
  111. data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +2 -2
  112. data/app/views/decidim/admin/newsletters/show.html.erb +3 -2
  113. data/app/views/decidim/admin/officializations/index.html.erb +6 -4
  114. data/app/views/decidim/admin/officializations/show_email.html.erb +3 -7
  115. data/app/views/decidim/admin/organization/form/_extra_features.html.erb +0 -4
  116. data/app/views/decidim/admin/organization_external_domain_allowlist/_form.html.erb +2 -2
  117. data/app/views/decidim/admin/organization_external_domain_allowlist/edit.html.erb +2 -2
  118. data/app/views/decidim/admin/reminders/new.html.erb +8 -1
  119. data/app/views/decidim/admin/resource_permissions/edit.html.erb +2 -2
  120. data/app/views/decidim/admin/scope_types/index.html.erb +3 -2
  121. data/app/views/decidim/admin/scopes/index.html.erb +2 -2
  122. data/app/views/decidim/admin/share_tokens/index.html.erb +2 -0
  123. data/app/views/decidim/admin/shared/_gallery.html.erb +15 -0
  124. data/app/views/decidim/admin/shared/landing_page/_content_blocks.html.erb +0 -2
  125. data/app/views/decidim/admin/shared/landing_page/edit.html.erb +2 -0
  126. data/app/views/decidim/admin/shared/landing_page_content_blocks/edit.html.erb +1 -0
  127. data/app/views/decidim/admin/static_page_topics/index.html.erb +2 -2
  128. data/app/views/decidim/admin/static_pages/edit.html.erb +2 -1
  129. data/app/views/decidim/admin/static_pages/index.html.erb +2 -2
  130. data/app/views/decidim/admin/statistics/_statistics.html.erb +1 -1
  131. data/app/views/decidim/admin/statistics/index.html.erb +2 -0
  132. data/app/views/decidim/admin/taxonomies/_row.html.erb +1 -1
  133. data/app/views/decidim/admin/taxonomies/_row_children.html.erb +1 -1
  134. data/app/views/decidim/admin/taxonomies/_table.html.erb +1 -1
  135. data/app/views/decidim/admin/taxonomies/edit.html.erb +2 -2
  136. data/app/views/decidim/admin/taxonomies/index.html.erb +4 -4
  137. data/app/views/decidim/admin/taxonomy_filters/_table.html.erb +2 -2
  138. data/app/views/decidim/admin/taxonomy_filters/index.html.erb +2 -2
  139. data/app/views/decidim/admin/taxonomy_filters_selector/index.html.erb +2 -0
  140. data/app/views/decidim/admin/taxonomy_filters_selector/new.html.erb +2 -0
  141. data/app/views/decidim/admin/taxonomy_filters_selector/show.html.erb +2 -0
  142. data/app/views/decidim/admin/taxonomy_items/edit.html.erb +2 -0
  143. data/app/views/decidim/admin/taxonomy_items/new.html.erb +2 -0
  144. data/app/views/decidim/admin/users/index.html.erb +3 -2
  145. data/app/views/layouts/decidim/admin/_application.html.erb +1 -1
  146. data/config/locales/ar.yml +9 -49
  147. data/config/locales/bg.yml +9 -55
  148. data/config/locales/bs-BA.yml +4 -24
  149. data/config/locales/ca-IT.yml +130 -113
  150. data/config/locales/ca.yml +130 -113
  151. data/config/locales/cs.yml +126 -107
  152. data/config/locales/de.yml +114 -98
  153. data/config/locales/el.yml +17 -45
  154. data/config/locales/en.yml +130 -112
  155. data/config/locales/eo.yml +0 -7
  156. data/config/locales/es-MX.yml +130 -113
  157. data/config/locales/es-PY.yml +130 -113
  158. data/config/locales/es.yml +130 -113
  159. data/config/locales/eu.yml +159 -142
  160. data/config/locales/fi-plain.yml +129 -112
  161. data/config/locales/fi.yml +129 -112
  162. data/config/locales/fr-CA.yml +91 -142
  163. data/config/locales/fr.yml +91 -142
  164. data/config/locales/ga-IE.yml +0 -13
  165. data/config/locales/gl.yml +10 -41
  166. data/config/locales/he-IL.yml +1 -5
  167. data/config/locales/hu.yml +10 -52
  168. data/config/locales/id-ID.yml +4 -34
  169. data/config/locales/is-IS.yml +1 -16
  170. data/config/locales/it.yml +8 -69
  171. data/config/locales/ja.yml +129 -114
  172. data/config/locales/kaa.yml +4 -16
  173. data/config/locales/ko.yml +6 -40
  174. data/config/locales/lb.yml +9 -41
  175. data/config/locales/lt.yml +10 -52
  176. data/config/locales/lv.yml +8 -38
  177. data/config/locales/nl.yml +10 -46
  178. data/config/locales/no.yml +10 -46
  179. data/config/locales/pl.yml +9 -54
  180. data/config/locales/pt-BR.yml +121 -104
  181. data/config/locales/pt.yml +9 -42
  182. data/config/locales/ro-RO.yml +15 -51
  183. data/config/locales/ru.yml +4 -35
  184. data/config/locales/sk.yml +8 -814
  185. data/config/locales/sl.yml +1 -7
  186. data/config/locales/sq-AL.yml +1 -21
  187. data/config/locales/sr-CS.yml +4 -24
  188. data/config/locales/sv.yml +79 -89
  189. data/config/locales/th-TH.yml +0 -8
  190. data/config/locales/tr-TR.yml +33 -65
  191. data/config/locales/uk.yml +0 -26
  192. data/config/locales/val-ES.yml +0 -1
  193. data/config/locales/zh-CN.yml +9 -38
  194. data/config/locales/zh-TW.yml +10 -52
  195. data/config/routes.rb +4 -0
  196. data/decidim-admin.gemspec +7 -10
  197. data/lib/decidim/admin/engine.rb +5 -2
  198. data/lib/decidim/admin/form_builder.rb +3 -1
  199. data/lib/decidim/admin/menu.rb +1 -1
  200. data/lib/decidim/admin/test/admin_members_shared_examples.rb +119 -0
  201. data/lib/decidim/admin/test/admin_participatory_space_access_examples.rb +3 -3
  202. data/lib/decidim/admin/test/filterable_examples.rb +20 -11
  203. data/lib/decidim/admin/test/invite_participatory_space_admins_shared_examples.rb +17 -17
  204. data/lib/decidim/admin/test/invite_participatory_space_collaborators_shared_examples.rb +1 -1
  205. data/lib/decidim/admin/test/invite_participatory_space_moderators_shared_examples.rb +1 -1
  206. data/lib/decidim/admin/test/invite_participatory_space_users_shared_context.rb +1 -1
  207. data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +3 -3
  208. data/lib/decidim/admin/test/manage_attachments_examples.rb +6 -6
  209. data/lib/decidim/admin/test/manage_component_permissions_examples.rb +5 -5
  210. data/lib/decidim/admin/test/manage_moderations_examples.rb +6 -6
  211. data/lib/decidim/admin/test/manage_participatory_space_publications_examples.rb +2 -2
  212. data/lib/decidim/admin/test/manage_resource_soft_deletion_examples.rb +3 -3
  213. data/lib/decidim/admin/version.rb +1 -1
  214. data/lib/decidim/admin.rb +0 -2
  215. metadata +40 -36
  216. data/app/commands/decidim/admin/create_participatory_space_private_user.rb +0 -98
  217. data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +0 -28
  218. data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +0 -44
  219. data/app/commands/decidim/admin/publish_all_participatory_space_private_users.rb +0 -50
  220. data/app/commands/decidim/admin/unpublish_all_participatory_space_private_users.rb +0 -50
  221. data/app/commands/decidim/admin/update_participatory_space_private_user.rb +0 -11
  222. data/app/controllers/concerns/decidim/participatory_space_private_users/admin/filterable.rb +0 -34
  223. data/app/controllers/decidim/admin/concerns/has_private_users.rb +0 -169
  224. data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +0 -65
  225. data/app/forms/decidim/admin/participatory_space_private_user_csv_import_form.rb +0 -31
  226. data/app/forms/decidim/admin/participatory_space_private_user_form.rb +0 -24
  227. data/app/jobs/decidim/admin/destroy_private_users_follows_job.rb +0 -37
  228. data/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb +0 -27
  229. data/app/views/decidim/admin/devise/mailers/password_change.html.erb +0 -3
  230. data/app/views/decidim/admin/devise/mailers/reset_password_instructions.html.erb +0 -8
  231. data/app/views/decidim/admin/shared/_attachments.html.erb +0 -15
  232. /data/app/views/decidim/admin/{participatory_space_private_users → members}/_form.html.erb +0 -0
@@ -20,7 +20,11 @@ module Decidim
20
20
 
21
21
  initializer "decidim_admin.mount_routes" do |_app|
22
22
  Decidim::Core::Engine.routes do
23
- mount Decidim::Admin::Engine => "/admin"
23
+ extend Decidim::Routes::LocaleRedirects
24
+
25
+ scope "/:locale", **locale_scope_options do
26
+ mount Decidim::Admin::Engine => "/admin"
27
+ end
24
28
  end
25
29
  end
26
30
 
@@ -44,7 +48,6 @@ module Decidim
44
48
  Decidim.icons.register(name: "earth-line", icon: "earth-line", category: "system", description: "Earth line", engine: :admin)
45
49
 
46
50
  Decidim.icons.register(name: "attachment-2", icon: "attachment-2", category: "system", description: "", engine: :admin)
47
- Decidim.icons.register(name: "spy-line", icon: "spy-line", category: "system", description: "", engine: :admin)
48
51
  Decidim.icons.register(name: "refresh-line", icon: "refresh-line", category: "system", description: "", engine: :admin)
49
52
  Decidim.icons.register(name: "zoom-in-line", icon: "zoom-in-line", category: "system", description: "", engine: :admin)
50
53
  Decidim.icons.register(name: "add-line", icon: "add-line", category: "system", description: "", engine: :admin)
@@ -19,6 +19,7 @@ module Decidim
19
19
  # - :class (string) You can provide custom class name for the container (ex. autocomplete-field--results-inline)
20
20
  # @param [Hash] prompt_options
21
21
  # Prompt configuration. A hash with options:
22
+ # - :url (String) The url where the ajax endpoint to fill the select
22
23
  # - :placeholder (String) Text to use as placeholder
23
24
  # - :no_results (String) (optional) Text to use when there are no matching results (default: No results found)
24
25
  # - :search_prompt (String) (optional) Text to prompt for search input (default: Type at least three characters to search)
@@ -29,7 +30,7 @@ module Decidim
29
30
  # - label: This will be the label of the option select.
30
31
  #
31
32
  # @example How to use it
32
- # <% prompt_options = { placeholder: t(".select_user") }
33
+ # <% prompt_options = { url: users_url, text: t(".select_user") }
33
34
  # options = { label: t(".user") } %>
34
35
  # <%= form.autocomplete_select(:user_id, form.object.user.presence, options, prompt_options) do |user|
35
36
  # { value: user.id, label: "#{user.name} (#{user.nickname})" }
@@ -47,6 +48,7 @@ module Decidim
47
48
  name: options[:name] || "#{@object_name}[#{attribute}]",
48
49
  options: (options[:default_options].to_a + [selected]).compact,
49
50
  placeholder: prompt_options[:placeholder],
51
+ searchURL: prompt_options[:url],
50
52
  changeURL: prompt_options[:change_url],
51
53
  selected: selected ? selected[:value] : "",
52
54
  searchPromptText: options[:search_prompt] || I18n.t("autocomplete.search_prompt", scope: "decidim.admin"),
@@ -48,7 +48,7 @@ module Decidim
48
48
  def self.register_impersonate_menu!
49
49
  Decidim.menu :impersonate_menu do |menu|
50
50
  menu.add_item :conflicts,
51
- I18n.t("title", scope: "decidim.admin.conflicts"),
51
+ I18n.t("title", scope: "decidim.admin.conflicts.index"),
52
52
  decidim_admin.conflicts_path,
53
53
  active: is_active_link?(decidim_admin.conflicts_path),
54
54
  if: allowed_to?(:index, :impersonatable_user)
@@ -0,0 +1,119 @@
1
+ # frozen_string_literal: true
2
+
3
+ shared_examples "manage admin members examples" do
4
+ let(:other_user) { create(:user, organization:, email: "my_email@example.org") }
5
+
6
+ let!(:member) { create(:member, user:, participatory_space:) }
7
+
8
+ before do
9
+ switch_to_host(organization.host)
10
+ login_as user, scope: :user
11
+ visit participatory_space_edit_path
12
+ within_admin_sidebar_menu do
13
+ click_on "Members"
14
+ end
15
+ end
16
+
17
+ it "shows the member list" do
18
+ within "#members table" do
19
+ expect(page).to have_content(member.user.email)
20
+ end
21
+ end
22
+
23
+ it "creates a new member" do
24
+ click_on "New member"
25
+
26
+ within ".new_member" do
27
+ fill_in :member_name, with: "John Doe"
28
+ fill_in :member_email, with: other_user.email
29
+
30
+ find("*[type=submit]").click
31
+ end
32
+
33
+ expect(page).to have_callout("Member access successfully created.")
34
+
35
+ within "#members table" do
36
+ expect(page).to have_content(other_user.email)
37
+ end
38
+
39
+ visit decidim_admin.root_path
40
+ expect(page).to have_content("invited #{other_user.name} to be a member")
41
+ end
42
+
43
+ describe "when import a batch of members from csv" do
44
+ it "import a batch of members" do
45
+ click_on "Import via CSV"
46
+
47
+ # The CSV has no headers
48
+ expect(Decidim::Admin::ParticipatorySpace::ImportMemberCsvJob).to receive(:perform_later).once.ordered.with("john.doe@example.org", "John Doe", participatory_space, user)
49
+ expect(Decidim::Admin::ParticipatorySpace::ImportMemberCsvJob).to receive(:perform_later).once.ordered.with("jane.doe@example.org", "Jane Doe", participatory_space, user)
50
+ dynamically_attach_file(:member_csv_import_file, Decidim::Dev.asset("import_members.csv"))
51
+ perform_enqueued_jobs { click_on "Upload" }
52
+
53
+ expect(page).to have_content("CSV file uploaded successfully")
54
+ end
55
+ end
56
+
57
+ describe "when publishing all members" do
58
+ let!(:member) { create(:member, :unpublished, user:, participatory_space:) }
59
+
60
+ it "publishes all members" do
61
+ click_on "Publish all"
62
+
63
+ sleep(1)
64
+ expect(member.reload).to be_published
65
+ end
66
+
67
+ it "displays the correct log message" do
68
+ click_on "Publish all"
69
+ sleep(1)
70
+ visit decidim_admin.root_path
71
+ expect(page).to have_content("published all members of the #{translated(participatory_space.title)}")
72
+ end
73
+ end
74
+
75
+ describe "when managing different users" do
76
+ before do
77
+ create(:member, user: other_user, participatory_space:)
78
+ visit current_path
79
+ end
80
+
81
+ it "deletes a member" do
82
+ within "#members tr", text: other_user.email do
83
+ find("button[data-controller='dropdown']").click
84
+ accept_confirm { click_on "Delete" }
85
+ end
86
+
87
+ expect(page).to have_callout("Member access successfully destroyed.")
88
+
89
+ within "#members table" do
90
+ expect(page).to have_no_content(other_user.email)
91
+ end
92
+ end
93
+
94
+ context "when the user has not accepted the invitation" do
95
+ before do
96
+ form = Decidim::Admin::ParticipatorySpace::MemberForm.from_params(
97
+ name: "test",
98
+ email: "test@example.org"
99
+ )
100
+
101
+ Decidim::Admin::ParticipatorySpace::CreateMember.call(
102
+ form,
103
+ participatory_space
104
+ )
105
+
106
+ visit current_path
107
+ end
108
+
109
+ it "resends the invitation to the user" do
110
+ within "#members tr", text: "test@example.org" do
111
+ find("button[data-controller='dropdown']").click
112
+ click_on "Resend invitation"
113
+ end
114
+
115
+ expect(page).to have_callout("Invitation successfully resent.")
116
+ end
117
+ end
118
+ end
119
+ end
@@ -11,7 +11,7 @@ end
11
11
  shared_examples "showing the unauthorized error message" do
12
12
  it "redirects to the relevant unauthorized page" do
13
13
  expect(page).to have_content("You are not authorized to perform this action")
14
- expect(page).to have_current_path("/admin/")
14
+ expect(page).to have_current_path(decidim_admin.root_path)
15
15
  end
16
16
  end
17
17
 
@@ -40,7 +40,7 @@ shared_examples "admin participatory space access" do
40
40
 
41
41
  context "when the user is a normal user" do
42
42
  let(:user) { create(:user, :confirmed, organization:) }
43
- let(:unauthorized_path) { "/" }
43
+ let(:unauthorized_path) { decidim.root_path }
44
44
 
45
45
  it_behaves_like "a 404 page"
46
46
  end
@@ -53,7 +53,7 @@ shared_examples "admin participatory space access" do
53
53
  visit decidim.root_path
54
54
 
55
55
  within "#admin-bar" do
56
- expect(page).to have_link("Admin dashboard", href: "/admin/")
56
+ expect(page).to have_link("Admin dashboard", href: decidim_admin.root_path)
57
57
  end
58
58
  end
59
59
  end
@@ -148,27 +148,36 @@ shared_examples "filtering collection by published/unpublished" do
148
148
  it_behaves_like "paginating a collection"
149
149
  end
150
150
 
151
- shared_examples "filtering collection by private/public" do
151
+ shared_examples "filtering collection by open/restricted/transparent" do
152
152
  include_context "with filterable context"
153
153
 
154
154
  unless block_given?
155
- let!(:public_space) do
156
- create(factory_name, private_space: false, organization:)
155
+ let!(:open_space) do
156
+ create(factory_name, :open, organization:)
157
157
  end
158
158
 
159
- let!(:private_space) do
160
- create(factory_name, private_space: true, organization:)
159
+ let!(:restricted_space) do
160
+ create(factory_name, :restricted, organization:)
161
161
  end
162
+
163
+ let!(:transparent_space) do
164
+ create(factory_name, :transparent, organization:)
165
+ end
166
+ end
167
+
168
+ it_behaves_like "a filtered collection", options: "Access mode", filter: "Open" do
169
+ let(:in_filter) { translated(open_space.title) }
170
+ let(:not_in_filter) { [translated(restricted_space.title), translated(transparent_space.title)] }
162
171
  end
163
172
 
164
- it_behaves_like "a filtered collection", options: "Private", filter: "Public" do
165
- let(:in_filter) { translated(public_space.title) }
166
- let(:not_in_filter) { translated(private_space.title) }
173
+ it_behaves_like "a filtered collection", options: "Access mode", filter: "Restricted" do
174
+ let(:in_filter) { translated(restricted_space.title) }
175
+ let(:not_in_filter) { [translated(open_space.title), translated(transparent_space.title)] }
167
176
  end
168
177
 
169
- it_behaves_like "a filtered collection", options: "Private", filter: "Private" do
170
- let(:in_filter) { translated(private_space.title) }
171
- let(:not_in_filter) { translated(public_space.title) }
178
+ it_behaves_like "a filtered collection", options: "Access mode", filter: "Transparent" do
179
+ let(:in_filter) { translated(transparent_space.title) }
180
+ let(:not_in_filter) { [translated(open_space.title), translated(restricted_space.title)] }
172
181
  end
173
182
 
174
183
  it_behaves_like "paginating a collection"
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- shared_examples "inviting participatory space admins" do |check_private_space: true, check_landing_page: true|
3
+ shared_examples "inviting participatory space admins" do |check_members_page: true, check_landing_page: true|
4
4
  let(:role) { "Administrator" }
5
5
 
6
6
  before do
7
7
  switch_to_host organization.host
8
8
  end
9
9
 
10
- shared_examples "sees public space menu" do
10
+ shared_examples "sees space without members menu" do
11
11
  it "can access all sections" do
12
12
  within_admin_sidebar_menu do
13
13
  expect(page).to have_content(about_this_space_label)
@@ -16,13 +16,13 @@ shared_examples "inviting participatory space admins" do |check_private_space: t
16
16
  expect(page).to have_content("Components")
17
17
  expect(page).to have_content("Attachments")
18
18
  expect(page).to have_content(space_admins_label)
19
- expect(page).to have_no_content("Members") if participatory_space.respond_to?(:private_space)
19
+ expect(page).to have_no_content("Members") if participatory_space.respond_to?(:has_members)
20
20
  expect(page).to have_content("Moderations")
21
21
  end
22
22
  end
23
23
  end
24
24
 
25
- shared_examples "sees private space menu" do
25
+ shared_examples "sees space with members menu" do
26
26
  it "can access all sections" do
27
27
  within_admin_sidebar_menu do
28
28
  expect(page).to have_content(about_this_space_label)
@@ -31,7 +31,7 @@ shared_examples "inviting participatory space admins" do |check_private_space: t
31
31
  expect(page).to have_content("Components")
32
32
  expect(page).to have_content("Attachments")
33
33
  expect(page).to have_content(space_admins_label)
34
- expect(page).to have_content("Members") if participatory_space.respond_to?(:private_space)
34
+ expect(page).to have_content("Members") if participatory_space.respond_to?(:has_members)
35
35
  expect(page).to have_content("Moderations")
36
36
  end
37
37
  end
@@ -52,7 +52,7 @@ shared_examples "inviting participatory space admins" do |check_private_space: t
52
52
  find("*[type=submit]").click
53
53
  end
54
54
 
55
- expect(page).to have_current_path "/admin/admin_terms/show"
55
+ expect(page).to have_current_path decidim_admin.admin_terms_show_path
56
56
 
57
57
  visit decidim_admin.admin_terms_show_path
58
58
 
@@ -81,7 +81,7 @@ shared_examples "inviting participatory space admins" do |check_private_space: t
81
81
  find("*[type=submit]").click
82
82
  end
83
83
 
84
- expect(page).to have_current_path "/admin/admin_terms/show"
84
+ expect(page).to have_current_path decidim_admin.admin_terms_show_path
85
85
 
86
86
  visit decidim_admin.admin_terms_show_path
87
87
 
@@ -98,14 +98,14 @@ shared_examples "inviting participatory space admins" do |check_private_space: t
98
98
  end
99
99
 
100
100
  context "and is a public space" do
101
- it_behaves_like "sees public space menu"
101
+ it_behaves_like "sees space without members menu"
102
102
  end
103
103
 
104
- if check_private_space
105
- context "and is a private space" do
106
- let(:participatory_space) { private_participatory_space }
104
+ if check_members_page
105
+ context "and is a space with members" do
106
+ let(:participatory_space) { members_participatory_space }
107
107
 
108
- it_behaves_like "sees private space menu"
108
+ it_behaves_like "sees space with members menu"
109
109
  end
110
110
  end
111
111
  end
@@ -163,14 +163,14 @@ shared_examples "inviting participatory space admins" do |check_private_space: t
163
163
  end
164
164
 
165
165
  context "and is a public space" do
166
- it_behaves_like "sees public space menu"
166
+ it_behaves_like "sees space without members menu"
167
167
  end
168
168
 
169
- if check_private_space
170
- context "and is a private space" do
171
- let(:participatory_space) { private_participatory_space }
169
+ if check_members_page
170
+ context "and is a space with members" do
171
+ let(:participatory_space) { members_participatory_space }
172
172
 
173
- it_behaves_like "sees private space menu"
173
+ it_behaves_like "sees space with members menu"
174
174
  end
175
175
  end
176
176
  end
@@ -22,7 +22,7 @@ shared_examples "inviting participatory space collaborators" do
22
22
  find("*[type=submit]").click
23
23
  end
24
24
 
25
- expect(page).to have_current_path "/admin/admin_terms/show"
25
+ expect(page).to have_current_path decidim_admin.admin_terms_show_path
26
26
 
27
27
  visit decidim_admin.admin_terms_show_path
28
28
  find_button("I agree with the terms").click
@@ -20,7 +20,7 @@ shared_examples "inviting participatory space moderators" do
20
20
  find("*[type=submit]").click
21
21
  end
22
22
 
23
- expect(page).to have_current_path "/admin/admin_terms/show"
23
+ expect(page).to have_current_path decidim_admin.admin_terms_show_path
24
24
 
25
25
  visit decidim_admin.admin_terms_show_path
26
26
  find_button("I agree with the terms").click
@@ -18,7 +18,7 @@ shared_context "when inviting participatory space users" do
18
18
  fill_in "Email", with: email
19
19
  select role, from: "Role"
20
20
  click_on "Create"
21
- expect(page).to have_content("successfully added")
21
+ expect(page).to have_callout(added_callout_message)
22
22
  logout :user
23
23
  end
24
24
 
@@ -44,7 +44,7 @@ shared_examples "manage attachment collections examples" do
44
44
  find("*[type=submit]").click
45
45
  end
46
46
 
47
- expect(page).to have_admin_callout("successfully")
47
+ expect(page).to have_callout("Folder created successfully.")
48
48
 
49
49
  within "#attachment_collections table" do
50
50
  expect(page).to have_content(translated(attributes[:name]))
@@ -72,7 +72,7 @@ shared_examples "manage attachment collections examples" do
72
72
  find("*[type=submit]").click
73
73
  end
74
74
 
75
- expect(page).to have_admin_callout("successfully")
75
+ expect(page).to have_callout("Folder updated successfully.")
76
76
 
77
77
  within "#attachment_collections table" do
78
78
  expect(page).to have_content(translated(attributes[:name]))
@@ -96,7 +96,7 @@ shared_examples "manage attachment collections examples" do
96
96
  accept_confirm { click_on "Delete" }
97
97
  end
98
98
 
99
- expect(page).to have_admin_callout("successfully")
99
+ expect(page).to have_callout("Folder destroyed successfully.")
100
100
 
101
101
  within "#attachment_collections table" do
102
102
  expect(page).to have_no_content(translated(attachment_collection2.name))
@@ -70,7 +70,7 @@ shared_examples "manage attachments examples" do
70
70
  find("*[type=submit]").click
71
71
  end
72
72
 
73
- expect(page).to have_admin_callout("successfully")
73
+ expect(page).to have_callout("Attachment created successfully.")
74
74
 
75
75
  within "#attachments table" do
76
76
  expect(page).to have_text("Very Important Document")
@@ -106,7 +106,7 @@ shared_examples "manage attachments examples" do
106
106
  find("*[type=submit]").click
107
107
  end
108
108
 
109
- expect(page).to have_admin_callout("successfully")
109
+ expect(page).to have_callout("Attachment created successfully.")
110
110
 
111
111
  within "#attachments table" do
112
112
  expect(page).to have_text("Very Important Document")
@@ -142,7 +142,7 @@ shared_examples "manage attachments examples" do
142
142
  find("*[type=submit]").click
143
143
  end
144
144
 
145
- expect(page).to have_admin_callout("successfully")
145
+ expect(page).to have_callout("Attachment created successfully.")
146
146
 
147
147
  within "#attachments table" do
148
148
  expect(page).to have_text("Document inside a collection")
@@ -178,7 +178,7 @@ shared_examples "manage attachments examples" do
178
178
  accept_confirm { click_on "Delete" }
179
179
  end
180
180
 
181
- expect(page).to have_admin_callout("successfully")
181
+ expect(page).to have_callout("Attachment destroyed successfully.")
182
182
 
183
183
  expect(page).to have_no_content(translated(attachment.title, locale: :en))
184
184
  end
@@ -189,7 +189,7 @@ shared_examples "manage attachments examples" do
189
189
  accept_confirm { click_on "Delete" }
190
190
  end
191
191
 
192
- expect(page).to have_admin_callout("Attachment destroyed successfully")
192
+ expect(page).to have_callout("Attachment destroyed successfully")
193
193
 
194
194
  expect(page).to have_no_content(translated(attachment_with_link.title, locale: :en))
195
195
  end
@@ -214,7 +214,7 @@ shared_examples "manage attachments examples" do
214
214
  find("*[type=submit]").click
215
215
  end
216
216
 
217
- expect(page).to have_admin_callout("successfully")
217
+ expect(page).to have_callout("Attachment updated successfully.")
218
218
 
219
219
  within "#attachments table" do
220
220
  expect(page).to have_text("This is a nice photo")
@@ -60,7 +60,7 @@ shared_examples "Managing component permissions" do
60
60
  find("*[type=submit]").click
61
61
  end
62
62
 
63
- expect(page).to have_content("successfully")
63
+ expect(page).to have_callout("Permissions updated successfully.")
64
64
 
65
65
  expect(component.reload.permissions["foo"]).to(
66
66
  include(
@@ -91,7 +91,7 @@ shared_examples "Managing component permissions" do
91
91
  end
92
92
 
93
93
  it "renders the form again" do
94
- expect(page).to have_content("problem")
94
+ expect(page).to have_content("There was a problem updating the permissions of this component.")
95
95
  end
96
96
  end
97
97
 
@@ -125,7 +125,7 @@ shared_examples "Managing component permissions" do
125
125
  find("*[type=submit]").click
126
126
  end
127
127
 
128
- expect(page).to have_content("successfully")
128
+ expect(page).to have_callout("Permissions updated successfully.")
129
129
 
130
130
  expect(component.reload.permissions["foo"]).to be_nil
131
131
  end
@@ -162,7 +162,7 @@ shared_examples "Managing component permissions" do
162
162
  find("*[type=submit]").click
163
163
  end
164
164
 
165
- expect(page).to have_content("successfully")
165
+ expect(page).to have_callout("Permissions updated successfully.")
166
166
 
167
167
  expect(component.reload.permissions["foo"]).to(
168
168
  include(
@@ -185,7 +185,7 @@ shared_examples "Managing component permissions" do
185
185
  find("*[type=submit]").click
186
186
  end
187
187
 
188
- expect(page).to have_content("successfully")
188
+ expect(page).to have_callout("Permissions updated successfully.")
189
189
 
190
190
  expect(component.reload.permissions["foo"]).to(
191
191
  include(
@@ -27,7 +27,7 @@ shared_examples "sorted moderations" do
27
27
  click_on link_text
28
28
  end
29
29
  all("tbody tr").each_with_index do |row, _index|
30
- expect(row.find("td:nth-child(2)")).to have_content(reportables.first.id)
30
+ expect(row.find("td:nth-child(2)")).to have_content(reportables.first.class.model_name.human)
31
31
  end
32
32
  end
33
33
  end
@@ -86,7 +86,7 @@ shared_examples "manage moderations" do
86
86
  click_on "Undo the report"
87
87
  end
88
88
 
89
- expect(page).to have_admin_callout("Resource successfully unreported")
89
+ expect(page).to have_callout("Resource successfully unreported")
90
90
  end
91
91
 
92
92
  it "user can hide a resource" do
@@ -95,7 +95,7 @@ shared_examples "manage moderations" do
95
95
  click_on "Hide"
96
96
  end
97
97
 
98
- expect(page).to have_admin_callout("Resource successfully hidden")
98
+ expect(page).to have_callout("Resource successfully hidden")
99
99
  expect(page).to have_no_content(moderation.reportable.reported_content_url)
100
100
  end
101
101
 
@@ -107,8 +107,8 @@ shared_examples "manage moderations" do
107
107
  click_on "Reports count"
108
108
 
109
109
  all("tbody tr").each_with_index do |row, index|
110
- reportable_id = moderations_ordered_by_report_count_asc[index].reportable.id
111
- expect(row.find("td:nth-child(2)")).to have_content(reportable_id)
110
+ reportable_type = moderations_ordered_by_report_count_asc[index].reportable.class.model_name.human
111
+ expect(row.find("td:nth-child(2)")).to have_content(reportable_type)
112
112
  end
113
113
  end
114
114
  end
@@ -241,7 +241,7 @@ shared_examples "manage moderations" do
241
241
  click_on "Hide"
242
242
  end
243
243
 
244
- expect(page).to have_admin_callout("Resource successfully hidden")
244
+ expect(page).to have_callout("Resource successfully hidden")
245
245
  expect(page).to have_no_css("tr[data-id=\"#{moderation_id}\"]")
246
246
  end
247
247
  end
@@ -20,7 +20,7 @@ shared_examples "manage participatory space publications" do
20
20
  end
21
21
 
22
22
  it "publishes it" do
23
- expect(page).to have_content("successfully")
23
+ expect(page).to have_callout(publish_callout_message)
24
24
 
25
25
  visit public_collection_path
26
26
 
@@ -50,7 +50,7 @@ shared_examples "manage participatory space publications" do
50
50
  click_on "Unpublish"
51
51
  end
52
52
 
53
- expect(page).to have_content("successfully")
53
+ expect(page).to have_callout(unpublish_callout_message)
54
54
 
55
55
  visit public_collection_path
56
56
 
@@ -26,7 +26,7 @@ shared_examples "manage soft deletable component or space" do |resource_name|
26
26
  end
27
27
  end
28
28
 
29
- expect(page).to have_admin_callout("successfully")
29
+ expect(page).to have_callout("#{resource_name.capitalize} successfully deleted.")
30
30
 
31
31
  within "table" do
32
32
  expect(page).to have_no_content(title[:en])
@@ -81,7 +81,7 @@ shared_examples "manage soft deletable resource" do |resource_name|
81
81
  accept_confirm { click_on "Move to trash" }
82
82
  end
83
83
 
84
- expect(page).to have_admin_callout("successfully")
84
+ expect(page).to have_callout("#{resource_name.capitalize} successfully deleted.")
85
85
 
86
86
  within "table" do
87
87
  expect(page).to have_no_content(title[:en])
@@ -118,7 +118,7 @@ shared_examples "manage trashed resource" do |resource_name|
118
118
  click_on "Restore"
119
119
  end
120
120
 
121
- expect(page).to have_admin_callout("successfully")
121
+ expect(page).to have_callout("#{resource_name.capitalize} successfully restored.")
122
122
  visit trash_path
123
123
  within "table" do
124
124
  expect(page).to have_no_content(title[:en])
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-admin version.
5
5
  module Admin
6
6
  def self.version
7
- "0.31.6"
7
+ "0.32.0.rc1"
8
8
  end
9
9
  end
10
10
  end
data/lib/decidim/admin.rb CHANGED
@@ -15,8 +15,6 @@ module Decidim
15
15
  autoload :Import, "decidim/admin/import"
16
16
  autoload :CustomImport, "decidim/admin/custom_import"
17
17
 
18
- include ActiveSupport::Configurable
19
-
20
18
  # Public: Stores an instance of ViewHooks
21
19
  def self.view_hooks
22
20
  @view_hooks ||= ViewHooks.new