decidim-admin 0.28.1 → 0.29.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (228) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/admin/content_block_cell.rb +0 -1
  3. data/app/cells/decidim/admin/results_per_page/show.erb +2 -2
  4. data/app/cells/decidim/admin/results_per_page_cell.rb +0 -2
  5. data/app/commands/decidim/admin/create_area.rb +4 -32
  6. data/app/commands/decidim/admin/create_area_type.rb +4 -33
  7. data/app/commands/decidim/admin/create_attachment.rb +5 -4
  8. data/app/commands/decidim/admin/create_attachment_collection.rb +3 -3
  9. data/app/commands/decidim/admin/create_category.rb +4 -37
  10. data/app/commands/decidim/admin/create_component.rb +7 -40
  11. data/app/commands/decidim/admin/create_newsletter.rb +11 -29
  12. data/app/commands/decidim/admin/create_participatory_space_private_user.rb +3 -3
  13. data/app/commands/decidim/admin/create_scope.rb +15 -32
  14. data/app/commands/decidim/admin/create_scope_type.rb +3 -32
  15. data/app/commands/decidim/admin/create_static_page.rb +6 -47
  16. data/app/commands/decidim/admin/create_static_page_topic.rb +4 -26
  17. data/app/commands/decidim/admin/deliver_newsletter.rb +4 -5
  18. data/app/commands/decidim/admin/destroy_area.rb +2 -25
  19. data/app/commands/decidim/admin/destroy_category.rb +4 -29
  20. data/app/commands/decidim/admin/destroy_component.rb +5 -42
  21. data/app/commands/decidim/admin/destroy_newsletter.rb +2 -30
  22. data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +5 -32
  23. data/app/commands/decidim/admin/destroy_scope.rb +6 -33
  24. data/app/commands/decidim/admin/officialize_user.rb +1 -1
  25. data/app/commands/decidim/admin/participatory_space/create_admin.rb +4 -4
  26. data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +5 -4
  27. data/app/commands/decidim/admin/promote_managed_user.rb +4 -5
  28. data/app/commands/decidim/admin/unofficialize_user.rb +1 -1
  29. data/app/commands/decidim/admin/update_area.rb +2 -41
  30. data/app/commands/decidim/admin/update_area_type.rb +2 -42
  31. data/app/commands/decidim/admin/update_attachment.rb +10 -7
  32. data/app/commands/decidim/admin/update_attachment_collection.rb +3 -3
  33. data/app/commands/decidim/admin/update_category.rb +2 -45
  34. data/app/commands/decidim/admin/update_component.rb +4 -5
  35. data/app/commands/decidim/admin/update_component_permissions.rb +3 -3
  36. data/app/commands/decidim/admin/{update_external_domain_whitelist.rb → update_external_domain_allowlist.rb} +6 -5
  37. data/app/commands/decidim/admin/update_help_sections.rb +6 -3
  38. data/app/commands/decidim/admin/update_newsletter.rb +8 -8
  39. data/app/commands/decidim/admin/update_organization.rb +9 -53
  40. data/app/commands/decidim/admin/update_organization_appearance.rb +10 -81
  41. data/app/commands/decidim/admin/update_scope.rb +7 -40
  42. data/app/commands/decidim/admin/update_scope_type.rb +2 -42
  43. data/app/commands/decidim/admin/update_static_page.rb +5 -46
  44. data/app/commands/decidim/admin/update_static_page_topic.rb +2 -43
  45. data/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
  46. data/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb +2 -2
  47. data/app/controllers/concerns/decidim/admin/filterable.rb +78 -3
  48. data/app/controllers/concerns/decidim/admin/global_moderation_context.rb +1 -1
  49. data/app/controllers/concerns/decidim/admin/needs_admin_tos_accepted.rb +0 -7
  50. data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +1 -1
  51. data/app/controllers/decidim/admin/application_controller.rb +1 -0
  52. data/app/controllers/decidim/admin/area_types_controller.rb +8 -9
  53. data/app/controllers/decidim/admin/areas_controller.rb +1 -1
  54. data/app/controllers/decidim/admin/authorization_workflows_controller.rb +3 -1
  55. data/app/controllers/decidim/admin/categories_controller.rb +2 -2
  56. data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
  57. data/app/controllers/decidim/admin/components_controller.rb +2 -2
  58. data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +2 -2
  59. data/app/controllers/decidim/admin/concerns/has_attachments.rb +2 -2
  60. data/app/controllers/decidim/admin/concerns/has_private_users.rb +1 -1
  61. data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +1 -1
  62. data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
  63. data/app/controllers/decidim/admin/managed_users/promotions_controller.rb +1 -1
  64. data/app/controllers/decidim/admin/moderations/reports_controller.rb +4 -4
  65. data/app/controllers/decidim/admin/moderations_controller.rb +7 -7
  66. data/app/controllers/decidim/admin/newsletter_templates_controller.rb +1 -1
  67. data/app/controllers/decidim/admin/newsletters_controller.rb +5 -5
  68. data/app/controllers/decidim/admin/organization_appearance_controller.rb +1 -1
  69. data/app/controllers/decidim/admin/organization_controller.rb +8 -5
  70. data/app/controllers/decidim/admin/{organization_external_domain_whitelist_controller.rb → organization_external_domain_allowlist_controller.rb} +7 -7
  71. data/app/controllers/decidim/admin/scope_types_controller.rb +7 -8
  72. data/app/controllers/decidim/admin/scopes_controller.rb +1 -1
  73. data/app/controllers/decidim/admin/share_tokens_controller.rb +1 -1
  74. data/app/controllers/decidim/admin/static_page_topics_controller.rb +2 -2
  75. data/app/controllers/decidim/admin/static_pages_controller.rb +2 -2
  76. data/app/forms/decidim/admin/attachment_form.rb +7 -1
  77. data/app/forms/decidim/admin/organization_appearance_form.rb +0 -3
  78. data/app/forms/decidim/admin/{organization_external_domain_whitelist_form.rb → organization_external_domain_allowlist_form.rb} +3 -3
  79. data/app/forms/decidim/admin/organization_form.rb +2 -2
  80. data/app/forms/decidim/admin/static_page_form.rb +0 -1
  81. data/app/helpers/decidim/admin/filterable_helper.rb +19 -3
  82. data/app/helpers/decidim/admin/moderations/reports_helper.rb +3 -1
  83. data/app/helpers/decidim/admin/newsletters_helper.rb +3 -3
  84. data/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb +2 -2
  85. data/app/packs/entrypoints/decidim_admin.js +4 -1
  86. data/app/packs/src/decidim/admin/application.js +25 -16
  87. data/app/packs/src/decidim/admin/choose_language.js +2 -0
  88. data/app/packs/src/decidim/admin/css_preview.js +39 -0
  89. data/app/packs/src/decidim/admin/dynamic_fields.component.js +2 -1
  90. data/app/packs/src/decidim/admin/form.js +18 -1
  91. data/app/packs/src/decidim/admin/participatory_space_search.js +1 -1
  92. data/app/packs/src/decidim/admin/proposal_infinite_edit.js +2 -2
  93. data/app/packs/src/decidim/admin/sync_radio_buttons.js +27 -0
  94. data/app/packs/src/decidim/admin/text_copy.js +19 -0
  95. data/app/packs/stylesheets/decidim/admin/_cards.scss +1 -1
  96. data/app/packs/stylesheets/decidim/admin/_datepicker.scss +62 -0
  97. data/app/packs/stylesheets/decidim/admin/_item_edit.scss +1 -1
  98. data/app/packs/stylesheets/decidim/admin/_item_show.scss +8 -0
  99. data/app/packs/stylesheets/decidim/admin/_proposal_status.scss +5 -0
  100. data/app/packs/stylesheets/decidim/admin/application.scss +2 -0
  101. data/app/permissions/decidim/admin/permissions.rb +2 -2
  102. data/app/queries/decidim/admin/user_filter.rb +4 -4
  103. data/app/queries/decidim/admin/user_groups_evaluation.rb +1 -1
  104. data/app/views/decidim/admin/attachment_collections/index.html.erb +1 -1
  105. data/app/views/decidim/admin/attachments/_form.html.erb +21 -2
  106. data/app/views/decidim/admin/attachments/index.html.erb +2 -2
  107. data/app/views/decidim/admin/authorization_workflows/index.html.erb +26 -8
  108. data/app/views/decidim/admin/categories/index.html.erb +2 -2
  109. data/app/views/decidim/admin/components/_form.html.erb +1 -1
  110. data/app/views/decidim/admin/dashboard/_pending_moderations.html.erb +1 -1
  111. data/app/views/decidim/admin/dashboard/show.html.erb +1 -1
  112. data/app/views/decidim/admin/exports/_dropdown.html.erb +1 -1
  113. data/app/views/decidim/admin/impersonatable_users/index.html.erb +3 -3
  114. data/app/views/decidim/admin/imports/_dropdown.html.erb +1 -1
  115. data/app/views/decidim/admin/imports/new.html.erb +2 -2
  116. data/app/views/decidim/admin/logs/_filters.html.erb +3 -3
  117. data/app/views/decidim/admin/managed_users/promotions/new.html.erb +1 -1
  118. data/app/views/decidim/admin/moderated_users/index.html.erb +2 -2
  119. data/app/views/decidim/admin/moderations/index.html.erb +5 -5
  120. data/app/views/decidim/admin/moderations/reports/index.html.erb +6 -6
  121. data/app/views/decidim/admin/moderations/reports/show.html.erb +4 -4
  122. data/app/views/decidim/admin/newsletter_templates/index.html.erb +2 -2
  123. data/app/views/decidim/admin/newsletter_templates/show.html.erb +7 -7
  124. data/app/views/decidim/admin/newsletters/index.html.erb +1 -1
  125. data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +3 -3
  126. data/app/views/decidim/admin/newsletters/show.html.erb +1 -1
  127. data/app/views/decidim/admin/organization/_form.html.erb +3 -3
  128. data/app/views/decidim/admin/organization_appearance/form/_colors.html.erb +0 -3
  129. data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -5
  130. data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/_external_domain.html.erb +4 -4
  131. data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/_form.html.erb +2 -2
  132. data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/edit.html.erb +2 -2
  133. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +1 -1
  134. data/app/views/decidim/admin/participatory_space_private_users_csv_imports/new.html.erb +1 -1
  135. data/app/views/decidim/admin/share_tokens/_share_tokens.html.erb +1 -1
  136. data/app/views/decidim/admin/shared/_adjacent_navigation.html.erb +30 -0
  137. data/app/views/decidim/admin/shared/_admin_confirm_modal.html.erb +7 -7
  138. data/app/views/decidim/admin/shared/_filters.html.erb +1 -1
  139. data/app/views/decidim/admin/shared/_gallery.html.erb +1 -1
  140. data/app/views/decidim/admin/shared/_js-callout.html.erb +2 -2
  141. data/app/views/decidim/admin/shared/landing_page/_content_blocks.html.erb +2 -2
  142. data/app/views/decidim/admin/static_page_topics/index.html.erb +1 -1
  143. data/app/views/decidim/admin/static_pages/_form.html.erb +0 -4
  144. data/app/views/decidim/admin/users_statistics/_users_count.html.erb +2 -2
  145. data/app/views/layouts/decidim/admin/_admin_timeout_modal.html.erb +2 -2
  146. data/app/views/layouts/decidim/admin/_application.html.erb +4 -4
  147. data/app/views/layouts/decidim/admin/_callouts_full.html.erb +1 -1
  148. data/app/views/layouts/decidim/admin/_js_configuration.html.erb +3 -1
  149. data/app/views/layouts/decidim/admin/_sidebar_menu.html.erb +2 -2
  150. data/app/views/layouts/decidim/admin/_title_bar.html.erb +2 -2
  151. data/app/views/layouts/decidim/admin/_title_bar_responsive.html.erb +2 -2
  152. data/config/locales/ar.yml +1 -7
  153. data/config/locales/bg.yml +1013 -11
  154. data/config/locales/ca.yml +18 -11
  155. data/config/locales/cs.yml +17 -10
  156. data/config/locales/de.yml +25 -18
  157. data/config/locales/el.yml +1 -12
  158. data/config/locales/en.yml +18 -11
  159. data/config/locales/es-MX.yml +25 -18
  160. data/config/locales/es-PY.yml +25 -18
  161. data/config/locales/es.yml +34 -27
  162. data/config/locales/eu.yml +18 -11
  163. data/config/locales/fi-plain.yml +16 -9
  164. data/config/locales/fi.yml +16 -9
  165. data/config/locales/fr-CA.yml +16 -9
  166. data/config/locales/fr.yml +15 -8
  167. data/config/locales/ga-IE.yml +1 -3
  168. data/config/locales/gl.yml +1 -5
  169. data/config/locales/hu.yml +10 -10
  170. data/config/locales/id-ID.yml +1 -3
  171. data/config/locales/is-IS.yml +1 -3
  172. data/config/locales/it.yml +2 -8
  173. data/config/locales/ja.yml +18 -11
  174. data/config/locales/kaa.yml +0 -3
  175. data/config/locales/ko.yml +0 -6
  176. data/config/locales/lb.yml +1 -8
  177. data/config/locales/lt.yml +2 -13
  178. data/config/locales/lv.yml +1 -3
  179. data/config/locales/nl.yml +1 -8
  180. data/config/locales/no.yml +1 -8
  181. data/config/locales/pl.yml +17 -9
  182. data/config/locales/pt-BR.yml +9 -10
  183. data/config/locales/pt.yml +1 -8
  184. data/config/locales/ro-RO.yml +1 -12
  185. data/config/locales/ru.yml +1 -3
  186. data/config/locales/sk.yml +1 -3
  187. data/config/locales/sl.yml +1 -0
  188. data/config/locales/sq-AL.yml +410 -0
  189. data/config/locales/sr-CS.yml +1 -3
  190. data/config/locales/sv.yml +1 -8
  191. data/config/locales/th-TH.yml +98 -0
  192. data/config/locales/tr-TR.yml +1 -5
  193. data/config/locales/uk.yml +1 -3
  194. data/config/locales/zh-CN.yml +1 -3
  195. data/config/locales/zh-TW.yml +2 -12
  196. data/config/routes.rb +1 -1
  197. data/decidim-admin.gemspec +1 -1
  198. data/lib/decidim/admin/import/creator.rb +1 -1
  199. data/lib/decidim/admin/import/importer_factory.rb +2 -2
  200. data/lib/decidim/admin/menu.rb +4 -4
  201. data/lib/decidim/admin/test/admin_participatory_space_access_examples.rb +27 -0
  202. data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +3 -2
  203. data/lib/decidim/admin/test/commands/create_category_examples.rb +4 -2
  204. data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +3 -2
  205. data/lib/decidim/admin/test/commands/update_category_examples.rb +3 -2
  206. data/lib/decidim/admin/test/filterable_examples.rb +5 -3
  207. data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +5 -5
  208. data/lib/decidim/admin/test/invite_participatory_space_admins_shared_examples.rb +180 -0
  209. data/lib/decidim/admin/test/invite_participatory_space_collaborators_shared_examples.rb +67 -0
  210. data/lib/decidim/admin/test/invite_participatory_space_moderators_shared_examples.rb +77 -0
  211. data/lib/decidim/admin/test/invite_participatory_space_users_shared_context.rb +33 -0
  212. data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +24 -23
  213. data/lib/decidim/admin/test/manage_attachments_examples.rb +51 -15
  214. data/lib/decidim/admin/test/manage_categories_examples.rb +24 -21
  215. data/lib/decidim/admin/test/manage_component_permissions_examples.rb +5 -5
  216. data/lib/decidim/admin/test/manage_hide_content_examples.rb +8 -4
  217. data/lib/decidim/admin/test/manage_moderations_examples.rb +21 -21
  218. data/lib/decidim/admin/test/manage_paginated_collection_examples.rb +3 -3
  219. data/lib/decidim/admin/test/manage_participatory_space_publications_examples.rb +2 -2
  220. data/lib/decidim/admin/test.rb +1 -0
  221. data/lib/decidim/admin/version.rb +1 -1
  222. metadata +32 -27
  223. data/app/commands/decidim/admin/destroy_share_token.rb +0 -46
  224. data/app/commands/decidim/admin/destroy_static_page.rb +0 -40
  225. data/app/commands/decidim/admin/destroy_static_page_topic.rb +0 -40
  226. data/app/mailers/decidim/admin/application_mailer.rb +0 -12
  227. data/app/views/layouts/decidim/admin/login.html.erb +0 -19
  228. /data/app/packs/src/decidim/admin/{external_domain_whitelist.js → external_domain_allowlist.js} +0 -0
@@ -2,6 +2,7 @@
2
2
 
3
3
  shared_examples "manage attachment collections examples" do
4
4
  let!(:attachment_collection) { create(:attachment_collection, collection_for:) }
5
+ let(:attributes) { attributes_for(:attachment_collection) }
5
6
 
6
7
  before do
7
8
  visit current_path
@@ -15,32 +16,28 @@ shared_examples "manage attachment collections examples" do
15
16
 
16
17
  it "can view an attachment collection details" do
17
18
  within "#attachment_collections table" do
18
- click_link "Edit"
19
+ click_on "Edit"
19
20
  end
20
21
 
21
- expect(page).to have_selector("input#attachment_collection_name_en[value='#{translated(attachment_collection.name, locale: :en)}']")
22
- expect(page).to have_selector("input#attachment_collection_weight[value='#{attachment_collection.weight}']")
23
- expect(page).to have_selector("input#attachment_collection_description_en[value='#{translated(attachment_collection.description, locale: :en)}']")
22
+ expect(page).to have_css("input#attachment_collection_name_en[value='#{translated(attachment_collection.name, locale: :en)}']")
23
+ expect(page).to have_css("input#attachment_collection_weight[value='#{attachment_collection.weight}']")
24
+ expect(page).to have_css("input#attachment_collection_description_en[value='#{translated(attachment_collection.description, locale: :en)}']")
24
25
  end
25
26
 
26
27
  it "can add attachment collections to a process" do
27
- click_link "New attachment folder"
28
+ click_on "New attachment folder"
28
29
 
29
30
  within ".new_attachment_collection" do
30
31
  fill_in_i18n(
31
32
  :attachment_collection_name,
32
33
  "#attachment_collection-name-tabs",
33
- en: "Application forms",
34
- es: "Formularios de solicitud",
35
- ca: "Formularis de sol·licitud"
34
+ **attributes[:name].except("machine_translations")
36
35
  )
37
36
 
38
37
  fill_in_i18n(
39
38
  :attachment_collection_description,
40
39
  "#attachment_collection-description-tabs",
41
- en: "Contains the application forms",
42
- es: "Contiene los formularios de solicitud",
43
- ca: "Conté els formularis de sol·licitud"
40
+ **attributes[:description].except("machine_translations")
44
41
  )
45
42
 
46
43
  find("*[type=submit]").click
@@ -49,14 +46,17 @@ shared_examples "manage attachment collections examples" do
49
46
  expect(page).to have_admin_callout("successfully")
50
47
 
51
48
  within "#attachment_collections table" do
52
- expect(page).to have_text("Application forms")
49
+ expect(page).to have_content(translated(attributes[:name]))
53
50
  end
51
+
52
+ visit decidim_admin.root_path
53
+ expect(page).to have_content("created the #{translated(attributes[:name])} attachment collection")
54
54
  end
55
55
 
56
56
  it "can update an attachment collection" do
57
57
  within "#attachment_collections" do
58
- within find("tr", text: translated(attachment_collection.name)) do
59
- click_link "Edit"
58
+ within "tr", text: translated(attachment_collection.name) do
59
+ click_on "Edit"
60
60
  end
61
61
  end
62
62
 
@@ -64,9 +64,7 @@ shared_examples "manage attachment collections examples" do
64
64
  fill_in_i18n(
65
65
  :attachment_collection_name,
66
66
  "#attachment_collection-name-tabs",
67
- en: "Latest application forms",
68
- es: "Últimos formularios de solicitud",
69
- ca: "Últims formularis de sol·licitud"
67
+ **attributes[:name].except("machine_translations")
70
68
  )
71
69
 
72
70
  find("*[type=submit]").click
@@ -75,8 +73,11 @@ shared_examples "manage attachment collections examples" do
75
73
  expect(page).to have_admin_callout("successfully")
76
74
 
77
75
  within "#attachment_collections table" do
78
- expect(page).to have_text("Latest application forms")
76
+ expect(page).to have_content(translated(attributes[:name]))
79
77
  end
78
+
79
+ visit decidim_admin.root_path
80
+ expect(page).to have_content("updated the #{translated(attributes[:name])} attachment collection")
80
81
  end
81
82
 
82
83
  context "when deleting a attachment collection" do
@@ -88,14 +89,14 @@ shared_examples "manage attachment collections examples" do
88
89
  end
89
90
 
90
91
  it "can delete the attachment collection" do
91
- within find("tr", text: translated(attachment_collection2.name)) do
92
- accept_confirm { click_link "Delete" }
92
+ within "tr", text: translated(attachment_collection2.name) do
93
+ accept_confirm { click_on "Delete" }
93
94
  end
94
95
 
95
96
  expect(page).to have_admin_callout("successfully")
96
97
 
97
98
  within "#attachment_collections table" do
98
- expect(page).not_to have_content(translated(attachment_collection2.name))
99
+ expect(page).to have_no_content(translated(attachment_collection2.name))
99
100
  end
100
101
  end
101
102
  end
@@ -108,8 +109,8 @@ shared_examples "manage attachment collections examples" do
108
109
  end
109
110
 
110
111
  it "cannot delete it" do
111
- within find("tr", text: translated(attachment_collection.name)) do
112
- expect(page).not_to have_selector("a.action-icon--remove")
112
+ within "tr", text: translated(attachment_collection.name) do
113
+ expect(page).to have_no_css("a.action-icon--remove")
113
114
  end
114
115
  end
115
116
  end
@@ -19,18 +19,18 @@ shared_examples "manage attachments examples" do
19
19
 
20
20
  it "can view an attachment details" do
21
21
  within "#attachments table" do
22
- click_link "Edit"
22
+ click_on "Edit"
23
23
  end
24
24
 
25
- expect(page).to have_selector("input#attachment_title_en[value='#{translated(attachment.title, locale: :en)}']")
26
- expect(page).to have_selector("input#attachment_description_en[value='#{translated(attachment.description, locale: :en)}']")
27
- expect(page).to have_selector("input#attachment_weight[value='#{attachment.weight}']")
25
+ expect(page).to have_css("input#attachment_title_en[value='#{translated(attachment.title, locale: :en)}']")
26
+ expect(page).to have_css("input#attachment_description_en[value='#{translated(attachment.description, locale: :en)}']")
27
+ expect(page).to have_css("input#attachment_weight[value='#{attachment.weight}']")
28
28
  expect(page).to have_select("attachment_attachment_collection_id", selected: translated(attachment_collection.name, locale: :en))
29
29
  expect(page).to have_css("img[src~='#{attachment.url}']")
30
30
  end
31
31
 
32
32
  it "can add attachments without a collection to a process" do
33
- click_link "New attachment"
33
+ click_on "New attachment"
34
34
 
35
35
  within ".new_attachment" do
36
36
  fill_in_i18n(
@@ -63,8 +63,44 @@ shared_examples "manage attachments examples" do
63
63
  end
64
64
  end
65
65
 
66
+ it "can add attachments with a link to a process" do
67
+ click_on "New attachment"
68
+
69
+ within ".new_attachment" do
70
+ fill_in_i18n(
71
+ :attachment_title,
72
+ "#attachment-title-tabs",
73
+ en: "Very Important Document",
74
+ es: "Documento Muy Importante",
75
+ ca: "Document Molt Important"
76
+ )
77
+
78
+ fill_in_i18n(
79
+ :attachment_description,
80
+ "#attachment-description-tabs",
81
+ en: "This document contains important information",
82
+ es: "Este documento contiene información importante",
83
+ ca: "Aquest document conté informació important"
84
+ )
85
+ end
86
+
87
+ within ".new_attachment" do
88
+ find_by_id("trigger-link").click
89
+
90
+ fill_in "attachment[link]", with: "https://example.com/docs.pdf"
91
+
92
+ find("*[type=submit]").click
93
+ end
94
+
95
+ expect(page).to have_admin_callout("successfully")
96
+
97
+ within "#attachments table" do
98
+ expect(page).to have_text("Very Important Document")
99
+ end
100
+ end
101
+
66
102
  it "can add attachments within a collection to a process" do
67
- click_link "New attachment"
103
+ click_on "New attachment"
68
104
 
69
105
  within ".new_attachment" do
70
106
  fill_in_i18n(
@@ -102,9 +138,9 @@ shared_examples "manage attachments examples" do
102
138
 
103
139
  it "can remove an attachment from a collection" do
104
140
  within "#attachments" do
105
- within find("tr", text: translated(attachment.title)) do
141
+ within "tr", text: translated(attachment.title) do
106
142
  expect(page).to have_text(translated(attachment_collection.name, locale: :en))
107
- click_link "Edit"
143
+ click_on "Edit"
108
144
  end
109
145
  end
110
146
 
@@ -115,26 +151,26 @@ shared_examples "manage attachments examples" do
115
151
  end
116
152
 
117
153
  within "#attachments" do
118
- within find("tr", text: translated(attachment.title)) do
119
- expect(page).not_to have_text(translated(attachment_collection.name, locale: :en))
154
+ within "tr", text: translated(attachment.title) do
155
+ expect(page).to have_no_text(translated(attachment_collection.name, locale: :en))
120
156
  end
121
157
  end
122
158
  end
123
159
 
124
160
  it "can delete an attachment from a process" do
125
- within find("tr", text: translated(attachment.title)) do
126
- accept_confirm { click_link "Delete" }
161
+ within "tr", text: translated(attachment.title) do
162
+ accept_confirm { click_on "Delete" }
127
163
  end
128
164
 
129
165
  expect(page).to have_admin_callout("successfully")
130
166
 
131
- expect(page).not_to have_content(translated(attachment.title, locale: :en))
167
+ expect(page).to have_no_content(translated(attachment.title, locale: :en))
132
168
  end
133
169
 
134
170
  it "can update an attachment" do
135
171
  within "#attachments" do
136
- within find("tr", text: translated(attachment.title)) do
137
- click_link "Edit"
172
+ within "tr", text: translated(attachment.title) do
173
+ click_on "Edit"
138
174
  end
139
175
  end
140
176
 
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  shared_examples "manage categories examples" do
4
+ let(:attributes) { attributes_for(:category) }
4
5
  it "lists all the categories for the process" do
5
6
  within "#categories table" do
6
7
  expect(page).to have_content(translated(category.name, locale: :en))
@@ -9,25 +10,23 @@ shared_examples "manage categories examples" do
9
10
 
10
11
  it "can view a category detail" do
11
12
  within "#categories table" do
12
- click_link translated(category.name, locale: :en)
13
+ click_on translated(category.name, locale: :en)
13
14
  end
14
15
 
15
- expect(page).to have_selector("input#category_name_en[value='#{translated(category.name, locale: :en)}']")
16
- expect(page).to have_selector("input#category_weight[value='#{category.weight}']")
16
+ expect(page).to have_css("input#category_name_en[value='#{translated(category.name, locale: :en)}']")
17
+ expect(page).to have_css("input#category_weight[value='#{category.weight}']")
17
18
 
18
19
  expect(page).to have_select(id: "category_parent_id")
19
20
  end
20
21
 
21
22
  it "creates a new category" do
22
- click_link "New category"
23
+ click_on "New category"
23
24
 
24
25
  within ".new_category" do
25
26
  fill_in_i18n(
26
27
  :category_name,
27
28
  "#category-name-tabs",
28
- en: "My category",
29
- es: "Mi categoría",
30
- ca: "La meva categoria"
29
+ **attributes[:name].except("machine_translations")
31
30
  )
32
31
 
33
32
  find("*[type=submit]").click
@@ -36,14 +35,17 @@ shared_examples "manage categories examples" do
36
35
  expect(page).to have_admin_callout("successfully")
37
36
 
38
37
  within "#categories table" do
39
- expect(page).to have_content("My category")
38
+ expect(page).to have_content(translated(attributes[:name]))
40
39
  end
40
+
41
+ visit decidim_admin.root_path
42
+ expect(page).to have_content("added the #{translated(attributes[:name])} category to the")
41
43
  end
42
44
 
43
45
  it "updates a category" do
44
46
  within "#categories" do
45
- within find("tr", text: translated(category.name)) do
46
- click_link "Edit"
47
+ within "tr", text: translated(category.name) do
48
+ click_on "Edit"
47
49
  end
48
50
  end
49
51
 
@@ -51,9 +53,7 @@ shared_examples "manage categories examples" do
51
53
  fill_in_i18n(
52
54
  :category_name,
53
55
  "#category-name-tabs",
54
- en: "My new name",
55
- es: "Mi nuevo nombre",
56
- ca: "El meu nou nom"
56
+ **attributes[:name].except("machine_translations")
57
57
  )
58
58
 
59
59
  find("*[type=submit]").click
@@ -62,8 +62,11 @@ shared_examples "manage categories examples" do
62
62
  expect(page).to have_admin_callout("successfully")
63
63
 
64
64
  within "#categories table" do
65
- expect(page).to have_content("My new name")
65
+ expect(page).to have_content(translated(attributes[:name]))
66
66
  end
67
+
68
+ visit decidim_admin.root_path
69
+ expect(page).to have_content("updated the #{translated(attributes[:name])} category in the")
67
70
  end
68
71
 
69
72
  context "when deleting a category" do
@@ -76,14 +79,14 @@ shared_examples "manage categories examples" do
76
79
  end
77
80
 
78
81
  it "deletes a category" do
79
- within find("tr", text: translated(category2.name)) do
80
- accept_confirm { click_link "Delete" }
82
+ within "tr", text: translated(category2.name) do
83
+ accept_confirm { click_on "Delete" }
81
84
  end
82
85
 
83
86
  expect(page).to have_admin_callout("successfully")
84
87
 
85
88
  within "#categories table" do
86
- expect(page).not_to have_content(translated(category2.name))
89
+ expect(page).to have_no_content(translated(category2.name))
87
90
  end
88
91
  end
89
92
  end
@@ -96,8 +99,8 @@ shared_examples "manage categories examples" do
96
99
  end
97
100
 
98
101
  it "deletes a category" do
99
- within find("tr", text: translated(category2.name)) do
100
- accept_confirm { click_link "Delete" }
102
+ within "tr", text: translated(category2.name) do
103
+ accept_confirm { click_on "Delete" }
101
104
  end
102
105
 
103
106
  expect(page).to have_admin_callout("problem deleting")
@@ -116,8 +119,8 @@ shared_examples "manage categories examples" do
116
119
  it "cannot delete it" do
117
120
  visit current_path
118
121
 
119
- within find("tr", text: translated(category.name)) do
120
- expect(page).not_to have_selector("a.action-icon--remove")
122
+ within "tr", text: translated(category.name) do
123
+ expect(page).to have_no_css("a.action-icon--remove")
121
124
  end
122
125
  end
123
126
  end
@@ -23,7 +23,7 @@ shared_examples "Managing component permissions" do
23
23
  context "when setting permissions" do
24
24
  before do
25
25
  within ".component-#{component.id}" do
26
- click_link "Permissions"
26
+ click_on "Permissions"
27
27
  end
28
28
  end
29
29
 
@@ -54,7 +54,7 @@ shared_examples "Managing component permissions" do
54
54
  before do
55
55
  allow_any_instance_of(Decidim::Admin::PermissionsForm).to receive(:valid?).and_return(false)
56
56
  within ".component-#{component.id}" do
57
- click_link "Permissions"
57
+ click_on "Permissions"
58
58
  end
59
59
  within "#components form" do
60
60
  within ".foo-permission" do
@@ -85,7 +85,7 @@ shared_examples "Managing component permissions" do
85
85
  )
86
86
 
87
87
  within ".component-#{component.id}" do
88
- click_link "Permissions"
88
+ click_on "Permissions"
89
89
  end
90
90
  end
91
91
 
@@ -120,7 +120,7 @@ shared_examples "Managing component permissions" do
120
120
  )
121
121
 
122
122
  within ".component-#{component.id}" do
123
- click_link "Permissions"
123
+ click_on "Permissions"
124
124
  end
125
125
  end
126
126
 
@@ -206,7 +206,7 @@ shared_examples "Managing component permissions" do
206
206
  let(:component_settings) { { resources_permissions_enabled: false } }
207
207
 
208
208
  it "does not show the resource permissions settings" do
209
- expect(page).not_to have_content(resource.title)
209
+ expect(page).to have_no_content(resource.title)
210
210
  end
211
211
  end
212
212
 
@@ -19,7 +19,7 @@ shared_examples "hideable resource during block" do
19
19
  visit reportable_path
20
20
 
21
21
  within ".profile__actions-secondary", match: :first do
22
- click_button(I18n.t("decidim.shared.flag_modal.report"))
22
+ click_on(I18n.t("decidim.shared.flag_modal.report"))
23
23
  end
24
24
  within ".flag-modal" do
25
25
  find(:css, "input[name='report[block]']").set(true)
@@ -31,7 +31,7 @@ shared_examples "hideable resource during block" do
31
31
  within ".flag-modal" do
32
32
  find(:css, "input[name='report[hide]']").set(true)
33
33
  end
34
- click_button I18n.t("decidim.shared.flag_user_modal.block")
34
+ click_on I18n.t("decidim.shared.flag_user_modal.block")
35
35
  expect(page).to have_current_path(decidim_admin.new_user_block_path(user_id: reportable.id, hide: true))
36
36
  end
37
37
 
@@ -46,14 +46,18 @@ shared_examples "hideable resource during block" do
46
46
  within ".flag-modal" do
47
47
  find(:css, "input[name='report[hide]']").set(true)
48
48
  end
49
- click_button I18n.t("decidim.shared.flag_user_modal.block")
49
+ click_on I18n.t("decidim.shared.flag_user_modal.block")
50
50
  expect(page).to have_current_path(decidim_admin.new_user_block_path(user_id: reportable.id, hide: true))
51
51
 
52
52
  fill_in :block_user_justification, with: "This user is a spammer" * 2 # to have at least 15 chars
53
53
 
54
- click_button I18n.t("decidim.admin.block_user.new.action")
54
+ click_on I18n.t("decidim.admin.block_user.new.action")
55
55
 
56
56
  expect(content.reload).to be_hidden
57
+
58
+ visit decidim_admin.root_path
59
+ expect(page).to have_content("blocked user")
60
+ expect(page).to have_content("hid a resource of type")
57
61
  end
58
62
  end
59
63
  end
@@ -15,16 +15,16 @@ shared_examples "sorted moderations" do
15
15
  before do
16
16
  visit participatory_space_path
17
17
  if moderations_link_in_admin_menu
18
- within_admin_sidebar_menu { click_link(moderations_link_text) }
18
+ within_admin_sidebar_menu { click_on(moderations_link_text) }
19
19
  else
20
- within("div.layout-nav") { click_link(moderations_link_text) }
20
+ within("div.layout-nav") { click_on(moderations_link_text) }
21
21
  end
22
22
  end
23
23
 
24
24
  it "sorts the most recent first" do
25
25
  link_text = find("ul[data-pages]").text.split("\n")[-2]
26
26
  within "ul[data-pages]" do
27
- click_link link_text
27
+ click_on link_text
28
28
  end
29
29
  all("tbody tr").each_with_index do |row, _index|
30
30
  expect(row.find("td:first-child")).to have_content(reportables.first.id)
@@ -54,9 +54,9 @@ shared_examples "manage moderations" do
54
54
  before do
55
55
  visit participatory_space_path
56
56
  if moderations_link_in_admin_menu
57
- within_admin_sidebar_menu { click_link(moderations_link_text) }
57
+ within_admin_sidebar_menu { click_on(moderations_link_text) }
58
58
  else
59
- within("div.layout-nav") { click_link(moderations_link_text) }
59
+ within("div.layout-nav") { click_on(moderations_link_text) }
60
60
  end
61
61
  end
62
62
 
@@ -68,7 +68,7 @@ shared_examples "manage moderations" do
68
68
 
69
69
  visit current_path
70
70
 
71
- expect(page).not_to have_selector("tr[data-id=\"#{external_moderation.id}\"]")
71
+ expect(page).to have_no_css("tr[data-id=\"#{external_moderation.id}\"]")
72
72
  end
73
73
 
74
74
  it "user can review them" do
@@ -82,7 +82,7 @@ shared_examples "manage moderations" do
82
82
 
83
83
  it "user can un-report a resource" do
84
84
  within "tr[data-id=\"#{moderation.id}\"]" do
85
- click_link "Unreport"
85
+ click_on "Unreport"
86
86
  end
87
87
 
88
88
  expect(page).to have_admin_callout("Resource successfully unreported")
@@ -90,11 +90,11 @@ shared_examples "manage moderations" do
90
90
 
91
91
  it "user can hide a resource" do
92
92
  within "tr[data-id=\"#{moderation.id}\"]" do
93
- click_link "Hide"
93
+ click_on "Hide"
94
94
  end
95
95
 
96
96
  expect(page).to have_admin_callout("Resource successfully hidden")
97
- expect(page).not_to have_content(moderation.reportable.reported_content_url)
97
+ expect(page).to have_no_content(moderation.reportable.reported_content_url)
98
98
  end
99
99
 
100
100
  it "user can sort by report count" do
@@ -102,7 +102,7 @@ shared_examples "manage moderations" do
102
102
  moderations_ordered_by_report_count_asc = moderations.sort_by(&:report_count)
103
103
 
104
104
  within "table" do
105
- click_link "Reports count"
105
+ click_on "Reports count"
106
106
 
107
107
  all("tbody tr").each_with_index do |row, index|
108
108
  reportable_id = moderations_ordered_by_report_count_asc[index].reportable.id
@@ -116,23 +116,23 @@ shared_examples "manage moderations" do
116
116
  within ".filters__section" do
117
117
  find(:xpath, "//a[contains(text(), 'Filter')]").hover
118
118
  find(:xpath, "//a[contains(text(), 'Type')]").hover
119
- click_link reportable_type
119
+ click_on reportable_type
120
120
  end
121
- expect(page).to have_selector("tbody tr", count: moderations.length)
121
+ expect(page).to have_css("tbody tr", count: moderations.length)
122
122
  end
123
123
 
124
124
  it "user can filter by reported content" do
125
125
  search = moderation.reportable.id
126
126
  within ".filters__section" do
127
127
  fill_in("Search Moderation by reportable id or content.", with: search)
128
- click_button(type: "submit")
128
+ within(".input-group-button") { click_on(class: "text-secondary") }
129
129
  end
130
- expect(page).to have_selector("tbody tr", count: 1)
130
+ expect(page).to have_css("tbody tr", count: 1)
131
131
  end
132
132
 
133
133
  it "user can see moderation details" do
134
134
  within "tr[data-id=\"#{moderation.id}\"]" do
135
- click_link "Expand"
135
+ click_on "Expand"
136
136
  end
137
137
 
138
138
  reported_content_slice = moderation.reportable.reported_searchable_content_text.split("\n").first
@@ -144,7 +144,7 @@ shared_examples "manage moderations" do
144
144
  moderation.reportable.destroy
145
145
  visit current_path
146
146
 
147
- expect(page).not_to have_selector("tr[data-id=\"#{moderation.id}\"]")
147
+ expect(page).to have_no_css("tr[data-id=\"#{moderation.id}\"]")
148
148
  end
149
149
  end
150
150
 
@@ -170,7 +170,7 @@ shared_examples "manage moderations" do
170
170
  )
171
171
 
172
172
  within_language_menu(admin: true) do
173
- click_link "Català"
173
+ click_on "Català"
174
174
  end
175
175
  end
176
176
 
@@ -184,11 +184,11 @@ shared_examples "manage moderations" do
184
184
 
185
185
  context "when listing hidden resources" do
186
186
  before do
187
- click_link "Hidden"
187
+ click_on "Hidden"
188
188
  end
189
189
 
190
190
  it "user cannot unreport them" do
191
- expect(page).not_to have_css(".action-icon--unreport")
191
+ expect(page).to have_no_css(".action-icon--unreport")
192
192
  end
193
193
 
194
194
  it "user can review them" do
@@ -231,11 +231,11 @@ shared_examples "manage moderations" do
231
231
  it "user can hide them" do
232
232
  moderation_id = moderations.first.id
233
233
  within "tr[data-id=\"#{moderation_id}\"]" do
234
- click_link "Hide"
234
+ click_on "Hide"
235
235
  end
236
236
 
237
237
  expect(page).to have_admin_callout("Resource successfully hidden")
238
- expect(page).not_to have_selector("tr[data-id=\"#{moderation_id}\"]")
238
+ expect(page).to have_no_css("tr[data-id=\"#{moderation_id}\"]")
239
239
  end
240
240
  end
241
241
  end
@@ -3,7 +3,7 @@
3
3
  shared_examples "a paginated collection" do |options|
4
4
  before do
5
5
  # Current path strips out the request parameters, use current_url when needed
6
- # Be aware that current_utl can lead to flaky, use with caution
6
+ # Be aware that current_url can lead to flaky, use with caution
7
7
  if options&.dig(:url)
8
8
  visit current_url
9
9
  else
@@ -19,10 +19,10 @@ shared_examples "a paginated collection" do |options|
19
19
  it "changes the number of results per page" do
20
20
  within "[data-pagination]" do
21
21
  page.find("details", text: "15").click
22
- click_link "50"
22
+ click_on "50"
23
23
  end
24
24
 
25
- expect(page).to have_selector(".table-list tbody tr", count: 50)
25
+ expect(page).to have_css(".table-list tbody tr", count: 50)
26
26
  end
27
27
  end
28
28
  end
@@ -15,7 +15,7 @@ shared_examples "manage participatory space publications" do |_options|
15
15
  end
16
16
 
17
17
  it "publishes it" do
18
- click_link "Publish"
18
+ click_on "Publish"
19
19
 
20
20
  expect(page).to have_content("successfully")
21
21
 
@@ -42,7 +42,7 @@ shared_examples "manage participatory space publications" do |_options|
42
42
  it "unpublishes it" do
43
43
  # we cannot use "a 404 page" shared example as we want to check it
44
44
  # inside an example
45
- click_link "Unpublish"
45
+ click_on "Unpublish"
46
46
 
47
47
  expect(page).to have_content("successfully")
48
48
 
@@ -14,3 +14,4 @@ require "decidim/admin/test/manage_hide_content_examples"
14
14
  require "decidim/admin/test/needs_admin_tos_accepted_examples"
15
15
  require "decidim/admin/test/destroy_admin_examples"
16
16
  require "decidim/admin/test/commands/publish_participatory_space_examples"
17
+ require "decidim/admin/test/invite_participatory_space_users_shared_context"
@@ -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.28.1"
7
+ "0.29.0.rc1"
8
8
  end
9
9
  end
10
10
  end