decidim-admin 0.28.0 → 0.28.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (167) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/admin/content_block_cell.rb +1 -1
  3. data/app/commands/decidim/admin/destroy_category.rb +1 -1
  4. data/app/controllers/decidim/admin/application_controller.rb +2 -1
  5. data/app/controllers/decidim/admin/area_types_controller.rb +1 -1
  6. data/app/controllers/decidim/admin/authorization_workflows_controller.rb +5 -1
  7. data/app/controllers/decidim/admin/conflicts_controller.rb +23 -0
  8. data/app/controllers/decidim/admin/impersonatable_users_controller.rb +3 -1
  9. data/app/controllers/decidim/admin/impersonations_controller.rb +1 -0
  10. data/app/controllers/decidim/admin/managed_users/impersonation_logs_controller.rb +2 -0
  11. data/app/controllers/decidim/admin/moderated_users_controller.rb +10 -0
  12. data/app/controllers/decidim/admin/moderations_controller.rb +10 -0
  13. data/app/controllers/decidim/admin/officializations_controller.rb +2 -0
  14. data/app/controllers/decidim/admin/organization_controller.rb +7 -4
  15. data/app/controllers/decidim/admin/scope_types_controller.rb +1 -1
  16. data/app/controllers/decidim/admin/static_page_topics_controller.rb +10 -0
  17. data/app/controllers/decidim/admin/user_groups_controller.rb +2 -0
  18. data/app/controllers/decidim/admin/users_controller.rb +2 -0
  19. data/app/events/decidim/resource_hidden_event.rb +5 -1
  20. data/app/helpers/decidim/admin/admin_terms_helper.rb +1 -1
  21. data/app/helpers/decidim/admin/filterable_helper.rb +1 -1
  22. data/app/packs/entrypoints/decidim_admin_overrides.scss +2 -0
  23. data/app/packs/images/decidim/admin/.keep +0 -0
  24. data/app/packs/src/decidim/admin/application.js +14 -1
  25. data/app/packs/src/decidim/admin/choose_language.js +2 -0
  26. data/app/packs/src/decidim/admin/dynamic_fields.component.js +2 -1
  27. data/app/packs/src/decidim/admin/participatory_space_search.js +1 -1
  28. data/app/packs/stylesheets/decidim/admin/_filters.scss +1 -1
  29. data/app/packs/stylesheets/decidim/admin/_legacy_foundation.scss +10 -0
  30. data/app/packs/stylesheets/decidim/admin/_sidebar-menu.scss +4 -4
  31. data/app/packs/stylesheets/decidim/admin/_tabs.scss +6 -0
  32. data/app/packs/stylesheets/decidim/admin/decidim_application.scss +5 -0
  33. data/app/views/decidim/admin/admin_terms/show.html.erb +2 -2
  34. data/app/views/decidim/admin/area_types/edit.html.erb +2 -2
  35. data/app/views/decidim/admin/area_types/index.html.erb +2 -2
  36. data/app/views/decidim/admin/area_types/new.html.erb +2 -2
  37. data/app/views/decidim/admin/areas/edit.html.erb +2 -2
  38. data/app/views/decidim/admin/areas/index.html.erb +2 -2
  39. data/app/views/decidim/admin/areas/new.html.erb +2 -2
  40. data/app/views/decidim/admin/attachment_collections/edit.html.erb +2 -2
  41. data/app/views/decidim/admin/attachment_collections/index.html.erb +2 -2
  42. data/app/views/decidim/admin/attachment_collections/new.html.erb +2 -2
  43. data/app/views/decidim/admin/attachments/edit.html.erb +2 -2
  44. data/app/views/decidim/admin/attachments/index.html.erb +2 -2
  45. data/app/views/decidim/admin/attachments/new.html.erb +2 -2
  46. data/app/views/decidim/admin/authorization_workflows/index.html.erb +2 -2
  47. data/app/views/decidim/admin/block_user/new.html.erb +3 -4
  48. data/app/views/decidim/admin/categories/edit.html.erb +2 -2
  49. data/app/views/decidim/admin/categories/index.html.erb +7 -3
  50. data/app/views/decidim/admin/categories/new.html.erb +2 -2
  51. data/app/views/decidim/admin/components/edit.html.erb +2 -2
  52. data/app/views/decidim/admin/components/index.html.erb +2 -2
  53. data/app/views/decidim/admin/components/new.html.erb +2 -2
  54. data/app/views/decidim/admin/conflicts/index.html.erb +2 -2
  55. data/app/views/decidim/admin/dashboard/show.html.erb +2 -2
  56. data/app/views/decidim/admin/help_sections/_form.html.erb +2 -2
  57. data/app/views/decidim/admin/impersonatable_users/index.html.erb +2 -2
  58. data/app/views/decidim/admin/impersonations/new.html.erb +2 -2
  59. data/app/views/decidim/admin/imports/new.html.erb +2 -2
  60. data/app/views/decidim/admin/managed_users/impersonation_logs/index.html.erb +2 -2
  61. data/app/views/decidim/admin/managed_users/promotions/new.html.erb +2 -2
  62. data/app/views/decidim/admin/moderated_users/index.html.erb +2 -2
  63. data/app/views/decidim/admin/moderations/index.html.erb +2 -2
  64. data/app/views/decidim/admin/moderations/reports/index.html.erb +2 -2
  65. data/app/views/decidim/admin/moderations/reports/show.html.erb +2 -2
  66. data/app/views/decidim/admin/newsletter_templates/index.html.erb +5 -6
  67. data/app/views/decidim/admin/newsletter_templates/show.html.erb +16 -12
  68. data/app/views/decidim/admin/newsletters/edit.html.erb +2 -2
  69. data/app/views/decidim/admin/newsletters/index.html.erb +2 -2
  70. data/app/views/decidim/admin/newsletters/new.html.erb +2 -2
  71. data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +13 -9
  72. data/app/views/decidim/admin/newsletters/show.html.erb +29 -26
  73. data/app/views/decidim/admin/officializations/index.html.erb +1 -1
  74. data/app/views/decidim/admin/officializations/new.html.erb +2 -2
  75. data/app/views/decidim/admin/organization/_form.html.erb +5 -3
  76. data/app/views/decidim/admin/organization/edit.html.erb +2 -2
  77. data/app/views/decidim/admin/organization_appearance/edit.html.erb +2 -2
  78. data/app/views/decidim/admin/organization_external_domain_whitelist/edit.html.erb +2 -2
  79. data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +2 -2
  80. data/app/views/decidim/admin/participatory_space_private_users/new.html.erb +2 -2
  81. data/app/views/decidim/admin/resource_permissions/edit.html.erb +2 -2
  82. data/app/views/decidim/admin/scope_types/edit.html.erb +2 -2
  83. data/app/views/decidim/admin/scope_types/index.html.erb +2 -2
  84. data/app/views/decidim/admin/scope_types/new.html.erb +2 -2
  85. data/app/views/decidim/admin/scopes/edit.html.erb +2 -2
  86. data/app/views/decidim/admin/scopes/index.html.erb +2 -2
  87. data/app/views/decidim/admin/scopes/new.html.erb +2 -2
  88. data/app/views/decidim/admin/shared/_filters.html.erb +1 -1
  89. data/app/views/decidim/admin/shared/_js-callout.html.erb +2 -2
  90. data/app/views/decidim/admin/shared/landing_page/_content_blocks.html.erb +2 -2
  91. data/app/views/decidim/admin/shared/landing_page_content_blocks/edit.html.erb +2 -2
  92. data/app/views/decidim/admin/static_page_topics/edit.html.erb +2 -2
  93. data/app/views/decidim/admin/static_page_topics/index.html.erb +2 -2
  94. data/app/views/decidim/admin/static_page_topics/new.html.erb +2 -2
  95. data/app/views/decidim/admin/static_pages/edit.html.erb +2 -2
  96. data/app/views/decidim/admin/static_pages/index.html.erb +2 -2
  97. data/app/views/decidim/admin/static_pages/new.html.erb +2 -2
  98. data/app/views/decidim/admin/user_groups/index.html.erb +2 -2
  99. data/app/views/decidim/admin/user_groups_csv_verifications/new.html.erb +2 -2
  100. data/app/views/decidim/admin/users/index.html.erb +2 -2
  101. data/app/views/decidim/admin/users/new.html.erb +2 -2
  102. data/app/views/layouts/decidim/admin/_breadcrumb.html.erb +1 -1
  103. data/app/views/layouts/decidim/admin/_header.html.erb +4 -0
  104. data/app/views/layouts/decidim/admin/_js_configuration.html.erb +1 -0
  105. data/app/views/layouts/decidim/admin/_sidebar_menu.html.erb +2 -2
  106. data/config/assets.rb +1 -0
  107. data/config/locales/ar.yml +11 -8
  108. data/config/locales/bg.yml +1025 -3
  109. data/config/locales/ca.yml +4 -1
  110. data/config/locales/cs.yml +6 -8
  111. data/config/locales/de.yml +15 -12
  112. data/config/locales/el.yml +2 -12
  113. data/config/locales/en.yml +4 -1
  114. data/config/locales/es-MX.yml +11 -8
  115. data/config/locales/es-PY.yml +11 -8
  116. data/config/locales/es.yml +20 -17
  117. data/config/locales/eu.yml +8 -5
  118. data/config/locales/fi-plain.yml +4 -1
  119. data/config/locales/fi.yml +6 -3
  120. data/config/locales/fr-CA.yml +5 -2
  121. data/config/locales/fr.yml +4 -1
  122. data/config/locales/ga-IE.yml +2 -4
  123. data/config/locales/gl.yml +8 -7
  124. data/config/locales/he-IL.yml +50 -0
  125. data/config/locales/hu.yml +36 -6
  126. data/config/locales/id-ID.yml +5 -0
  127. data/config/locales/is-IS.yml +5 -0
  128. data/config/locales/it.yml +8 -9
  129. data/config/locales/ja.yml +8 -4
  130. data/config/locales/ko.yml +774 -0
  131. data/config/locales/lb.yml +8 -10
  132. data/config/locales/lt.yml +3 -14
  133. data/config/locales/lv.yml +8 -0
  134. data/config/locales/nl.yml +7 -9
  135. data/config/locales/no.yml +20 -9
  136. data/config/locales/pl.yml +74 -4
  137. data/config/locales/pt-BR.yml +50 -12
  138. data/config/locales/pt.yml +8 -10
  139. data/config/locales/ro-RO.yml +2 -13
  140. data/config/locales/ru.yml +5 -0
  141. data/config/locales/sk.yml +5 -0
  142. data/config/locales/sl.yml +5 -0
  143. data/config/locales/sq-AL.yml +490 -0
  144. data/config/locales/sr-CS.yml +5 -0
  145. data/config/locales/sv.yml +7 -9
  146. data/config/locales/th-TH.yml +101 -0
  147. data/config/locales/tr-TR.yml +11 -0
  148. data/config/locales/uk.yml +5 -0
  149. data/config/locales/zh-CN.yml +5 -0
  150. data/config/locales/zh-TW.yml +3 -11
  151. data/decidim-admin.gemspec +43 -0
  152. data/lib/decidim/admin/engine.rb +1 -25
  153. data/lib/decidim/admin/menu.rb +13 -4
  154. data/lib/decidim/admin/test/admin_participatory_space_access_examples.rb +27 -0
  155. data/lib/decidim/admin/test/commands/destroy_category_examples.rb +9 -0
  156. data/lib/decidim/admin/test/invite_participatory_space_admins_shared_examples.rb +180 -0
  157. data/lib/decidim/admin/test/invite_participatory_space_collaborators_shared_examples.rb +67 -0
  158. data/lib/decidim/admin/test/invite_participatory_space_moderators_shared_examples.rb +77 -0
  159. data/lib/decidim/admin/test/invite_participatory_space_users_shared_context.rb +33 -0
  160. data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +12 -11
  161. data/lib/decidim/admin/test/manage_categories_examples.rb +11 -8
  162. data/lib/decidim/admin/test/manage_hide_content_examples.rb +4 -0
  163. data/lib/decidim/admin/test.rb +1 -0
  164. data/lib/decidim/admin/version.rb +1 -1
  165. metadata +20 -13
  166. data/app/mailers/decidim/admin/application_mailer.rb +0 -12
  167. data/config/environment.rb +0 -3
@@ -131,6 +131,7 @@ tr:
131
131
  actions:
132
132
  add: Eklemek
133
133
  browse: Araştır
134
+ manage: yönetme
134
135
  per_page: Sayfa başına
135
136
  permissions: İzinler
136
137
  reject: reddetmek
@@ -200,6 +201,7 @@ tr:
200
201
  block_user:
201
202
  new:
202
203
  action: Hesabı engelle ve uyarı mesjı gönder
204
+ already_reported_html: Bu işleme devam ederek katılımcıların tüm içeriklerini de gizleyebilirsiniz.
203
205
  justification: Gerekçe
204
206
  title: '%{name} Kullanıcısını Engelle'
205
207
  categories:
@@ -365,6 +367,7 @@ tr:
365
367
  help_sections: Yardım bölümleri
366
368
  homepage: Anasayfa
367
369
  impersonations: impersonations
370
+ manage: yönetme
368
371
  moderation: Küresel denetimler
369
372
  newsletters: Haber bültenleri
370
373
  participants: Katılımcılar
@@ -601,6 +604,9 @@ tr:
601
604
  layout_appearance_title: Düzen görünümünü düzenle
602
605
  preview: Önizleme
603
606
  omnipresent_banner_appearance_title: Her yerde bulunan banner'ı düzenle
607
+ organization_external_domain_whitelist:
608
+ edit:
609
+ update: Güncelleştirme
604
610
  participatory_space_private_users:
605
611
  create:
606
612
  error: Bu katılımcı alan için özel bir kullanıcı eklenirken bir hata oluştu.
@@ -800,3 +806,8 @@ tr:
800
806
  errors:
801
807
  messages:
802
808
  invalid_json: Geçersiz JSON
809
+ layouts:
810
+ decidim:
811
+ admin:
812
+ global_moderations:
813
+ title: Küresel denetimler
@@ -92,6 +92,7 @@ uk:
92
92
  actions:
93
93
  add: Додати
94
94
  browse: Переглянути
95
+ manage: Керувати
95
96
  permissions: Права
96
97
  reject: Відхилити
97
98
  verify: Підтвердити
@@ -272,6 +273,7 @@ uk:
272
273
  configuration: Конфігурація
273
274
  homepage: Домашня сторінка
274
275
  impersonations: Виступи в ролі учасника
276
+ manage: Керувати
275
277
  newsletters: Розсилання новин
276
278
  scope_types: Різновиди обсягу
277
279
  scopes: Обсяги
@@ -423,6 +425,9 @@ uk:
423
425
  images:
424
426
  layout_appearance_title: Редагувати зовнішній вигляд шаблону
425
427
  omnipresent_banner_appearance_title: Редагувати всюдисущий банер
428
+ organization_external_domain_whitelist:
429
+ edit:
430
+ update: Оновити
426
431
  participatory_space_private_users:
427
432
  create:
428
433
  error: При спробі додати приватного учасника до цього простору співучасті сталася помилка.
@@ -125,6 +125,7 @@ zh-CN:
125
125
  actions:
126
126
  add: 添加
127
127
  browse: 浏览
128
+ manage: 管理
128
129
  per_page: 每页
129
130
  permissions: 权限
130
131
  reject: 拒绝
@@ -336,6 +337,7 @@ zh-CN:
336
337
  help_sections: 帮助部分
337
338
  homepage: 主页
338
339
  impersonations: 影像
340
+ manage: 管理
339
341
  newsletters: 新闻通讯
340
342
  participants: 参加者
341
343
  scope_types: 范围类型
@@ -538,6 +540,9 @@ zh-CN:
538
540
  layout_appearance_title: 编辑布局外观
539
541
  preview: 预览
540
542
  omnipresent_banner_appearance_title: Edit omnipresent banner
543
+ organization_external_domain_whitelist:
544
+ edit:
545
+ update: 更新
541
546
  participatory_space_private_users:
542
547
  create:
543
548
  error: 在这种参与空间中添加私人参与者时出现了问题。
@@ -182,6 +182,7 @@ zh-TW:
182
182
  export: 全部匯出
183
183
  export-selection: 匯出選擇
184
184
  import: 匯入
185
+ manage: 管理
185
186
  newsletter:
186
187
  new: 新電子報
187
188
  participatory_space_private_user:
@@ -281,7 +282,6 @@ zh-TW:
281
282
  block_user:
282
283
  new:
283
284
  action: 封鎖帳號並且發送理由
284
- already_reported_html: 繼續操作也會隱藏所有參與者內容, <a href="%{link}">封鎖這個帳號</a>。
285
285
  description: 封鎖一個使用者會讓他的帳號無法使用,可以在此提供建議說明如何取消封鎖
286
286
  justification: 理由
287
287
  title: 封鎖使用者 %{name}
@@ -356,15 +356,11 @@ zh-TW:
356
356
  user_name: 使用者
357
357
  dashboard:
358
358
  pending_moderations:
359
- anouncement:
360
- other: 有 %{count} 個操作等待中
361
359
  goto_moderation: 前往全域管理
362
360
  title: 等待的操作
363
361
  show:
364
362
  view_more_logs: 檢視更多記錄
365
363
  domain_whitelist:
366
- form:
367
- domain_too_short: 網址太短
368
364
  update:
369
365
  error: 網址白名單更新失敗
370
366
  success: 網址白名單更新成功.
@@ -543,12 +539,13 @@ zh-TW:
543
539
  appearance: 外觀
544
540
  area_types: 區域類型
545
541
  areas: 區域
542
+ components: 组件
546
543
  configuration: 配置
547
544
  content: 被檢舉的內容
548
- external_domain_whitelist: 允許的外部域名
549
545
  help_sections: 幫助部分
550
546
  homepage: 首頁
551
547
  impersonations: 模擬登錄
548
+ manage: 管理
552
549
  moderation: 全局審查
553
550
  newsletters: 電子報
554
551
  participants: 參與者
@@ -815,11 +812,6 @@ zh-TW:
815
812
  organization_external_domain_whitelist:
816
813
  edit:
817
814
  update: 更新
818
- external_domain:
819
- down: 向下
820
- external_domain: 外部網域
821
- remove: 移除
822
- up: 往上
823
815
  form:
824
816
  add: 新增到白名單
825
817
  title: 外部域名白名單
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path("lib", __dir__)
4
+
5
+ # Maintain your gem's version:
6
+ require "decidim/admin/version"
7
+
8
+ # Describe your gem and declare its dependencies:
9
+ Gem::Specification.new do |s|
10
+ s.version = Decidim::Admin.version
11
+ s.authors = ["Josep Jaume Rey Peroy", "Marc Riera Casals", "Oriol Gual Oliva"]
12
+ s.email = ["josepjaume@gmail.com", "mrc2407@gmail.com", "oriolgual@gmail.com"]
13
+ s.license = "AGPL-3.0"
14
+ s.homepage = "https://decidim.org"
15
+ s.metadata = {
16
+ "bug_tracker_uri" => "https://github.com/decidim/decidim/issues",
17
+ "documentation_uri" => "https://docs.decidim.org/",
18
+ "funding_uri" => "https://opencollective.com/decidim",
19
+ "homepage_uri" => "https://decidim.org",
20
+ "source_code_uri" => "https://github.com/decidim/decidim"
21
+ }
22
+ s.required_ruby_version = "~> 3.1.0"
23
+
24
+ s.name = "decidim-admin"
25
+ s.summary = "Decidim organization administration"
26
+ s.description = "Organization administration to manage a single organization."
27
+
28
+ s.files = Dir.chdir(__dir__) do
29
+ `git ls-files -z`.split("\x0").select do |f|
30
+ (File.expand_path(f) == __FILE__) ||
31
+ f.start_with?(*%w(app/ config/ db/ lib/ Rakefile README.md))
32
+ end
33
+ end
34
+
35
+ s.add_dependency "active_link_to", "~> 1.0"
36
+ s.add_dependency "decidim-core", Decidim::Admin.version
37
+ s.add_dependency "devise", "~> 4.7"
38
+ s.add_dependency "devise-i18n", "~> 1.2"
39
+ s.add_dependency "devise_invitable", "~> 2.0", ">= 2.0.9"
40
+
41
+ s.add_development_dependency "decidim-dev", Decidim::Admin.version
42
+ s.add_development_dependency "decidim-participatory_processes", Decidim::Admin.version
43
+ end
@@ -57,39 +57,15 @@ module Decidim
57
57
  Mime::Type.register Decidim::Admin::Import::Readers::XLSX::MIME_TYPE, :xlsx
58
58
  end
59
59
 
60
- initializer "decidim_admin.global_moderation_menu" do
60
+ initializer "decidim_admin.menu" do
61
61
  Decidim::Admin::Menu.register_admin_global_moderation_menu!
62
- end
63
-
64
- initializer "decidim_admin.workflows_menu" do
65
62
  Decidim::Admin::Menu.register_workflows_menu!
66
- end
67
-
68
- initializer "decidim_admin.impersonate_menu" do
69
63
  Decidim::Admin::Menu.register_impersonate_menu!
70
- end
71
-
72
- initializer "decidim_admin.static_pages_menu" do
73
64
  Decidim::Admin::Menu.register_admin_static_pages_menu!
74
- end
75
-
76
- initializer "decidim_admin.user_menu" do
77
65
  Decidim::Admin::Menu.register_admin_user_menu!
78
- end
79
-
80
- initializer "decidim_admin.scopes_menu" do
81
66
  Decidim::Admin::Menu.register_admin_scopes_menu!
82
- end
83
-
84
- initializer "decidim_admin.areas_menu" do
85
67
  Decidim::Admin::Menu.register_admin_areas_menu!
86
- end
87
-
88
- initializer "decidim_admin.settings_menu" do
89
68
  Decidim::Admin::Menu.register_admin_settings_menu!
90
- end
91
-
92
- initializer "decidim_admin.menu" do
93
69
  Decidim::Admin::Menu.register_admin_menu!
94
70
  end
95
71
 
@@ -8,7 +8,7 @@ module Decidim
8
8
  moderations_count = Decidim::Admin::ModerationStats.new(current_user).count_content_moderations
9
9
 
10
10
  caption = I18n.t("menu.content", scope: "decidim.admin")
11
- caption += content_tag(:span, moderations_count, class: moderations_count.zero? ? "component-counter component-counter--off" : "component-counter")
11
+ caption += content_tag(:span, moderations_count, class: "component-counter")
12
12
 
13
13
  menu.add_item :moderations,
14
14
  caption.html_safe,
@@ -20,7 +20,7 @@ module Decidim
20
20
  user_reports = Decidim::Admin::ModerationStats.new(current_user).count_user_pending_reports
21
21
 
22
22
  caption = I18n.t("menu.reported_users", scope: "decidim.admin")
23
- caption += content_tag(:span, user_reports, class: user_reports.zero? ? "component-counter component-counter--off" : "component-counter")
23
+ caption += content_tag(:span, user_reports, class: "component-counter")
24
24
 
25
25
  menu.add_item :moderated_users,
26
26
  caption.html_safe,
@@ -168,13 +168,22 @@ module Decidim
168
168
  decidim_admin.scopes_path,
169
169
  icon_name: "price-tag-3-line",
170
170
  position: 1.3,
171
- if: allowed_to?(:read, :scope)
171
+ if: allowed_to?(:read, :scope),
172
+ active: [%w(
173
+ decidim/admin/scopes
174
+ decidim/admin/scope_types
175
+ ), []]
176
+
172
177
  menu.add_item :areas,
173
178
  I18n.t("menu.areas", scope: "decidim.admin"),
174
179
  decidim_admin.areas_path,
175
180
  icon_name: "layout-masonry-line",
176
181
  position: 1.5,
177
- if: allowed_to?(:read, :area)
182
+ if: allowed_to?(:read, :area),
183
+ active: [%w(
184
+ decidim/admin/areas
185
+ decidim/admin/area_types
186
+ ), []]
178
187
 
179
188
  menu.add_item :help_sections,
180
189
  I18n.t("menu.help_sections", scope: "decidim.admin"),
@@ -15,6 +15,23 @@ shared_examples "showing the unauthorized error message" do
15
15
  end
16
16
  end
17
17
 
18
+ shared_examples "admin participatory space edit button" do
19
+ context "and visits the participatory space public page" do
20
+ before do
21
+ switch_to_host(organization.host)
22
+ login_as role, scope: :user
23
+ end
24
+
25
+ it "shows the admin bar with the Edit button" do
26
+ visit participatory_space_path
27
+
28
+ within "#admin-bar" do
29
+ expect(page).to have_link("Edit", href: target_path)
30
+ end
31
+ end
32
+ end
33
+ end
34
+
18
35
  shared_examples "admin participatory space access" do
19
36
  before do
20
37
  switch_to_host(organization.host)
@@ -31,6 +48,16 @@ shared_examples "admin participatory space access" do
31
48
  context "when the user has the role" do
32
49
  let(:user) { role }
33
50
 
51
+ context "and visits the root path" do
52
+ it "shows the admin bar" do
53
+ visit decidim.root_path
54
+
55
+ within "#admin-bar" do
56
+ expect(page).to have_link("Admin dashboard", href: "/admin/")
57
+ end
58
+ end
59
+ end
60
+
34
61
  context "and has permission" do
35
62
  before do
36
63
  visit target_path
@@ -19,6 +19,15 @@ module Decidim
19
19
  end
20
20
  end
21
21
 
22
+ context "when the category is being used by a resource" do
23
+ let(:component) { create(:dummy_component, participatory_space:) }
24
+ let!(:resource) { create(:dummy_resource, component:, category:) }
25
+
26
+ it "broadcasts invalid" do
27
+ expect { command.call }.to broadcast(:invalid)
28
+ end
29
+ end
30
+
22
31
  context "when the category is not empty" do
23
32
  let!(:subcategory) { create :subcategory, parent: category }
24
33
 
@@ -0,0 +1,180 @@
1
+ # frozen_string_literal: true
2
+
3
+ shared_examples "inviting participatory space admins" do |check_private_space: true, check_landing_page: true|
4
+ let(:role) { "Administrator" }
5
+
6
+ before do
7
+ switch_to_host organization.host
8
+ end
9
+
10
+ shared_examples "sees public space menu" do
11
+ it "can access all sections" do
12
+ within_admin_sidebar_menu do
13
+ expect(page).to have_content(about_this_space_label)
14
+ expect(page).to have_content("Landing page") if check_landing_page
15
+ expect(page).to have_content("Phases") if participatory_space.is_a?(Decidim::ParticipatoryProcess)
16
+ expect(page).to have_content("Components")
17
+ expect(page).to have_content("Categories")
18
+ expect(page).to have_content("Attachments")
19
+ expect(page).to have_content(space_admins_label)
20
+ expect(page).not_to have_content("Private participants") if participatory_space.respond_to?(:private_space)
21
+ expect(page).to have_content("Moderations")
22
+ end
23
+ end
24
+ end
25
+
26
+ shared_examples "sees private space menu" do
27
+ it "can access all sections" do
28
+ within_admin_sidebar_menu do
29
+ expect(page).to have_content(about_this_space_label)
30
+ expect(page).to have_content("Landing page") if check_landing_page
31
+ expect(page).to have_content("Phases") if participatory_space.is_a?(Decidim::ParticipatoryProcess)
32
+ expect(page).to have_content("Components")
33
+ expect(page).to have_content("Categories")
34
+ expect(page).to have_content("Attachments")
35
+ expect(page).to have_content(space_admins_label)
36
+ expect(page).to have_content("Private participants") if participatory_space.respond_to?(:private_space)
37
+ expect(page).to have_content("Moderations")
38
+ end
39
+ end
40
+ end
41
+
42
+ context "when the user does not exist" do
43
+ before do
44
+ perform_enqueued_jobs { invite_user }
45
+ end
46
+
47
+ it "asks for a password and nickname and redirects to the admin dashboard" do
48
+ visit last_email_link
49
+
50
+ within "form.new_user" do
51
+ fill_in :invitation_user_nickname, with: "caballo_loco"
52
+ fill_in :invitation_user_password, with: "decidim123456789"
53
+ check :invitation_user_tos_agreement
54
+ find("*[type=submit]").click
55
+ end
56
+
57
+ expect(page).to have_current_path "/admin/admin_terms/show"
58
+
59
+ visit decidim_admin.admin_terms_show_path
60
+
61
+ find_button("I agree with the terms").click
62
+
63
+ click_on space_sidebar_label
64
+
65
+ within "div.table-scroll" do
66
+ expect(page).to have_i18n_content(participatory_space.title)
67
+ within "tr", text: translated(participatory_space.title) do
68
+ click_on translated(participatory_space.title)
69
+ end
70
+ end
71
+ end
72
+
73
+ context "when the user does not exist" do
74
+ before do
75
+ perform_enqueued_jobs { invite_user }
76
+
77
+ visit last_email_link
78
+
79
+ within "form.new_user" do
80
+ fill_in :invitation_user_nickname, with: "caballo_loco"
81
+ fill_in :invitation_user_password, with: "decidim123456789"
82
+ check :invitation_user_tos_agreement
83
+ find("*[type=submit]").click
84
+ end
85
+
86
+ expect(page).to have_current_path "/admin/admin_terms/show"
87
+
88
+ visit decidim_admin.admin_terms_show_path
89
+
90
+ find_button("I agree with the terms").click
91
+
92
+ click_on space_sidebar_label
93
+
94
+ within "div.table-scroll" do
95
+ expect(page).to have_i18n_content(participatory_space.title)
96
+ within "tr", text: translated(participatory_space.title) do
97
+ click_on translated(participatory_space.title)
98
+ end
99
+ end
100
+ end
101
+
102
+ context "and is a public space" do
103
+ it_behaves_like "sees public space menu"
104
+ end
105
+
106
+ if check_private_space
107
+ context "and is a private space" do
108
+ let(:participatory_space) { private_participatory_space }
109
+
110
+ it_behaves_like "sees private space menu"
111
+ end
112
+ end
113
+ end
114
+ end
115
+
116
+ context "when the user already exists" do
117
+ let(:email) { "administrator@example.org" }
118
+
119
+ let!(:administrator) do
120
+ create(:user, :confirmed, :admin_terms_accepted, email:, organization:)
121
+ end
122
+
123
+ before do
124
+ perform_enqueued_jobs { invite_user }
125
+ end
126
+
127
+ it "redirects the administrator to the admin dashboard" do
128
+ login_as administrator, scope: :user
129
+
130
+ visit decidim_admin.root_path
131
+
132
+ click_on space_sidebar_label
133
+
134
+ within "div.table-scroll" do
135
+ expect(page).to have_i18n_content(participatory_space.title)
136
+ expect(page).to have_i18n_content(participatory_space.title)
137
+ within "tr", text: translated(participatory_space.title) do
138
+ click_on translated(participatory_space.title)
139
+ end
140
+ end
141
+ end
142
+
143
+ it "selects the user role in the form" do
144
+ edit_user(administrator.name)
145
+
146
+ expect(page).to have_select("Role", selected: "Administrator")
147
+ end
148
+
149
+ context "when user exists in the organization" do
150
+ before do
151
+ perform_enqueued_jobs { invite_user }
152
+ login_as administrator, scope: :user
153
+
154
+ visit decidim_admin.root_path
155
+
156
+ click_on space_sidebar_label
157
+
158
+ within "div.table-scroll" do
159
+ expect(page).to have_i18n_content(participatory_space.title)
160
+ expect(page).to have_i18n_content(participatory_space.title)
161
+ within "tr", text: translated(participatory_space.title) do
162
+ click_on translated(participatory_space.title)
163
+ end
164
+ end
165
+ end
166
+
167
+ context "and is a public space" do
168
+ it_behaves_like "sees public space menu"
169
+ end
170
+
171
+ if check_private_space
172
+ context "and is a private space" do
173
+ let(:participatory_space) { private_participatory_space }
174
+
175
+ it_behaves_like "sees private space menu"
176
+ end
177
+ end
178
+ end
179
+ end
180
+ end
@@ -0,0 +1,67 @@
1
+ # frozen_string_literal: true
2
+
3
+ shared_examples "inviting participatory space collaborators" do
4
+ let(:role) { "Collaborator" }
5
+
6
+ before do
7
+ switch_to_host organization.host
8
+ end
9
+
10
+ context "when the user does not exist" do
11
+ before do
12
+ perform_enqueued_jobs { invite_user }
13
+ end
14
+
15
+ it "asks for a password and nickname and redirects to the admin dashboard" do
16
+ visit last_email_link
17
+
18
+ within "form.new_user" do
19
+ fill_in :invitation_user_nickname, with: "caballo_loco"
20
+ fill_in :invitation_user_password, with: "decidim123456789"
21
+ check :invitation_user_tos_agreement
22
+ find("*[type=submit]").click
23
+ end
24
+
25
+ expect(page).to have_current_path "/admin/admin_terms/show"
26
+
27
+ visit decidim_admin.admin_terms_show_path
28
+ find_button("I agree with the terms").click
29
+
30
+ click_on space_sidebar_label
31
+
32
+ within "div.table-scroll" do
33
+ expect(page).to have_i18n_content(participatory_space.title)
34
+ end
35
+ end
36
+ end
37
+
38
+ context "when the user already exists" do
39
+ let(:email) { "collaborator@example.org" }
40
+
41
+ let!(:collaborator) do
42
+ create(:user, :confirmed, :admin_terms_accepted, email:, organization:)
43
+ end
44
+
45
+ before do
46
+ perform_enqueued_jobs { invite_user }
47
+ end
48
+
49
+ it "redirects the collaborator to the admin dashboard" do
50
+ login_as collaborator, scope: :user
51
+
52
+ visit decidim_admin.root_path
53
+
54
+ click_on space_sidebar_label
55
+
56
+ within "div.table-scroll" do
57
+ expect(page).to have_i18n_content(participatory_space.title)
58
+ end
59
+ end
60
+
61
+ it "selects the user role in the form" do
62
+ edit_user(collaborator.name)
63
+
64
+ expect(page).to have_select("Role", selected: "Collaborator")
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ shared_examples "inviting participatory space moderators" do
4
+ before do
5
+ switch_to_host organization.host
6
+ end
7
+
8
+ context "when the user does not exist" do
9
+ before do
10
+ perform_enqueued_jobs { invite_user }
11
+ end
12
+
13
+ it "asks for a password and nickname and redirects to the admin dashboard" do
14
+ visit last_email_link
15
+
16
+ within "form.new_user" do
17
+ fill_in :invitation_user_nickname, with: "caballo_loco"
18
+ fill_in :invitation_user_password, with: "decidim123456789"
19
+ check :invitation_user_tos_agreement
20
+ find("*[type=submit]").click
21
+ end
22
+
23
+ expect(page).to have_current_path "/admin/admin_terms/show"
24
+
25
+ visit decidim_admin.admin_terms_show_path
26
+ find_button("I agree with the terms").click
27
+
28
+ click_on space_sidebar_label
29
+
30
+ within "div.table-scroll" do
31
+ expect(page).to have_i18n_content(participatory_space.title)
32
+ click_on "Moderate"
33
+ end
34
+
35
+ within "div.process-title-content-breadcrumb-container-left" do
36
+ expect(page).to have_css("span.process-title-content-breadcrumb", text: "Moderations")
37
+ end
38
+ end
39
+ end
40
+
41
+ context "when the user already exists" do
42
+ let(:email) { "moderator@example.org" }
43
+
44
+ let!(:moderator) do
45
+ create(:user, :confirmed, :admin_terms_accepted, email:, organization:)
46
+ end
47
+
48
+ before do
49
+ perform_enqueued_jobs { invite_user }
50
+ end
51
+
52
+ it "redirects the moderator to the admin dashboard" do
53
+ login_as moderator, scope: :user
54
+
55
+ visit decidim_admin.root_path
56
+
57
+ click_on space_sidebar_label
58
+
59
+ within "div.table-scroll" do
60
+ expect(page).to have_i18n_content(participatory_space.title)
61
+ within "tr", text: translated(participatory_space.title) do
62
+ click_on "Moderate"
63
+ end
64
+ end
65
+
66
+ within "div.process-title-content-breadcrumb-container-left" do
67
+ expect(page).to have_css("span.process-title-content-breadcrumb", text: "Moderations")
68
+ end
69
+ end
70
+
71
+ it "selects the user role in the form" do
72
+ edit_user(moderator.name)
73
+
74
+ expect(page).to have_select("Role", selected: "Moderator")
75
+ end
76
+ end
77
+ end