decidim-admin 0.28.6 → 0.29.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +13 -0
- 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/block_user.rb +0 -1
- 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 +4 -4
- 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 -43
- 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 +79 -4
- 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/paginable.rb +20 -0
- data/app/controllers/concerns/decidim/admin/participatory_space_export.rb +1 -1
- data/app/controllers/decidim/admin/application_controller.rb +2 -1
- 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 +1 -1
- data/app/controllers/decidim/admin/block_user_controller.rb +1 -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/conflicts_controller.rb +6 -14
- data/app/controllers/decidim/admin/help_sections_controller.rb +1 -1
- data/app/controllers/decidim/admin/impersonations_controller.rb +0 -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 +6 -7
- data/app/controllers/decidim/admin/organization_appearance_controller.rb +1 -1
- data/app/controllers/decidim/admin/organization_controller.rb +2 -2
- 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/help_section_form.rb +1 -1
- data/app/forms/decidim/admin/impersonate_user_form.rb +0 -5
- data/app/forms/decidim/admin/organization_appearance_form.rb +2 -5
- 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 +4 -4
- data/app/forms/decidim/admin/static_page_form.rb +1 -2
- data/app/forms/decidim/admin/transfer_user_form.rb +0 -15
- data/app/helpers/decidim/admin/application_helper.rb +0 -13
- 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/helpers/decidim/admin/paginable/per_page_helper.rb +22 -0
- 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 +19 -15
- data/app/packs/src/decidim/admin/css_preview.js +39 -0
- data/app/packs/src/decidim/admin/form.js +18 -1
- data/app/packs/src/decidim/admin/newsletters.js +9 -18
- 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/_moderations.scss +0 -8
- 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 -14
- data/app/queries/decidim/admin/newsletter_recipients.rb +5 -9
- 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/block_user/new.html.erb +1 -1
- 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/components/index.html.erb +1 -5
- data/app/views/decidim/admin/conflicts/edit.html.erb +11 -21
- data/app/views/decidim/admin/conflicts/index.html.erb +6 -29
- 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 +6 -6
- data/app/views/decidim/admin/impersonatable_users/index.html.erb +3 -3
- data/app/views/decidim/admin/imports/_dropdown.html.erb +5 -7
- data/app/views/decidim/admin/imports/new.html.erb +6 -7
- 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 +4 -4
- 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 +3 -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 +6 -7
- 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_appearance/form/_minimap.html.erb +3 -3
- 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/landing_page/_content_blocks.html.erb +2 -2
- data/app/views/decidim/admin/shared/landing_page_content_blocks/edit.html.erb +1 -1
- 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/_title_bar.html.erb +2 -2
- data/app/views/layouts/decidim/admin/_title_bar_responsive.html.erb +2 -2
- data/config/locales/ar.yml +6 -68
- data/config/locales/bg.yml +17 -14
- data/config/locales/ca.yml +23 -27
- data/config/locales/cs.yml +16 -25
- data/config/locales/de.yml +24 -28
- data/config/locales/el.yml +2 -15
- data/config/locales/en.yml +15 -19
- data/config/locales/eo.yml +0 -1
- data/config/locales/es-MX.yml +19 -23
- data/config/locales/es-PY.yml +19 -23
- data/config/locales/es.yml +19 -23
- data/config/locales/eu.yml +162 -178
- data/config/locales/fi-plain.yml +22 -26
- data/config/locales/fi.yml +43 -47
- data/config/locales/fr-CA.yml +18 -22
- data/config/locales/fr.yml +16 -20
- data/config/locales/ga-IE.yml +6 -4
- data/config/locales/gl.yml +3 -10
- data/config/locales/he-IL.yml +0 -6
- data/config/locales/hu.yml +14 -15
- data/config/locales/id-ID.yml +5 -12
- data/config/locales/is-IS.yml +6 -16
- data/config/locales/it.yml +6 -180
- data/config/locales/ja.yml +22 -26
- data/config/locales/kaa.yml +3 -8
- data/config/locales/ko.yml +3 -16
- data/config/locales/lb.yml +7 -17
- data/config/locales/lt.yml +0 -14
- data/config/locales/lv.yml +4 -9
- data/config/locales/nl.yml +4 -14
- data/config/locales/no.yml +3 -13
- data/config/locales/pl.yml +18 -13
- data/config/locales/pt-BR.yml +10 -14
- data/config/locales/pt.yml +4 -18
- data/config/locales/ro-RO.yml +8 -27
- data/config/locales/ru.yml +8 -11
- data/config/locales/sk.yml +7 -10
- data/config/locales/sl.yml +2 -7
- data/config/locales/sq-AL.yml +6 -16
- data/config/locales/sr-CS.yml +5 -9
- data/config/locales/sv.yml +211 -366
- data/config/locales/th-TH.yml +0 -17
- data/config/locales/tr-TR.yml +8 -11
- data/config/locales/uk.yml +7 -8
- data/config/locales/zh-CN.yml +10 -6
- data/config/locales/zh-TW.yml +0 -13
- data/config/routes.rb +2 -2
- data/decidim-admin.gemspec +2 -2
- data/lib/decidim/admin/engine.rb +0 -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/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 +1 -1
- data/lib/decidim/admin/test/invite_participatory_space_users_shared_context.rb +0 -1
- data/lib/decidim/admin/test/manage_attachment_collections_examples.rb +12 -12
- data/lib/decidim/admin/test/manage_attachments_examples.rb +52 -28
- data/lib/decidim/admin/test/manage_categories_examples.rb +13 -13
- data/lib/decidim/admin/test/manage_component_permissions_examples.rb +5 -5
- data/lib/decidim/admin/test/manage_hide_content_examples.rb +4 -4
- data/lib/decidim/admin/test/manage_moderations_examples.rb +22 -22
- data/lib/decidim/admin/test/manage_paginated_collection_examples.rb +5 -5
- data/lib/decidim/admin/test/manage_participatory_space_publications_examples.rb +2 -2
- data/lib/decidim/admin/version.rb +1 -1
- data/lib/decidim/admin.rb +15 -0
- metadata +28 -28
- 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/controllers/concerns/decidim/admin/verification_conflicts/filterable.rb +0 -31
- data/app/views/layouts/decidim/admin/login.html.erb +0 -19
- data/config/locales/bn-BD.yml +0 -1
- data/config/locales/bs-BA.yml +0 -529
- data/config/locales/ca-IT.yml +0 -1153
- /data/app/packs/src/decidim/admin/{external_domain_whitelist.js → external_domain_allowlist.js} +0 -0
@@ -19,30 +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
|
-
|
22
|
+
click_on "Edit"
|
23
23
|
end
|
24
24
|
|
25
|
-
expect(page).to
|
26
|
-
expect(page).to
|
27
|
-
expect(page).to
|
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
|
-
|
30
|
-
# The image's URL changes every time it is requested because the disk
|
31
|
-
# service generates a unique URL based on the expiry time of the link.
|
32
|
-
# This expiry time is calculated at the time when the URL is requested
|
33
|
-
# which is why it changes every time to different URL. This changes the
|
34
|
-
# JSON encoded file identifier which includes the expiry time as well as
|
35
|
-
# the digest of the URL because the digest is calculated based on the
|
36
|
-
# passed data.
|
37
|
-
filename = attachment.file.blob.filename
|
38
|
-
within %([data-active-uploads] [data-filename="#{filename}"]) do
|
39
|
-
src = page.find("img")["src"]
|
40
|
-
expect(src).to be_blob_url(attachment.file.blob)
|
41
|
-
end
|
29
|
+
expect(page).to have_css("img[src~='#{attachment.url}']")
|
42
30
|
end
|
43
31
|
|
44
32
|
it "can add attachments without a collection to a process" do
|
45
|
-
|
33
|
+
click_on "New attachment"
|
46
34
|
|
47
35
|
within ".new_attachment" do
|
48
36
|
fill_in_i18n(
|
@@ -75,8 +63,44 @@ shared_examples "manage attachments examples" do
|
|
75
63
|
end
|
76
64
|
end
|
77
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
|
+
|
78
102
|
it "can add attachments within a collection to a process" do
|
79
|
-
|
103
|
+
click_on "New attachment"
|
80
104
|
|
81
105
|
within ".new_attachment" do
|
82
106
|
fill_in_i18n(
|
@@ -114,9 +138,9 @@ shared_examples "manage attachments examples" do
|
|
114
138
|
|
115
139
|
it "can remove an attachment from a collection" do
|
116
140
|
within "#attachments" do
|
117
|
-
within
|
141
|
+
within "tr", text: translated(attachment.title) do
|
118
142
|
expect(page).to have_text(translated(attachment_collection.name, locale: :en))
|
119
|
-
|
143
|
+
click_on "Edit"
|
120
144
|
end
|
121
145
|
end
|
122
146
|
|
@@ -127,26 +151,26 @@ shared_examples "manage attachments examples" do
|
|
127
151
|
end
|
128
152
|
|
129
153
|
within "#attachments" do
|
130
|
-
within
|
131
|
-
expect(page).
|
154
|
+
within "tr", text: translated(attachment.title) do
|
155
|
+
expect(page).to have_no_text(translated(attachment_collection.name, locale: :en))
|
132
156
|
end
|
133
157
|
end
|
134
158
|
end
|
135
159
|
|
136
160
|
it "can delete an attachment from a process" do
|
137
|
-
within
|
138
|
-
accept_confirm {
|
161
|
+
within "tr", text: translated(attachment.title) do
|
162
|
+
accept_confirm { click_on "Delete" }
|
139
163
|
end
|
140
164
|
|
141
165
|
expect(page).to have_admin_callout("successfully")
|
142
166
|
|
143
|
-
expect(page).
|
167
|
+
expect(page).to have_no_content(translated(attachment.title, locale: :en))
|
144
168
|
end
|
145
169
|
|
146
170
|
it "can update an attachment" do
|
147
171
|
within "#attachments" do
|
148
|
-
within
|
149
|
-
|
172
|
+
within "tr", text: translated(attachment.title) do
|
173
|
+
click_on "Edit"
|
150
174
|
end
|
151
175
|
end
|
152
176
|
|
@@ -10,17 +10,17 @@ shared_examples "manage categories examples" do
|
|
10
10
|
|
11
11
|
it "can view a category detail" do
|
12
12
|
within "#categories table" do
|
13
|
-
|
13
|
+
click_on translated(category.name, locale: :en)
|
14
14
|
end
|
15
15
|
|
16
|
-
expect(page).to
|
17
|
-
expect(page).to
|
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}']")
|
18
18
|
|
19
19
|
expect(page).to have_select(id: "category_parent_id")
|
20
20
|
end
|
21
21
|
|
22
22
|
it "creates a new category" do
|
23
|
-
|
23
|
+
click_on "New category"
|
24
24
|
|
25
25
|
within ".new_category" do
|
26
26
|
fill_in_i18n(
|
@@ -44,8 +44,8 @@ shared_examples "manage categories examples" do
|
|
44
44
|
|
45
45
|
it "updates a category" do
|
46
46
|
within "#categories" do
|
47
|
-
within
|
48
|
-
|
47
|
+
within "tr", text: translated(category.name) do
|
48
|
+
click_on "Edit"
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
@@ -79,14 +79,14 @@ shared_examples "manage categories examples" do
|
|
79
79
|
end
|
80
80
|
|
81
81
|
it "deletes a category" do
|
82
|
-
within
|
83
|
-
accept_confirm {
|
82
|
+
within "tr", text: translated(category2.name) do
|
83
|
+
accept_confirm { click_on "Delete" }
|
84
84
|
end
|
85
85
|
|
86
86
|
expect(page).to have_admin_callout("successfully")
|
87
87
|
|
88
88
|
within "#categories table" do
|
89
|
-
expect(page).
|
89
|
+
expect(page).to have_no_content(translated(category2.name))
|
90
90
|
end
|
91
91
|
end
|
92
92
|
end
|
@@ -99,8 +99,8 @@ shared_examples "manage categories examples" do
|
|
99
99
|
end
|
100
100
|
|
101
101
|
it "deletes a category" do
|
102
|
-
within
|
103
|
-
accept_confirm {
|
102
|
+
within "tr", text: translated(category2.name) do
|
103
|
+
accept_confirm { click_on "Delete" }
|
104
104
|
end
|
105
105
|
|
106
106
|
expect(page).to have_admin_callout("problem deleting")
|
@@ -119,8 +119,8 @@ shared_examples "manage categories examples" do
|
|
119
119
|
it "cannot delete it" do
|
120
120
|
visit current_path
|
121
121
|
|
122
|
-
within
|
123
|
-
expect(page).
|
122
|
+
within "tr", text: translated(category.name) do
|
123
|
+
expect(page).to have_no_css("a.action-icon--remove")
|
124
124
|
end
|
125
125
|
end
|
126
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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).
|
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
|
-
|
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
|
-
|
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,12 +46,12 @@ 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
|
-
|
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
|
-
|
54
|
+
click_on I18n.t("decidim.admin.block_user.new.action")
|
55
55
|
|
56
56
|
expect(content.reload).to be_hidden
|
57
57
|
|
@@ -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 {
|
18
|
+
within_admin_sidebar_menu { click_on(moderations_link_text) }
|
19
19
|
else
|
20
|
-
within("div.layout-nav") {
|
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
|
-
|
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 {
|
57
|
+
within_admin_sidebar_menu { click_on(moderations_link_text) }
|
58
58
|
else
|
59
|
-
within("div.layout-nav") {
|
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).
|
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
|
-
|
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
|
-
|
93
|
+
click_on "Hide"
|
94
94
|
end
|
95
95
|
|
96
96
|
expect(page).to have_admin_callout("Resource successfully hidden")
|
97
|
-
expect(page).
|
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
|
-
|
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
|
-
|
119
|
+
click_on reportable_type
|
120
120
|
end
|
121
|
-
expect(page).to
|
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
|
-
|
128
|
+
within(".input-group-button") { click_on(class: "text-secondary") }
|
129
129
|
end
|
130
|
-
expect(page).to
|
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
|
-
|
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).
|
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
|
-
|
173
|
+
click_on "Català"
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
@@ -184,17 +184,17 @@ shared_examples "manage moderations" do
|
|
184
184
|
|
185
185
|
context "when listing hidden resources" do
|
186
186
|
before do
|
187
|
-
|
187
|
+
click_on "Hidden"
|
188
188
|
end
|
189
189
|
|
190
190
|
it "user cannot unreport them" do
|
191
|
-
expect(page).
|
191
|
+
expect(page).to have_no_css(".action-icon--unreport")
|
192
192
|
end
|
193
193
|
|
194
194
|
it "user can review them" do
|
195
195
|
hidden_moderations.each do |moderation|
|
196
196
|
within "tr[data-id=\"#{moderation.id}\"]" do
|
197
|
-
expect(page).to have_css("a[href='#{moderation.
|
197
|
+
expect(page).to have_css("a[href='#{moderation.reportable.reported_content_url}']")
|
198
198
|
end
|
199
199
|
end
|
200
200
|
end
|
@@ -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
|
-
|
234
|
+
click_on "Hide"
|
235
235
|
end
|
236
236
|
|
237
237
|
expect(page).to have_admin_callout("Resource successfully hidden")
|
238
|
-
expect(page).
|
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
|
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
|
@@ -12,17 +12,17 @@ shared_examples "a paginated collection" do |options|
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "Number of results per page" do
|
15
|
-
it "lists
|
16
|
-
expect(page).to have_css(".table-list tbody tr", count:
|
15
|
+
it "lists 15 resources per page by default" do
|
16
|
+
expect(page).to have_css(".table-list tbody tr", count: 15)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "changes the number of results per page" do
|
20
20
|
within "[data-pagination]" do
|
21
|
-
page.find("details", text: "
|
21
|
+
page.find("details", text: "15").click
|
22
22
|
click_on "50"
|
23
23
|
end
|
24
24
|
|
25
|
-
expect(page).to
|
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
|
-
|
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
|
-
|
45
|
+
click_on "Unpublish"
|
46
46
|
|
47
47
|
expect(page).to have_content("successfully")
|
48
48
|
|
data/lib/decidim/admin.rb
CHANGED
@@ -17,6 +17,21 @@ module Decidim
|
|
17
17
|
|
18
18
|
include ActiveSupport::Configurable
|
19
19
|
|
20
|
+
# Public Setting that configures Kaminari configuration options
|
21
|
+
# https://github.com/kaminari/kaminari#general-configuration-options
|
22
|
+
|
23
|
+
# Range of number of results per_page. Defaults to [15, 50, 100].
|
24
|
+
# per_page_range.first sets the default number per page
|
25
|
+
# per_page_range.last sets the default max_per_page
|
26
|
+
config_accessor :per_page_range do
|
27
|
+
[15, 50, 100]
|
28
|
+
end
|
29
|
+
|
30
|
+
Kaminari.configure do |config|
|
31
|
+
config.default_per_page = Decidim::Admin.per_page_range.first
|
32
|
+
config.max_per_page = Decidim::Admin.per_page_range.last
|
33
|
+
end
|
34
|
+
|
20
35
|
# Public: Stores an instance of ViewHooks
|
21
36
|
def self.view_hooks
|
22
37
|
@view_hooks ||= ViewHooks.new
|