decidim-department_admin 0.7.2 → 0.8.1
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/app/decorators/decidim/admin/newsletters_controller_decorator.rb +1 -1
- data/app/decorators/decidim/admin/users_controller_decorator.rb +1 -1
- data/app/decorators/decidim/area_decorator.rb +2 -2
- data/app/decorators/decidim/assemblies/admin/assemblies_controller_decorator.rb +1 -1
- data/app/decorators/decidim/assemblies/admin/assemblies_helper_decorator.rb +1 -1
- data/app/decorators/decidim/assemblies/create_assembly_decorator.rb +1 -1
- data/app/decorators/decidim/assemblies/parent_assemblies_for_select_decorator.rb +1 -1
- data/app/decorators/decidim/assemblies/permissions_decorator.rb +1 -1
- data/app/decorators/decidim/assemblies/update_assembly_decorator.rb +1 -1
- data/app/decorators/decidim/assemblies_decorator.rb +1 -1
- data/app/decorators/decidim/assemblies_with_user_role_decorator.rb +1 -1
- data/app/decorators/decidim/conference_form_decorator.rb +1 -1
- data/app/decorators/decidim/conferences/admin/conferences_controller_decorator.rb +1 -1
- data/app/decorators/decidim/conferences/create_conference_decorator.rb +2 -1
- data/app/decorators/decidim/conferences/permissions_decorator.rb +1 -1
- data/app/decorators/decidim/conferences/update_conference_decorator.rb +1 -1
- data/app/decorators/decidim/conferences_decorator.rb +1 -1
- data/app/decorators/decidim/conferences_with_user_role_decorator.rb +1 -1
- data/app/decorators/decidim/decidim_form_helper_decorator.rb +1 -1
- data/app/decorators/decidim/invite_user_decorator.rb +1 -1
- data/app/decorators/decidim/invite_user_form_decorator.rb +1 -1
- data/app/decorators/decidim/newsletter_decorator.rb +1 -1
- data/app/decorators/decidim/newsletters_helper_decorator.rb +1 -1
- data/app/decorators/decidim/participatory_process_decorator.rb +1 -1
- data/app/decorators/decidim/participatory_process_group_decorator.rb +1 -1
- data/app/decorators/decidim/participatory_processes/admin/participatory_processes_controller_decorator.rb +1 -1
- data/app/decorators/decidim/participatory_processes/create_participatory_process_decorator.rb +1 -1
- data/app/decorators/decidim/participatory_processes/permissions_decorator.rb +1 -1
- data/app/decorators/decidim/participatory_processes/update_participatory_process_decorator.rb +1 -1
- data/app/decorators/decidim/participatory_processes_with_user_role_decorator.rb +1 -1
- data/app/decorators/decidim/user_decorator.rb +8 -8
- data/app/decorators/lib/decidim/participatory_space_resourceable_decorator.rb +3 -3
- data/app/helpers/decidim/department_admin/application_helper.rb +1 -1
- data/app/packs/stylesheets/decidim/admin/department_admin.scss +2 -0
- data/app/views/decidim/admin/users/_filters.html.erb +30 -26
- data/app/views/decidim/admin/users/_form.html.erb +21 -15
- data/app/views/decidim/admin/users/index.html.erb +77 -79
- data/app/views/decidim/admin/users/show.html.erb +9 -10
- data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +130 -138
- data/app/views/decidim/conferences/admin/conferences/_form.html.erb +33 -26
- data/app/views/decidim/conferences/admin/conferences/index.html.erb +73 -80
- data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +108 -151
- data/lib/decidim/department_admin/version.rb +1 -1
- metadata +15 -55
- data/spec/commands/decidim/admin/deliver_newsletter_spec.rb +0 -175
- data/spec/commands/decidim/invite_user_spec.rb +0 -42
- data/spec/controllers/decidim/admin/users_controller_spec.rb +0 -119
- data/spec/factories.rb +0 -4
- data/spec/features/check_overrides_spec.rb +0 -11
- data/spec/i18n_spec.rb +0 -29
- data/spec/models/decidim/area_spec.rb +0 -23
- data/spec/permissions/decidim/department_admin/department_admin_permissions_spec.rb +0 -120
- data/spec/queries/parent_assemblies_for_select_spec.rb +0 -52
- data/spec/spec_helper.rb +0 -47
- data/spec/system/admin_explores_processes_spec.rb +0 -53
- data/spec/system/admin_invite_department_admin_spec.rb +0 -118
- data/spec/system/department_admin_manages_newsletters_spec.rb +0 -237
- data/spec/system/department_admin_should_be_able_to_access_admin_dashboard_spec.rb +0 -75
- data/spec/system/department_admin_should_be_able_to_manage_assemblies_spec.rb +0 -99
- data/spec/system/department_admin_should_be_able_to_manage_conferences_spec.rb +0 -74
- data/spec/system/department_admin_should_be_able_to_manage_processes_spec.rb +0 -117
- data/spec/system/department_admin_should_be_able_to_see_only_assemblies_from_her_area_spec.rb +0 -46
- data/spec/system/department_admin_should_be_able_to_see_only_newsletters_from_her_area_spec.rb +0 -53
- data/spec/system/department_admin_should_be_able_to_see_only_processes_from_her_area_spec.rb +0 -50
@@ -1,237 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe "Admin manages newsletters", type: :system do
|
6
|
-
let(:organization) { create(:organization) }
|
7
|
-
let(:area) { create(:area, organization: organization) }
|
8
|
-
let(:department_admin) { create(:department_admin, :confirmed, name: "Sarah Kerrigan", organization: organization, area: area) }
|
9
|
-
let!(:deliverable_users) { create_list(:user, 5, :confirmed, newsletter_notifications_at: Time.current, organization: organization) }
|
10
|
-
|
11
|
-
before do
|
12
|
-
switch_to_host(organization.host)
|
13
|
-
login_as department_admin, scope: :user
|
14
|
-
end
|
15
|
-
|
16
|
-
def wait_redirect
|
17
|
-
sleep(0.5)
|
18
|
-
end
|
19
|
-
|
20
|
-
def fill_newsletter_form
|
21
|
-
fill_in_i18n(
|
22
|
-
:newsletter_subject,
|
23
|
-
"#newsletter-subject-tabs",
|
24
|
-
en: "A fancy newsletter for %{name}",
|
25
|
-
es: "Un correo electrónico muy chulo para %{name}",
|
26
|
-
ca: "Un correu electrònic flipant per a %{name}"
|
27
|
-
)
|
28
|
-
|
29
|
-
fill_in_i18n_editor(
|
30
|
-
:newsletter_settings_body,
|
31
|
-
"#newsletter-settings--body-tabs",
|
32
|
-
en: "Hello %{name}! Relevant content.",
|
33
|
-
es: "Hola, %{name}! Contenido relevante.",
|
34
|
-
ca: "Hola, %{name}! Contingut rellevant."
|
35
|
-
)
|
36
|
-
|
37
|
-
find("*[type=submit]").click
|
38
|
-
end
|
39
|
-
|
40
|
-
context "when creating and previewing a newsletter" do
|
41
|
-
it "allows a newsletter to be created" do
|
42
|
-
visit decidim_admin.newsletters_path
|
43
|
-
|
44
|
-
within ".secondary-nav" do
|
45
|
-
find(".button.new").click
|
46
|
-
end
|
47
|
-
|
48
|
-
within "#basic_only_text .card-footer" do
|
49
|
-
click_link("Use this template")
|
50
|
-
end
|
51
|
-
|
52
|
-
within "#new_newsletter_" do
|
53
|
-
fill_newsletter_form
|
54
|
-
end
|
55
|
-
|
56
|
-
expect(page).to have_content("Preview")
|
57
|
-
expect(page).to have_content("A fancy newsletter for #{department_admin.name}")
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
context "with existing newsletter" do
|
62
|
-
let!(:newsletter) do
|
63
|
-
create(:newsletter,
|
64
|
-
organization: organization,
|
65
|
-
subject: {
|
66
|
-
en: "A fancy newsletter for %{name}",
|
67
|
-
es: "Un correo electrónico muy chulo para %{name}",
|
68
|
-
ca: "Un correu electrònic flipant per a %{name}",
|
69
|
-
},
|
70
|
-
body: {
|
71
|
-
en: "Hello %{name}! Relevant content.",
|
72
|
-
es: "Hola, %{name}! Contenido relevante.",
|
73
|
-
ca: "Hola, %{name}! Contingut rellevant.",
|
74
|
-
},
|
75
|
-
author: department_admin)
|
76
|
-
end
|
77
|
-
|
78
|
-
it "previews a newsletter" do
|
79
|
-
visit decidim_admin.newsletter_path(newsletter)
|
80
|
-
|
81
|
-
expect(page).to have_content("A fancy newsletter for Sarah Kerrigan")
|
82
|
-
expect(page).to have_css("iframe.email-preview[src=\"#{decidim_admin.preview_newsletter_path(newsletter)}\"]")
|
83
|
-
|
84
|
-
visit decidim_admin.preview_newsletter_path(newsletter)
|
85
|
-
expect(page).to have_content("Hello Sarah Kerrigan! Relevant content.")
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
context "when updating the newsletter" do
|
90
|
-
let!(:newsletter) { create(:newsletter, organization: organization, author: department_admin) }
|
91
|
-
|
92
|
-
it "allows a newsletter to be updated" do
|
93
|
-
visit decidim_admin.newsletters_path
|
94
|
-
within("tr[data-newsletter-id=\"#{newsletter.id}\"]") do
|
95
|
-
click_link "Edit"
|
96
|
-
end
|
97
|
-
|
98
|
-
within ".edit_newsletter" do
|
99
|
-
fill_newsletter_form
|
100
|
-
end
|
101
|
-
|
102
|
-
expect(page).to have_content("Preview")
|
103
|
-
expect(page).to have_content("A fancy newsletter")
|
104
|
-
end
|
105
|
-
end
|
106
|
-
|
107
|
-
context "when selecting newsletter recipients" do
|
108
|
-
let!(:newsletter) { create(:newsletter, organization: organization, author: department_admin) }
|
109
|
-
|
110
|
-
context "when followers are selected" do
|
111
|
-
let!(:participatory_processes) { create_list(:participatory_process, 2, organization: organization, area: area) }
|
112
|
-
let!(:followers) do
|
113
|
-
deliverable_users.each do |follower|
|
114
|
-
create(:follow, followable: participatory_processes.first, user: follower)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
|
118
|
-
it "sends to followers" do
|
119
|
-
visit decidim_admin.select_recipients_to_deliver_newsletter_path(newsletter)
|
120
|
-
perform_enqueued_jobs do
|
121
|
-
within(".newsletter_deliver") do
|
122
|
-
check("Send to followers")
|
123
|
-
uncheck("Send to participants")
|
124
|
-
within ".participatory_processes-block" do
|
125
|
-
select translated(participatory_processes.first.title), from: :newsletter_participatory_space_types_participatory_processes__ids
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
within ".button--double" do
|
130
|
-
accept_confirm { find("*", text: "Deliver").click }
|
131
|
-
end
|
132
|
-
|
133
|
-
wait_redirect
|
134
|
-
expect(page).to have_content("Newsletters")
|
135
|
-
expect(page).to have_admin_callout("successfully")
|
136
|
-
end
|
137
|
-
|
138
|
-
within "tbody" do
|
139
|
-
expect(page).to have_content("5 / 5")
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
context "when participants are selected" do
|
145
|
-
let!(:participatory_process) { create(:participatory_process, organization: organization, area: area) }
|
146
|
-
let!(:component) { create(:dummy_component, organization: newsletter.organization, participatory_space: participatory_process) }
|
147
|
-
|
148
|
-
before do
|
149
|
-
deliverable_users.each do |participant|
|
150
|
-
create(:dummy_resource, component: component, author: participant, published_at: Time.current)
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
it "sends to participants" do
|
155
|
-
visit decidim_admin.select_recipients_to_deliver_newsletter_path(newsletter)
|
156
|
-
perform_enqueued_jobs do
|
157
|
-
within(".newsletter_deliver") do
|
158
|
-
uncheck("Send to followers")
|
159
|
-
check("Send to participants")
|
160
|
-
within ".participatory_processes-block" do
|
161
|
-
select translated(component.participatory_space.title), from: :newsletter_participatory_space_types_participatory_processes__ids
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
within ".button--double" do
|
166
|
-
accept_confirm { find("*", text: "Deliver").click }
|
167
|
-
end
|
168
|
-
|
169
|
-
wait_redirect
|
170
|
-
expect(page).to have_content("Newsletters")
|
171
|
-
expect(page).to have_admin_callout("successfully")
|
172
|
-
expect(page).to have_content("Has been sent to")
|
173
|
-
within "tbody" do
|
174
|
-
expect(page).to have_content("5 / 5")
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
context "when selecting both followers and participants" do
|
181
|
-
let!(:participatory_process) { create(:participatory_process, organization: organization, area: area) }
|
182
|
-
let!(:component) { create(:dummy_component, organization: newsletter.organization, participatory_space: participatory_process) }
|
183
|
-
|
184
|
-
let!(:followers) do
|
185
|
-
deliverable_users.each do |follower|
|
186
|
-
create(:follow, followable: component.participatory_space, user: follower)
|
187
|
-
end
|
188
|
-
end
|
189
|
-
|
190
|
-
before do
|
191
|
-
deliverable_users.each do |participant|
|
192
|
-
create(:dummy_resource, component: component, author: participant, published_at: Time.current)
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
it "sends to participants" do
|
197
|
-
visit decidim_admin.select_recipients_to_deliver_newsletter_path(newsletter)
|
198
|
-
perform_enqueued_jobs do
|
199
|
-
within(".newsletter_deliver") do
|
200
|
-
check("Send to followers")
|
201
|
-
check("Send to participants")
|
202
|
-
within ".participatory_processes-block" do
|
203
|
-
select translated(component.participatory_space.title), from: :newsletter_participatory_space_types_participatory_processes__ids
|
204
|
-
end
|
205
|
-
end
|
206
|
-
|
207
|
-
within ".button--double" do
|
208
|
-
accept_confirm { find("*", text: "Deliver").click }
|
209
|
-
end
|
210
|
-
|
211
|
-
wait_redirect
|
212
|
-
expect(page).to have_content("Newsletters")
|
213
|
-
expect(page).to have_admin_callout("successfully")
|
214
|
-
end
|
215
|
-
|
216
|
-
within "tbody" do
|
217
|
-
expect(page).to have_content("5 / 5")
|
218
|
-
end
|
219
|
-
end
|
220
|
-
end
|
221
|
-
end
|
222
|
-
|
223
|
-
context "when deleting a newsletter" do
|
224
|
-
let!(:newsletter) { create(:newsletter, organization: organization, author: department_admin) }
|
225
|
-
|
226
|
-
it "deletes a newsletter" do
|
227
|
-
visit decidim_admin.newsletters_path
|
228
|
-
|
229
|
-
within("tr[data-newsletter-id=\"#{newsletter.id}\"]") do
|
230
|
-
accept_confirm { click_link "Delete" }
|
231
|
-
end
|
232
|
-
|
233
|
-
expect(page).to have_content("successfully")
|
234
|
-
expect(page).to have_no_css("tr[data-newsletter-id=\"#{newsletter.id}\"]")
|
235
|
-
end
|
236
|
-
end
|
237
|
-
end
|
@@ -1,75 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe "Department admin should be able to access Admin Dashboard", type: :system do
|
6
|
-
let(:organization) { create(:organization) }
|
7
|
-
let(:area) { create(:area) }
|
8
|
-
let(:department_admin) { create(:department_admin, :confirmed, organization: organization, area: area, accepted_tos_version: Time.current) }
|
9
|
-
let!(:process) { create(:participatory_process, :published, organization: organization, area: area) }
|
10
|
-
|
11
|
-
before do
|
12
|
-
switch_to_host(organization.host)
|
13
|
-
login_as department_admin, scope: :user
|
14
|
-
visit decidim_admin.root_path
|
15
|
-
end
|
16
|
-
|
17
|
-
it "is able to access the admin Dashboard" do
|
18
|
-
expect(page).to have_content("Dashboard")
|
19
|
-
expect(page).to have_content("Welcome to the Admin Panel.")
|
20
|
-
end
|
21
|
-
|
22
|
-
context "when accessing the dashboard some left menu elements should be accessible" do
|
23
|
-
it "is able to access 'Processes'" do
|
24
|
-
expect(page).to have_content("Processes")
|
25
|
-
click_link "Processes"
|
26
|
-
expect(page).to have_current_path "/admin/participatory_processes"
|
27
|
-
expect(page).to have_content("Participatory processes")
|
28
|
-
end
|
29
|
-
|
30
|
-
it "is able to access 'Assemblies'" do
|
31
|
-
expect(page).to have_content("Assemblies")
|
32
|
-
click_link "Assemblies"
|
33
|
-
expect(page).to have_current_path "/admin/assemblies"
|
34
|
-
expect(page).to have_content("New assembly")
|
35
|
-
end
|
36
|
-
|
37
|
-
it "is able to access 'Participants'" do
|
38
|
-
expect(page).to have_content("Participants")
|
39
|
-
click_link "Participants"
|
40
|
-
expect(page).to have_current_path "/admin/users"
|
41
|
-
expect(page).to have_content("New admin")
|
42
|
-
end
|
43
|
-
|
44
|
-
it "is able to access 'Newsletter'" do
|
45
|
-
expect(page).to have_content("Newsletter")
|
46
|
-
click_link "Newsletter"
|
47
|
-
expect(page).to have_current_path "/admin/newsletters"
|
48
|
-
expect(page).to have_content("New newsletter")
|
49
|
-
end
|
50
|
-
|
51
|
-
it "is able to access 'Conferences'" do
|
52
|
-
expect(page).to have_content("Conferences")
|
53
|
-
click_link "Conferences"
|
54
|
-
expect(page).to have_current_path "/admin/conferences"
|
55
|
-
expect(page).to have_content("New Conference")
|
56
|
-
end
|
57
|
-
# TODO: not supported at the moment
|
58
|
-
# it "should be able to access 'Initiatives'"
|
59
|
-
# it "should be able to access 'Consultations'"
|
60
|
-
end
|
61
|
-
|
62
|
-
context "when accessing the dashboard some left menu elements should NOT be accessible" do
|
63
|
-
it "is not able to access 'Pages'" do
|
64
|
-
expect(page).not_to have_content("Pages")
|
65
|
-
end
|
66
|
-
|
67
|
-
it "is not able to access 'Settings'" do
|
68
|
-
expect(page).not_to have_content("Settings")
|
69
|
-
end
|
70
|
-
|
71
|
-
it "is not able to access 'Admin Activity Log'" do
|
72
|
-
expect(page).not_to have_content("Admin activity log")
|
73
|
-
end
|
74
|
-
end
|
75
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe "Admin manages assemblies", versioning: true, type: :system do
|
6
|
-
let(:organization) { create(:organization) }
|
7
|
-
let(:area) { create(:area, organization: organization) }
|
8
|
-
let(:department_admin) { create(:department_admin, :confirmed, organization: organization, area: area) }
|
9
|
-
|
10
|
-
before do
|
11
|
-
switch_to_host(organization.host)
|
12
|
-
login_as department_admin, scope: :user
|
13
|
-
end
|
14
|
-
|
15
|
-
shared_examples "creating an assembly" do
|
16
|
-
let(:image1_filename) { "city.jpeg" }
|
17
|
-
let(:image1_path) { Decidim::Dev.asset(image1_filename) }
|
18
|
-
|
19
|
-
let(:image2_filename) { "city2.jpeg" }
|
20
|
-
let(:image2_path) { Decidim::Dev.asset(image2_filename) }
|
21
|
-
let(:attributes) { attributes_for(:assembly, organization: organization) }
|
22
|
-
|
23
|
-
before do
|
24
|
-
visit decidim_admin_assemblies.assemblies_path
|
25
|
-
click_link "New assembly"
|
26
|
-
end
|
27
|
-
|
28
|
-
it "creates a new assembly" do
|
29
|
-
within ".new_assembly" do
|
30
|
-
fill_in_i18n(:assembly_title, "#assembly-title-tabs", **attributes[:title].except("machine_translations"))
|
31
|
-
fill_in_i18n(:assembly_subtitle, "#assembly-subtitle-tabs", **attributes[:subtitle].except("machine_translations"))
|
32
|
-
fill_in_i18n_editor(:assembly_short_description, "#assembly-short_description-tabs", **attributes[:short_description].except("machine_translations"))
|
33
|
-
fill_in_i18n_editor(:assembly_description, "#assembly-description-tabs", **attributes[:description].except("machine_translations"))
|
34
|
-
fill_in_i18n_editor(:assembly_purpose_of_action, "#assembly-purpose_of_action-tabs", **attributes[:purpose_of_action].except("machine_translations"))
|
35
|
-
fill_in_i18n_editor(:assembly_composition, "#assembly-composition-tabs", **attributes[:composition].except("machine_translations"))
|
36
|
-
fill_in_i18n_editor(:assembly_internal_organisation, "#assembly-internal_organisation-tabs", **attributes[:internal_organisation].except("machine_translations"))
|
37
|
-
fill_in_i18n_editor(:assembly_announcement, "#assembly-announcement-tabs", **attributes[:announcement].except("machine_translations"))
|
38
|
-
fill_in_i18n_editor(:assembly_closing_date_reason, "#assembly-closing_date_reason-tabs", **attributes[:closing_date_reason].except("machine_translations"))
|
39
|
-
|
40
|
-
fill_in_i18n(:assembly_participatory_scope, "#assembly-participatory_scope-tabs", **attributes[:participatory_scope].except("machine_translations"))
|
41
|
-
fill_in_i18n(:assembly_participatory_structure, "#assembly-participatory_structure-tabs", **attributes[:participatory_structure].except("machine_translations"))
|
42
|
-
fill_in_i18n(:assembly_meta_scope, "#assembly-meta_scope-tabs", **attributes[:meta_scope].except("machine_translations"))
|
43
|
-
fill_in_i18n(:assembly_local_area, "#assembly-local_area-tabs", **attributes[:local_area].except("machine_translations"))
|
44
|
-
fill_in_i18n(:assembly_target, "#assembly-target-tabs", **attributes[:target].except("machine_translations"))
|
45
|
-
|
46
|
-
fill_in :assembly_slug, with: "slug"
|
47
|
-
fill_in :assembly_hashtag, with: "#hashtag"
|
48
|
-
fill_in :assembly_weight, with: 1
|
49
|
-
end
|
50
|
-
|
51
|
-
dynamically_attach_file(:assembly_hero_image, image1_path)
|
52
|
-
dynamically_attach_file(:assembly_banner_image, image2_path)
|
53
|
-
|
54
|
-
within ".new_assembly" do
|
55
|
-
find("*[type=submit]").click
|
56
|
-
end
|
57
|
-
|
58
|
-
expect(page).to have_admin_callout("successfully")
|
59
|
-
expect(Decidim::Assembly.last.area).to eq(area)
|
60
|
-
|
61
|
-
within ".container" do
|
62
|
-
# expect(page).to have_current_path decidim_admin_assemblies.assemblies_path(q: { parent_id_eq: parent_assembly&.id })
|
63
|
-
expect(page).to have_content(translated(attributes[:title]))
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
context "when managing parent assemblies" do
|
69
|
-
let(:parent_assembly) { nil }
|
70
|
-
let!(:assembly) { create :assembly, organization: organization }
|
71
|
-
|
72
|
-
before do
|
73
|
-
switch_to_host(organization.host)
|
74
|
-
login_as department_admin, scope: :user
|
75
|
-
visit decidim_admin_assemblies.assemblies_path
|
76
|
-
end
|
77
|
-
|
78
|
-
# it_behaves_like "manage assemblies"
|
79
|
-
it_behaves_like "creating an assembly"
|
80
|
-
end
|
81
|
-
|
82
|
-
context "when managing child assemblies" do
|
83
|
-
let!(:parent_assembly) { create :assembly, organization: organization, area: area }
|
84
|
-
let!(:child_assembly) { create :assembly, organization: organization, parent: parent_assembly, area: area }
|
85
|
-
let(:assembly) { child_assembly }
|
86
|
-
|
87
|
-
before do
|
88
|
-
switch_to_host(organization.host)
|
89
|
-
login_as department_admin, scope: :user
|
90
|
-
visit decidim_admin_assemblies.assemblies_path
|
91
|
-
within find("tr", text: translated(parent_assembly.title)) do
|
92
|
-
click_link "Assemblies"
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
# it_behaves_like "manage assemblies"
|
97
|
-
it_behaves_like "creating an assembly"
|
98
|
-
end
|
99
|
-
end
|
@@ -1,74 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe "Admin manages conferences", versioning: true, type: :system do
|
6
|
-
let(:organization) { create(:organization) }
|
7
|
-
let(:area) { create(:area, organization: organization) }
|
8
|
-
let(:department_admin) { create(:department_admin, :confirmed, organization: organization, area: area) }
|
9
|
-
|
10
|
-
before do
|
11
|
-
switch_to_host(organization.host)
|
12
|
-
login_as department_admin, scope: :user
|
13
|
-
end
|
14
|
-
|
15
|
-
shared_examples "creating an conference" do
|
16
|
-
let(:image1_filename) { "city.jpeg" }
|
17
|
-
let(:image1_path) { Decidim::Dev.asset(image1_filename) }
|
18
|
-
|
19
|
-
let(:image2_filename) { "city2.jpeg" }
|
20
|
-
let(:image2_path) { Decidim::Dev.asset(image2_filename) }
|
21
|
-
|
22
|
-
before do
|
23
|
-
visit decidim_admin_conferences.assemblies_path
|
24
|
-
click_link "New conference"
|
25
|
-
end
|
26
|
-
|
27
|
-
it "creates a new conference" do
|
28
|
-
within ".new_conference" do
|
29
|
-
fill_in_i18n(
|
30
|
-
:conference_title,
|
31
|
-
"#conference-title-tabs",
|
32
|
-
en: "My conference",
|
33
|
-
es: "Mi conferencia",
|
34
|
-
ca: "Mi jornada"
|
35
|
-
)
|
36
|
-
fill_in_i18n(
|
37
|
-
:conference_subtitle,
|
38
|
-
"#conference-subtitle-tabs",
|
39
|
-
en: "Subtitle",
|
40
|
-
es: "Subtítulo",
|
41
|
-
ca: "Subtítol"
|
42
|
-
)
|
43
|
-
fill_in_i18n_editor(
|
44
|
-
:conference_short_description,
|
45
|
-
"#conference-short_description-tabs",
|
46
|
-
en: "Short description",
|
47
|
-
es: "Descripción corta",
|
48
|
-
ca: "Descripció curta"
|
49
|
-
)
|
50
|
-
fill_in_i18n_editor(
|
51
|
-
:conference_description,
|
52
|
-
"#conference-description-tabs",
|
53
|
-
en: "A longer description",
|
54
|
-
es: "Descripción más larga",
|
55
|
-
ca: "Descripció més llarga"
|
56
|
-
)
|
57
|
-
|
58
|
-
fill_in :conference_slug, with: "slug"
|
59
|
-
fill_in :conference_hashtag, with: "#hashtag"
|
60
|
-
attach_file :conference_hero_image, image1_path
|
61
|
-
attach_file :conference_banner_image, image2_path
|
62
|
-
|
63
|
-
find("*[type=submit]").click
|
64
|
-
end
|
65
|
-
|
66
|
-
expect(page).to have_admin_callout("successfully")
|
67
|
-
expect(Decidim::Conference.last.area).to eq(area)
|
68
|
-
|
69
|
-
within ".container" do
|
70
|
-
expect(page).to have_content("My conference")
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
end
|
@@ -1,117 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe "Admin manages participatory processes", versioning: true, type: :system do
|
6
|
-
let(:organization) { create(:organization) }
|
7
|
-
let(:area) { create(:area, organization: organization) }
|
8
|
-
let(:department_admin) { create(:department_admin, :confirmed, organization: organization, area: area) }
|
9
|
-
|
10
|
-
let!(:participatory_process_groups) do
|
11
|
-
create_list(:participatory_process_group, 3, organization: organization)
|
12
|
-
end
|
13
|
-
|
14
|
-
before do
|
15
|
-
switch_to_host(organization.host)
|
16
|
-
login_as department_admin, scope: :user
|
17
|
-
visit decidim_admin_participatory_processes.participatory_processes_path
|
18
|
-
end
|
19
|
-
|
20
|
-
# it_behaves_like "manage processes examples"
|
21
|
-
# it_behaves_like "manage processes announcements"
|
22
|
-
|
23
|
-
context "with processes" do
|
24
|
-
let!(:participatory_process) { create(:participatory_process, organization: organization, area: area, participatory_process_group: participatory_process_groups.first) }
|
25
|
-
|
26
|
-
it "browses the list of processes" do
|
27
|
-
visit decidim_admin_participatory_processes.participatory_processes_path
|
28
|
-
expect(page).to have_content(translated(participatory_process.title))
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context "when creating a participatory process" do
|
33
|
-
let(:image1_filename) { "city.jpeg" }
|
34
|
-
let(:image1_path) { Decidim::Dev.asset(image1_filename) }
|
35
|
-
|
36
|
-
let(:image2_filename) { "city2.jpeg" }
|
37
|
-
let(:image2_path) { Decidim::Dev.asset(image2_filename) }
|
38
|
-
|
39
|
-
before do
|
40
|
-
click_link "New process"
|
41
|
-
end
|
42
|
-
|
43
|
-
it "creates a new participatory process with department admin's area" do
|
44
|
-
within ".new_participatory_process" do
|
45
|
-
fill_in_i18n(
|
46
|
-
:participatory_process_title,
|
47
|
-
"#participatory_process-title-tabs",
|
48
|
-
en: "My participatory process",
|
49
|
-
es: "Mi proceso participativo",
|
50
|
-
ca: "El meu procés participatiu"
|
51
|
-
)
|
52
|
-
fill_in_i18n(
|
53
|
-
:participatory_process_subtitle,
|
54
|
-
"#participatory_process-subtitle-tabs",
|
55
|
-
en: "Subtitle",
|
56
|
-
es: "Subtítulo",
|
57
|
-
ca: "Subtítol"
|
58
|
-
)
|
59
|
-
fill_in_i18n_editor(
|
60
|
-
:participatory_process_short_description,
|
61
|
-
"#participatory_process-short_description-tabs",
|
62
|
-
en: "Short description",
|
63
|
-
es: "Descripción corta",
|
64
|
-
ca: "Descripció curta"
|
65
|
-
)
|
66
|
-
fill_in_i18n_editor(
|
67
|
-
:participatory_process_description,
|
68
|
-
"#participatory_process-description-tabs",
|
69
|
-
en: "A longer description",
|
70
|
-
es: "Descripción más larga",
|
71
|
-
ca: "Descripció més llarga"
|
72
|
-
)
|
73
|
-
|
74
|
-
group_name = participatory_process_groups.first.title["en"]
|
75
|
-
select group_name, from: :participatory_process_participatory_process_group_id
|
76
|
-
|
77
|
-
fill_in :participatory_process_slug, with: "slug"
|
78
|
-
fill_in :participatory_process_hashtag, with: "#hashtag"
|
79
|
-
end
|
80
|
-
|
81
|
-
dynamically_attach_file(:participatory_process_hero_image, image1_path)
|
82
|
-
dynamically_attach_file(:participatory_process_banner_image, image2_path)
|
83
|
-
|
84
|
-
within ".new_participatory_process" do
|
85
|
-
find("*[type=submit]").click
|
86
|
-
end
|
87
|
-
|
88
|
-
expect(page).to have_admin_callout("successfully")
|
89
|
-
expect(Decidim::ParticipatoryProcess.last.area).to eq(area)
|
90
|
-
|
91
|
-
within ".container" do
|
92
|
-
expect(page).to have_current_path decidim_admin_participatory_processes.participatory_process_steps_path(Decidim::ParticipatoryProcess.last)
|
93
|
-
expect(page).to have_content("Phases")
|
94
|
-
expect(page).to have_content("Introduction")
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
context "when updating a participatory process" do
|
100
|
-
let!(:participatory_process_3) { create(:participatory_process, organization: organization, area: area) }
|
101
|
-
|
102
|
-
before do
|
103
|
-
visit decidim_admin_participatory_processes.participatory_processes_path
|
104
|
-
end
|
105
|
-
|
106
|
-
it "update a participatory process without images does not delete them" do
|
107
|
-
click_link translated(participatory_process_3.title)
|
108
|
-
click_submenu_link "Info"
|
109
|
-
click_button "Update"
|
110
|
-
|
111
|
-
expect(participatory_process_3.reload.area).to eq(area)
|
112
|
-
expect(page).to have_admin_callout("successfully")
|
113
|
-
expect(page).to have_css("img[src*='#{participatory_process_3.attached_uploader(:hero_image).path}']")
|
114
|
-
expect(page).to have_css("img[src*='#{participatory_process_3.attached_uploader(:banner_image).path}']")
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
data/spec/system/department_admin_should_be_able_to_see_only_assemblies_from_her_area_spec.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
describe "Admin manages assemblies", versioning: true, type: :system do
|
6
|
-
let(:organization) { create(:organization) }
|
7
|
-
let(:area) { create(:area) }
|
8
|
-
let(:department_admin) { create(:department_admin, :confirmed, organization: organization, area: area) }
|
9
|
-
|
10
|
-
let!(:assembly_w_area) { create(:assembly, organization: organization, area: area) }
|
11
|
-
let!(:assembly_wo_area) { create(:assembly, organization: organization) }
|
12
|
-
|
13
|
-
def visit_admin_assemblies_list
|
14
|
-
switch_to_host(organization.host)
|
15
|
-
login_as department_admin, scope: :user
|
16
|
-
visit decidim_admin_assemblies.assemblies_path
|
17
|
-
end
|
18
|
-
|
19
|
-
it "sees the import button" do
|
20
|
-
visit_admin_assemblies_list
|
21
|
-
expect(page).to have_content("Import")
|
22
|
-
end
|
23
|
-
|
24
|
-
it "sees the export button" do
|
25
|
-
visit_admin_assemblies_list
|
26
|
-
expect(page).to have_css(".icon--data-transfer-download")
|
27
|
-
end
|
28
|
-
|
29
|
-
it "sees only processes in the same area" do
|
30
|
-
visit_admin_assemblies_list
|
31
|
-
expect(page).to have_content(assembly_w_area.title["en"])
|
32
|
-
expect(page).not_to have_content(assembly_wo_area.title["en"])
|
33
|
-
end
|
34
|
-
|
35
|
-
context "when department_admin has a user_role in an assembly_wo_area" do
|
36
|
-
let!(:assembly_user_role) do
|
37
|
-
create(:assembly_user_role, user: department_admin, assembly: assembly_wo_area)
|
38
|
-
end
|
39
|
-
|
40
|
-
it "sees both assemblies" do
|
41
|
-
visit_admin_assemblies_list
|
42
|
-
expect(page).to have_content(assembly_w_area.title["en"])
|
43
|
-
expect(page).to have_content(assembly_wo_area.title["en"])
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|