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.
- checksums.yaml +4 -4
- data/app/cells/decidim/admin/content_block_cell.rb +0 -1
- data/app/cells/decidim/admin/results_per_page/show.erb +2 -2
- data/app/cells/decidim/admin/results_per_page_cell.rb +0 -2
- data/app/commands/decidim/admin/create_area.rb +4 -32
- data/app/commands/decidim/admin/create_area_type.rb +4 -33
- data/app/commands/decidim/admin/create_attachment.rb +5 -4
- data/app/commands/decidim/admin/create_attachment_collection.rb +3 -3
- data/app/commands/decidim/admin/create_category.rb +4 -37
- data/app/commands/decidim/admin/create_component.rb +7 -40
- data/app/commands/decidim/admin/create_newsletter.rb +11 -29
- data/app/commands/decidim/admin/create_participatory_space_private_user.rb +3 -3
- data/app/commands/decidim/admin/create_scope.rb +15 -32
- data/app/commands/decidim/admin/create_scope_type.rb +3 -32
- data/app/commands/decidim/admin/create_static_page.rb +6 -47
- data/app/commands/decidim/admin/create_static_page_topic.rb +4 -26
- data/app/commands/decidim/admin/deliver_newsletter.rb +4 -5
- data/app/commands/decidim/admin/destroy_area.rb +2 -25
- data/app/commands/decidim/admin/destroy_category.rb +4 -29
- data/app/commands/decidim/admin/destroy_component.rb +5 -42
- data/app/commands/decidim/admin/destroy_newsletter.rb +2 -30
- data/app/commands/decidim/admin/destroy_participatory_space_private_user.rb +5 -32
- data/app/commands/decidim/admin/destroy_scope.rb +6 -33
- data/app/commands/decidim/admin/officialize_user.rb +1 -1
- data/app/commands/decidim/admin/participatory_space/create_admin.rb +4 -4
- data/app/commands/decidim/admin/process_participatory_space_private_user_import_csv.rb +5 -4
- data/app/commands/decidim/admin/promote_managed_user.rb +4 -5
- data/app/commands/decidim/admin/unofficialize_user.rb +1 -1
- data/app/commands/decidim/admin/update_area.rb +2 -41
- data/app/commands/decidim/admin/update_area_type.rb +2 -42
- data/app/commands/decidim/admin/update_attachment.rb +10 -7
- data/app/commands/decidim/admin/update_attachment_collection.rb +3 -3
- data/app/commands/decidim/admin/update_category.rb +2 -45
- data/app/commands/decidim/admin/update_component.rb +4 -5
- data/app/commands/decidim/admin/update_component_permissions.rb +3 -3
- data/app/commands/decidim/admin/{update_external_domain_whitelist.rb → update_external_domain_allowlist.rb} +6 -5
- data/app/commands/decidim/admin/update_help_sections.rb +6 -3
- data/app/commands/decidim/admin/update_newsletter.rb +8 -8
- data/app/commands/decidim/admin/update_organization.rb +9 -53
- data/app/commands/decidim/admin/update_organization_appearance.rb +10 -81
- data/app/commands/decidim/admin/update_scope.rb +7 -40
- data/app/commands/decidim/admin/update_scope_type.rb +2 -42
- data/app/commands/decidim/admin/update_static_page.rb +5 -46
- data/app/commands/decidim/admin/update_static_page_topic.rb +2 -43
- data/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
- data/app/controllers/concerns/decidim/admin/content_blocks/landing_page.rb +2 -2
- data/app/controllers/concerns/decidim/admin/filterable.rb +78 -3
- data/app/controllers/concerns/decidim/admin/global_moderation_context.rb +1 -1
- data/app/controllers/concerns/decidim/admin/needs_admin_tos_accepted.rb +0 -7
- data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +1 -1
- data/app/controllers/decidim/admin/application_controller.rb +1 -0
- data/app/controllers/decidim/admin/area_types_controller.rb +8 -9
- data/app/controllers/decidim/admin/areas_controller.rb +1 -1
- data/app/controllers/decidim/admin/authorization_workflows_controller.rb +3 -1
- data/app/controllers/decidim/admin/categories_controller.rb +2 -2
- data/app/controllers/decidim/admin/component_permissions_controller.rb +1 -1
- data/app/controllers/decidim/admin/components_controller.rb +2 -2
- data/app/controllers/decidim/admin/concerns/has_attachment_collections.rb +2 -2
- data/app/controllers/decidim/admin/concerns/has_attachments.rb +2 -2
- data/app/controllers/decidim/admin/concerns/has_private_users.rb +1 -1
- data/app/controllers/decidim/admin/concerns/has_private_users_csv_import.rb +1 -1
- data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
- data/app/controllers/decidim/admin/managed_users/promotions_controller.rb +1 -1
- data/app/controllers/decidim/admin/moderations/reports_controller.rb +4 -4
- data/app/controllers/decidim/admin/moderations_controller.rb +7 -7
- data/app/controllers/decidim/admin/newsletter_templates_controller.rb +1 -1
- data/app/controllers/decidim/admin/newsletters_controller.rb +5 -5
- data/app/controllers/decidim/admin/organization_appearance_controller.rb +1 -1
- data/app/controllers/decidim/admin/organization_controller.rb +8 -5
- data/app/controllers/decidim/admin/{organization_external_domain_whitelist_controller.rb → organization_external_domain_allowlist_controller.rb} +7 -7
- data/app/controllers/decidim/admin/scope_types_controller.rb +7 -8
- data/app/controllers/decidim/admin/scopes_controller.rb +1 -1
- data/app/controllers/decidim/admin/share_tokens_controller.rb +1 -1
- data/app/controllers/decidim/admin/static_page_topics_controller.rb +2 -2
- data/app/controllers/decidim/admin/static_pages_controller.rb +2 -2
- data/app/forms/decidim/admin/attachment_form.rb +7 -1
- data/app/forms/decidim/admin/organization_appearance_form.rb +0 -3
- data/app/forms/decidim/admin/{organization_external_domain_whitelist_form.rb → organization_external_domain_allowlist_form.rb} +3 -3
- data/app/forms/decidim/admin/organization_form.rb +2 -2
- data/app/forms/decidim/admin/static_page_form.rb +0 -1
- data/app/helpers/decidim/admin/filterable_helper.rb +19 -3
- data/app/helpers/decidim/admin/moderations/reports_helper.rb +3 -1
- data/app/helpers/decidim/admin/newsletters_helper.rb +3 -3
- data/app/jobs/decidim/admin/import_participatory_space_private_user_csv_job.rb +2 -2
- data/app/packs/entrypoints/decidim_admin.js +4 -1
- data/app/packs/src/decidim/admin/application.js +25 -16
- data/app/packs/src/decidim/admin/choose_language.js +2 -0
- data/app/packs/src/decidim/admin/css_preview.js +39 -0
- data/app/packs/src/decidim/admin/dynamic_fields.component.js +2 -1
- data/app/packs/src/decidim/admin/form.js +18 -1
- data/app/packs/src/decidim/admin/participatory_space_search.js +1 -1
- data/app/packs/src/decidim/admin/proposal_infinite_edit.js +2 -2
- data/app/packs/src/decidim/admin/sync_radio_buttons.js +27 -0
- data/app/packs/src/decidim/admin/text_copy.js +19 -0
- data/app/packs/stylesheets/decidim/admin/_cards.scss +1 -1
- data/app/packs/stylesheets/decidim/admin/_datepicker.scss +62 -0
- data/app/packs/stylesheets/decidim/admin/_item_edit.scss +1 -1
- data/app/packs/stylesheets/decidim/admin/_item_show.scss +8 -0
- data/app/packs/stylesheets/decidim/admin/_proposal_status.scss +5 -0
- data/app/packs/stylesheets/decidim/admin/application.scss +2 -0
- data/app/permissions/decidim/admin/permissions.rb +2 -2
- data/app/queries/decidim/admin/user_filter.rb +4 -4
- data/app/queries/decidim/admin/user_groups_evaluation.rb +1 -1
- data/app/views/decidim/admin/attachment_collections/index.html.erb +1 -1
- data/app/views/decidim/admin/attachments/_form.html.erb +21 -2
- data/app/views/decidim/admin/attachments/index.html.erb +2 -2
- data/app/views/decidim/admin/authorization_workflows/index.html.erb +26 -8
- data/app/views/decidim/admin/categories/index.html.erb +2 -2
- data/app/views/decidim/admin/components/_form.html.erb +1 -1
- data/app/views/decidim/admin/dashboard/_pending_moderations.html.erb +1 -1
- data/app/views/decidim/admin/dashboard/show.html.erb +1 -1
- data/app/views/decidim/admin/exports/_dropdown.html.erb +1 -1
- data/app/views/decidim/admin/impersonatable_users/index.html.erb +3 -3
- data/app/views/decidim/admin/imports/_dropdown.html.erb +1 -1
- data/app/views/decidim/admin/imports/new.html.erb +2 -2
- data/app/views/decidim/admin/logs/_filters.html.erb +3 -3
- data/app/views/decidim/admin/managed_users/promotions/new.html.erb +1 -1
- data/app/views/decidim/admin/moderated_users/index.html.erb +2 -2
- data/app/views/decidim/admin/moderations/index.html.erb +5 -5
- data/app/views/decidim/admin/moderations/reports/index.html.erb +6 -6
- data/app/views/decidim/admin/moderations/reports/show.html.erb +4 -4
- data/app/views/decidim/admin/newsletter_templates/index.html.erb +2 -2
- data/app/views/decidim/admin/newsletter_templates/show.html.erb +7 -7
- data/app/views/decidim/admin/newsletters/index.html.erb +1 -1
- data/app/views/decidim/admin/newsletters/select_recipients_to_deliver.html.erb +3 -3
- data/app/views/decidim/admin/newsletters/show.html.erb +1 -1
- data/app/views/decidim/admin/organization/_form.html.erb +3 -3
- data/app/views/decidim/admin/organization_appearance/form/_colors.html.erb +0 -3
- data/app/views/decidim/admin/organization_appearance/form/_images.html.erb +5 -5
- data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/_external_domain.html.erb +4 -4
- data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/_form.html.erb +2 -2
- data/app/views/decidim/admin/{organization_external_domain_whitelist → organization_external_domain_allowlist}/edit.html.erb +2 -2
- data/app/views/decidim/admin/participatory_space_private_users/index.html.erb +1 -1
- data/app/views/decidim/admin/participatory_space_private_users_csv_imports/new.html.erb +1 -1
- data/app/views/decidim/admin/share_tokens/_share_tokens.html.erb +1 -1
- data/app/views/decidim/admin/shared/_adjacent_navigation.html.erb +30 -0
- data/app/views/decidim/admin/shared/_admin_confirm_modal.html.erb +7 -7
- data/app/views/decidim/admin/shared/_filters.html.erb +1 -1
- data/app/views/decidim/admin/shared/_gallery.html.erb +1 -1
- data/app/views/decidim/admin/shared/_js-callout.html.erb +2 -2
- data/app/views/decidim/admin/shared/landing_page/_content_blocks.html.erb +2 -2
- data/app/views/decidim/admin/static_page_topics/index.html.erb +1 -1
- data/app/views/decidim/admin/static_pages/_form.html.erb +0 -4
- data/app/views/decidim/admin/users_statistics/_users_count.html.erb +2 -2
- data/app/views/layouts/decidim/admin/_admin_timeout_modal.html.erb +2 -2
- data/app/views/layouts/decidim/admin/_application.html.erb +4 -4
- data/app/views/layouts/decidim/admin/_callouts_full.html.erb +1 -1
- data/app/views/layouts/decidim/admin/_js_configuration.html.erb +3 -1
- data/app/views/layouts/decidim/admin/_sidebar_menu.html.erb +2 -2
- data/app/views/layouts/decidim/admin/_title_bar.html.erb +2 -2
- data/app/views/layouts/decidim/admin/_title_bar_responsive.html.erb +2 -2
- data/config/locales/ar.yml +1 -7
- data/config/locales/bg.yml +1013 -11
- data/config/locales/ca.yml +18 -11
- data/config/locales/cs.yml +17 -10
- data/config/locales/de.yml +25 -18
- data/config/locales/el.yml +1 -12
- data/config/locales/en.yml +18 -11
- data/config/locales/es-MX.yml +25 -18
- data/config/locales/es-PY.yml +25 -18
- data/config/locales/es.yml +34 -27
- data/config/locales/eu.yml +18 -11
- data/config/locales/fi-plain.yml +16 -9
- data/config/locales/fi.yml +16 -9
- data/config/locales/fr-CA.yml +16 -9
- data/config/locales/fr.yml +15 -8
- data/config/locales/ga-IE.yml +1 -3
- data/config/locales/gl.yml +1 -5
- data/config/locales/hu.yml +10 -10
- data/config/locales/id-ID.yml +1 -3
- data/config/locales/is-IS.yml +1 -3
- data/config/locales/it.yml +2 -8
- data/config/locales/ja.yml +18 -11
- data/config/locales/kaa.yml +0 -3
- data/config/locales/ko.yml +0 -6
- data/config/locales/lb.yml +1 -8
- data/config/locales/lt.yml +2 -13
- data/config/locales/lv.yml +1 -3
- data/config/locales/nl.yml +1 -8
- data/config/locales/no.yml +1 -8
- data/config/locales/pl.yml +17 -9
- data/config/locales/pt-BR.yml +9 -10
- data/config/locales/pt.yml +1 -8
- data/config/locales/ro-RO.yml +1 -12
- data/config/locales/ru.yml +1 -3
- data/config/locales/sk.yml +1 -3
- data/config/locales/sl.yml +1 -0
- data/config/locales/sq-AL.yml +410 -0
- data/config/locales/sr-CS.yml +1 -3
- data/config/locales/sv.yml +1 -8
- data/config/locales/th-TH.yml +98 -0
- data/config/locales/tr-TR.yml +1 -5
- data/config/locales/uk.yml +1 -3
- data/config/locales/zh-CN.yml +1 -3
- data/config/locales/zh-TW.yml +2 -12
- data/config/routes.rb +1 -1
- data/decidim-admin.gemspec +1 -1
- data/lib/decidim/admin/import/creator.rb +1 -1
- data/lib/decidim/admin/import/importer_factory.rb +2 -2
- data/lib/decidim/admin/menu.rb +4 -4
- data/lib/decidim/admin/test/admin_participatory_space_access_examples.rb +27 -0
- data/lib/decidim/admin/test/commands/create_attachment_collection_examples.rb +3 -2
- data/lib/decidim/admin/test/commands/create_category_examples.rb +4 -2
- data/lib/decidim/admin/test/commands/update_attachment_collection_examples.rb +3 -2
- data/lib/decidim/admin/test/commands/update_category_examples.rb +3 -2
- data/lib/decidim/admin/test/filterable_examples.rb +5 -3
- data/lib/decidim/admin/test/filters_participatory_space_user_roles_examples.rb +5 -5
- data/lib/decidim/admin/test/invite_participatory_space_admins_shared_examples.rb +180 -0
- data/lib/decidim/admin/test/invite_participatory_space_collaborators_shared_examples.rb +67 -0
- data/lib/decidim/admin/test/invite_participatory_space_moderators_shared_examples.rb +77 -0
- data/lib/decidim/admin/test/invite_participatory_space_users_shared_context.rb +33 -0
- data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +24 -23
- data/lib/decidim/admin/test/manage_attachments_examples.rb +51 -15
- data/lib/decidim/admin/test/manage_categories_examples.rb +24 -21
- data/lib/decidim/admin/test/manage_component_permissions_examples.rb +5 -5
- data/lib/decidim/admin/test/manage_hide_content_examples.rb +8 -4
- data/lib/decidim/admin/test/manage_moderations_examples.rb +21 -21
- data/lib/decidim/admin/test/manage_paginated_collection_examples.rb +3 -3
- data/lib/decidim/admin/test/manage_participatory_space_publications_examples.rb +2 -2
- data/lib/decidim/admin/test.rb +1 -0
- data/lib/decidim/admin/version.rb +1 -1
- metadata +32 -27
- data/app/commands/decidim/admin/destroy_share_token.rb +0 -46
- data/app/commands/decidim/admin/destroy_static_page.rb +0 -40
- data/app/commands/decidim/admin/destroy_static_page_topic.rb +0 -40
- data/app/mailers/decidim/admin/application_mailer.rb +0 -12
- data/app/views/layouts/decidim/admin/login.html.erb +0 -19
- /data/app/packs/src/decidim/admin/{external_domain_whitelist.js → external_domain_allowlist.js} +0 -0
data/config/locales/zh-TW.yml
CHANGED
@@ -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:
|
@@ -346,7 +347,6 @@ zh-TW:
|
|
346
347
|
title: 驗證衝突
|
347
348
|
transfer:
|
348
349
|
email: 電子郵件
|
349
|
-
error: 轉移現在參與者到管理參與者時發生錯誤
|
350
350
|
name: 名稱
|
351
351
|
reason: 理由
|
352
352
|
success: 目前的轉換完成
|
@@ -359,10 +359,6 @@ zh-TW:
|
|
359
359
|
title: 等待的操作
|
360
360
|
show:
|
361
361
|
view_more_logs: 檢視更多記錄
|
362
|
-
domain_whitelist:
|
363
|
-
update:
|
364
|
-
error: 網址白名單更新失敗
|
365
|
-
success: 網址白名單更新成功.
|
366
362
|
exports:
|
367
363
|
export_as: "%{name} 成為 %{export_format}"
|
368
364
|
formats:
|
@@ -429,7 +425,6 @@ zh-TW:
|
|
429
425
|
report_count_eq: 報告數量等於
|
430
426
|
reported_id_string_or_reported_content_cont: 按報告 Id 或內容搜索%{collection}。
|
431
427
|
title_cont: 按標題搜索%{collection}。
|
432
|
-
user_name_or_user_email_cont: 按名稱或電子郵件搜索%{collection}。
|
433
428
|
user_name_or_user_nickname_or_user_email_cont: 按電子郵件、姓名或暱稱搜索%{collection}。
|
434
429
|
state_eq:
|
435
430
|
label: 狀態
|
@@ -538,6 +533,7 @@ zh-TW:
|
|
538
533
|
appearance: 外觀
|
539
534
|
area_types: 區域類型
|
540
535
|
areas: 區域
|
536
|
+
components: 组件
|
541
537
|
configuration: 配置
|
542
538
|
content: 被檢舉的內容
|
543
539
|
help_sections: 幫助部分
|
@@ -807,12 +803,6 @@ zh-TW:
|
|
807
803
|
layout_appearance_title: 編輯版面外觀
|
808
804
|
preview: 預覽
|
809
805
|
omnipresent_banner_appearance_title: 編輯無處不在的橫幅
|
810
|
-
organization_external_domain_whitelist:
|
811
|
-
edit:
|
812
|
-
update: 更新
|
813
|
-
form:
|
814
|
-
add: 新增到白名單
|
815
|
-
title: 外部域名白名單
|
816
806
|
participatory_space_private_users:
|
817
807
|
create:
|
818
808
|
error: 在此參與空間中添加私人參與者時出現問題。
|
data/config/routes.rb
CHANGED
@@ -7,7 +7,7 @@ Decidim::Admin::Engine.routes.draw do
|
|
7
7
|
resource :homepage, only: [:edit, :update], controller: "organization_homepage" do
|
8
8
|
resources :content_blocks, only: [:edit, :update, :destroy, :create], controller: "organization_homepage_content_blocks"
|
9
9
|
end
|
10
|
-
resource :
|
10
|
+
resource :external_domain_allowlist, only: [:edit, :update], controller: "organization_external_domain_allowlist"
|
11
11
|
|
12
12
|
member do
|
13
13
|
get :users
|
data/decidim-admin.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
"homepage_uri" => "https://decidim.org",
|
20
20
|
"source_code_uri" => "https://github.com/decidim/decidim"
|
21
21
|
}
|
22
|
-
s.required_ruby_version = "~> 3.
|
22
|
+
s.required_ruby_version = "~> 3.2.0"
|
23
23
|
|
24
24
|
s.name = "decidim-admin"
|
25
25
|
s.summary = "Decidim organization administration"
|
@@ -12,7 +12,7 @@ module Decidim
|
|
12
12
|
# own creator or this default will be used.
|
13
13
|
class Creator
|
14
14
|
class << self
|
15
|
-
#
|
15
|
+
# Returns the resource class to be created with the provided data.
|
16
16
|
def resource_klass
|
17
17
|
raise NotImplementedError, "#{self.class.name} does not define resource class"
|
18
18
|
end
|
@@ -5,11 +5,11 @@ module Decidim
|
|
5
5
|
module Import
|
6
6
|
# A factory class providing easier way to create new importers.
|
7
7
|
class ImporterFactory
|
8
|
-
def self.build(file, mime_type, **
|
8
|
+
def self.build(file, mime_type, **)
|
9
9
|
reader = Readers.search_by_mime_type(mime_type)
|
10
10
|
raise NotImplementedError, "No reader implemented for mime type: #{mime_type}" if reader.nil?
|
11
11
|
|
12
|
-
Importer.new(file:, reader:, **
|
12
|
+
Importer.new(file:, reader:, **)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
data/lib/decidim/admin/menu.rb
CHANGED
@@ -192,9 +192,9 @@ module Decidim
|
|
192
192
|
position: 1.6,
|
193
193
|
if: allowed_to?(:update, :help_sections)
|
194
194
|
|
195
|
-
menu.add_item :
|
196
|
-
I18n.t("menu.
|
197
|
-
decidim_admin.
|
195
|
+
menu.add_item :external_domain_allowlist,
|
196
|
+
I18n.t("menu.external_domain_allowlist", scope: "decidim.admin"),
|
197
|
+
decidim_admin.edit_organization_external_domain_allowlist_path,
|
198
198
|
icon_name: "computer-line",
|
199
199
|
position: 1.7,
|
200
200
|
if: allowed_to?(:update, :organization, organization: current_organization)
|
@@ -270,7 +270,7 @@ module Decidim
|
|
270
270
|
decidim/admin/scope_types
|
271
271
|
decidim/admin/areas decidim/admin/area_types
|
272
272
|
decidim/admin/help_sections
|
273
|
-
decidim/admin/
|
273
|
+
decidim/admin/organization_external_domain_allowlist
|
274
274
|
),
|
275
275
|
[]
|
276
276
|
],
|
@@ -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
|
@@ -25,10 +25,11 @@ module Decidim
|
|
25
25
|
form_params,
|
26
26
|
collection_for:
|
27
27
|
).with_context(
|
28
|
-
current_organization: organization
|
28
|
+
current_organization: organization,
|
29
|
+
current_user: user
|
29
30
|
)
|
30
31
|
end
|
31
|
-
let(:command) { described_class.new(form, collection_for
|
32
|
+
let(:command) { described_class.new(form, collection_for) }
|
32
33
|
|
33
34
|
describe "when the form is not valid" do
|
34
35
|
before do
|
@@ -22,10 +22,12 @@ module Decidim
|
|
22
22
|
form_params,
|
23
23
|
current_participatory_space: participatory_space
|
24
24
|
).with_context(
|
25
|
-
current_organization: organization
|
25
|
+
current_organization: organization,
|
26
|
+
current_participatory_space: participatory_space,
|
27
|
+
current_user: user
|
26
28
|
)
|
27
29
|
end
|
28
|
-
let(:command) { described_class.new(form
|
30
|
+
let(:command) { described_class.new(form) }
|
29
31
|
|
30
32
|
describe "when the form is not valid" do
|
31
33
|
before do
|
@@ -26,10 +26,11 @@ module Decidim
|
|
26
26
|
form_params,
|
27
27
|
collection_for:
|
28
28
|
).with_context(
|
29
|
-
current_organization: organization
|
29
|
+
current_organization: organization,
|
30
|
+
current_user: user
|
30
31
|
)
|
31
32
|
end
|
32
|
-
let(:command) { described_class.new(attachment_collection, form
|
33
|
+
let(:command) { described_class.new(attachment_collection, form) }
|
33
34
|
|
34
35
|
describe "when the form is not valid" do
|
35
36
|
before do
|
@@ -23,10 +23,11 @@ module Decidim
|
|
23
23
|
form_params,
|
24
24
|
current_participatory_space: participatory_space
|
25
25
|
).with_context(
|
26
|
-
current_organization: organization
|
26
|
+
current_organization: organization,
|
27
|
+
current_user: user
|
27
28
|
)
|
28
29
|
end
|
29
|
-
let(:command) { described_class.new(
|
30
|
+
let(:command) { described_class.new(form, category) }
|
30
31
|
|
31
32
|
describe "when the form is not valid" do
|
32
33
|
before do
|
@@ -11,13 +11,15 @@ shared_context "with filterable context" do
|
|
11
11
|
within(".filters__section") do
|
12
12
|
find_link("Filter").hover
|
13
13
|
find_link(options).hover
|
14
|
-
|
14
|
+
within ".submenu > .is-active > .submenu" do
|
15
|
+
click_on(filter)
|
16
|
+
end
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
18
20
|
def remove_applied_filter(filter)
|
19
21
|
within("[data-applied-filters-tags] .label", text: /#{filter}/i) do
|
20
|
-
|
22
|
+
click_on("Cancel")
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
@@ -50,7 +52,7 @@ shared_context "with filterable context" do
|
|
50
52
|
before { apply_filter(options, filter) }
|
51
53
|
|
52
54
|
it { expect(page).to have_content(in_filter) }
|
53
|
-
it { expect(page).
|
55
|
+
it { expect(page).to have_no_content(not_in_filter) }
|
54
56
|
|
55
57
|
it_behaves_like "searching by text" do
|
56
58
|
let(:text) { in_filter }
|
@@ -14,7 +14,7 @@ shared_examples "sortable participatory space user roles" do
|
|
14
14
|
let(:sort_by) { "name asc" }
|
15
15
|
|
16
16
|
it "displays the result" do
|
17
|
-
expect(page).
|
17
|
+
expect(page).to have_no_content(user.name)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -32,7 +32,7 @@ shared_examples "sortable participatory space user roles" do
|
|
32
32
|
let(:sort_by) { "email asc" }
|
33
33
|
|
34
34
|
it "displays the result" do
|
35
|
-
expect(page).
|
35
|
+
expect(page).to have_no_content(user.name)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -50,7 +50,7 @@ shared_examples "sortable participatory space user roles" do
|
|
50
50
|
let(:sort_by) { "last_sign_in_at asc" }
|
51
51
|
|
52
52
|
it "displays the result" do
|
53
|
-
expect(page).
|
53
|
+
expect(page).to have_no_content(user.name)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
@@ -68,7 +68,7 @@ shared_examples "sortable participatory space user roles" do
|
|
68
68
|
let(:sort_by) { "invitation_accepted_at asc" }
|
69
69
|
|
70
70
|
it "displays the result" do
|
71
|
-
expect(page).
|
71
|
+
expect(page).to have_no_content(user.name)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
@@ -86,7 +86,7 @@ shared_examples "sortable participatory space user roles" do
|
|
86
86
|
let(:sort_by) { "role asc" }
|
87
87
|
|
88
88
|
it "displays the result" do
|
89
|
-
expect(page).
|
89
|
+
expect(page).to have_no_content(user.name)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
@@ -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).to have_no_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
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
shared_context "when inviting participatory space users" do
|
4
|
+
let(:organization) { participatory_space.organization }
|
5
|
+
let(:user) { create(:user, :admin, :confirmed, organization: participatory_space.organization) }
|
6
|
+
let(:email) { "this_email_does_not_exist@example.org" }
|
7
|
+
let(:role) { "Moderator" }
|
8
|
+
|
9
|
+
def invite_user
|
10
|
+
login_as user, scope: :user
|
11
|
+
|
12
|
+
visit participatory_space_user_roles_path
|
13
|
+
within "[data-content]" do
|
14
|
+
click_on new_button_label
|
15
|
+
end
|
16
|
+
|
17
|
+
fill_in "Name", with: "Alice Liddel"
|
18
|
+
fill_in "Email", with: email
|
19
|
+
select role, from: "Role"
|
20
|
+
click_on "Create"
|
21
|
+
logout :user
|
22
|
+
end
|
23
|
+
|
24
|
+
def edit_user(username)
|
25
|
+
login_as user, scope: :user
|
26
|
+
|
27
|
+
visit participatory_space_user_roles_path
|
28
|
+
|
29
|
+
within "tr", text: username do
|
30
|
+
click_on "Edit"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|