decidim-department_admin 0.7.2 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- 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,160 +1,117 @@
|
|
1
1
|
<% add_decidim_page_title(t("participatory_processes", scope: "decidim.admin.titles")) %>
|
2
|
+
<%= admin_tabs(:admin_participatory_processes_menu).render %>
|
2
3
|
|
3
|
-
|
4
|
-
<%=
|
5
|
-
|
6
|
-
|
7
|
-
<div class="card with-overflow" id="processes">
|
8
|
-
<div class="card-divider">
|
9
|
-
<h2 class="card-title">
|
10
|
-
<%= t("participatory_processes", scope: "decidim.admin.titles") %>
|
11
|
-
|
12
|
-
<% if allowed_to? :create, :process %>
|
13
|
-
<%= link_to t("actions.new_process", scope: "decidim.admin"),
|
14
|
-
[:new, :participatory_process],
|
15
|
-
class: "button tiny button--title" %>
|
16
|
-
<% end %>
|
17
|
-
|
18
|
-
<% if process_group %>
|
19
|
-
<span><</span>
|
20
|
-
<%= link_to translated_attribute(process_group.title),
|
21
|
-
edit_participatory_process_group_path(process_group) %>
|
22
|
-
<% end %>
|
4
|
+
<div class="card" id="processes">
|
5
|
+
<%= admin_filter_selector %>
|
6
|
+
</div>
|
23
7
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
8
|
+
<div class="table-scroll">
|
9
|
+
<table class="table-list">
|
10
|
+
<thead>
|
11
|
+
<tr>
|
12
|
+
<th>
|
13
|
+
<%= sort_link(query, :title, t("models.participatory_process.fields.title", scope: "decidim.admin")) %>
|
14
|
+
</th>
|
15
|
+
<th>
|
16
|
+
<%= sort_link(query, :area_name, t("models.participatory_process.fields.department", scope: "decidim.admin")) %>
|
17
|
+
</th>
|
18
|
+
<th>
|
19
|
+
<%= t("models.participatory_process.fields.department_role", scope: "decidim.admin") %>
|
20
|
+
</th>
|
21
|
+
<th>
|
22
|
+
<%= t("models.participatory_process.fields.process_role", scope: "decidim.admin") %>
|
23
|
+
</th>
|
24
|
+
<th>
|
25
|
+
<%= sort_link(query, :created_at, t("models.participatory_process.fields.created_at", scope: "decidim.admin"), default_order: :desc) %>
|
26
|
+
</th>
|
27
|
+
<th>
|
28
|
+
<%= sort_link(query, :private_space, t("models.participatory_process.fields.private", scope: "decidim.admin")) %>
|
29
|
+
</th>
|
30
|
+
<th class="table-list__actions">
|
31
|
+
<%= sort_link(query, :published_at, t("models.participatory_process.fields.published", scope: "decidim.admin")) %>
|
32
|
+
</th>
|
33
|
+
<th></th>
|
34
|
+
</tr>
|
35
|
+
</thead>
|
36
|
+
<tbody>
|
37
|
+
<% @participatory_processes.each do |process| %>
|
38
|
+
<tr>
|
39
|
+
<td>
|
40
|
+
<% if process.promoted? %>
|
41
|
+
<%= icon_with_tooltip "star-s-fill", t("models.assembly.fields.promoted", scope: "decidim.admin") %>
|
42
|
+
<% end %>
|
43
|
+
<% if allowed_to? :update, :process, process: process %>
|
44
|
+
<%= link_to translated_attribute(process.title), edit_participatory_process_path(process) %><br>
|
45
|
+
<% elsif allowed_to? :read, :component, process: process %>
|
46
|
+
<%= link_to translated_attribute(process.title), components_path(process) %><br>
|
47
|
+
<% else %>
|
48
|
+
<%= translated_attribute(process.title) %>
|
49
|
+
<% end %>
|
50
|
+
</td>
|
51
|
+
<td>
|
52
|
+
<% if(process.area != nil) %>
|
53
|
+
<%= translated_attribute(process.area.name)%>
|
54
|
+
<% end %>
|
55
|
+
</td>
|
56
|
+
<td>
|
57
|
+
<% if(process.area != nil) %>
|
58
|
+
<%= process.area.users.map(&:name).join(", ") %>
|
59
|
+
<% end %>
|
60
|
+
</td>
|
61
|
+
<td>
|
62
|
+
<%= process.users_with_any_role.map(&:name).join(", ") %>
|
63
|
+
</td>
|
64
|
+
<td class="table-list__date">
|
65
|
+
<%= l process.created_at, format: :short %>
|
66
|
+
</td>
|
67
|
+
<td class="table-list__state">
|
68
|
+
<% if process.private_space? %>
|
69
|
+
<span><%= t("participatory_processes.index.private", scope: "decidim.admin") %></span>
|
70
|
+
<% else %>
|
71
|
+
<span><%= t("participatory_processes.index.public", scope: "decidim.admin") %></span>
|
72
|
+
<% end %>
|
73
|
+
</td>
|
74
|
+
<td class="table-list__state">
|
75
|
+
<% if process.published? %>
|
76
|
+
<span class="label success !text-sm"><%= t("participatory_processes.index.published", scope: "decidim.admin") %></span>
|
77
|
+
<% else %>
|
78
|
+
<span class="label alert !text-sm"><%= t("participatory_processes.index.unpublished", scope: "decidim.admin") %></span>
|
79
|
+
<% end %>
|
80
|
+
</td>
|
81
|
+
<td class="table-list__actions">
|
82
|
+
<% if allowed_to? :update, :process, process: process %>
|
83
|
+
<%= icon_link_to "pencil-line", edit_participatory_process_path(process), t("actions.configure", scope: "decidim.admin"), class: "action-icon--new" %>
|
84
|
+
<% else %>
|
85
|
+
<span class="action-space icon"></span>
|
86
|
+
<% end %>
|
29
87
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
<ul class="list-reset">
|
35
|
-
<%= link_to query_params_with(decidim_participatory_process_group_id_eq: nil) do %>
|
36
|
-
<li><%= t("actions.filter.all_processes", scope: "decidim.admin") %></li>
|
37
|
-
<% end %>
|
38
|
-
<% process_groups_for_select.each do |group_title, group_id| %>
|
39
|
-
<%= link_to query_params_with(decidim_participatory_process_group_id_eq: group_id) do %>
|
40
|
-
<li><%= group_title %></li>
|
88
|
+
<% if allowed_to? :create, :process, process: process %>
|
89
|
+
<%= icon_link_to "download-line", participatory_process_export_path(process), t("actions.export", scope: "decidim.admin"), method: :post, class: "action-icon--export" %>
|
90
|
+
<% else %>
|
91
|
+
<span class="action-space icon"></span>
|
41
92
|
<% end %>
|
42
|
-
<% end %>
|
43
|
-
</ul>
|
44
|
-
</div>
|
45
|
-
</h2>
|
46
|
-
</div>
|
47
|
-
<%= admin_filter_selector %>
|
48
|
-
<div class="card-section">
|
49
|
-
<div class="table-scroll">
|
50
|
-
<table class="table-list">
|
51
|
-
<thead>
|
52
|
-
<tr>
|
53
|
-
<th>
|
54
|
-
<%= sort_link(query, :title, t("models.participatory_process.fields.title", scope: "decidim.admin")) %>
|
55
|
-
</th>
|
56
|
-
<th>
|
57
|
-
<%= sort_link(query, :area_name, t("models.participatory_process.fields.department", scope: "decidim.admin")) %>
|
58
|
-
</th>
|
59
|
-
<th>
|
60
|
-
<%= t("models.participatory_process.fields.department_role", scope: "decidim.admin") %>
|
61
|
-
</th>
|
62
|
-
<th>
|
63
|
-
<%= t("models.participatory_process.fields.process_role", scope: "decidim.admin") %>
|
64
|
-
</th>
|
65
|
-
<th>
|
66
|
-
<%= sort_link(query, :created_at, t("models.participatory_process.fields.created_at", scope: "decidim.admin"), default_order: :desc) %>
|
67
|
-
</th>
|
68
|
-
<th>
|
69
|
-
<%= sort_link(query, :private_space, t("models.participatory_process.fields.private", scope: "decidim.admin")) %>
|
70
|
-
</th>
|
71
|
-
<th class="table-list__actions">
|
72
|
-
<%= sort_link(query, :published_at, t("models.participatory_process.fields.published", scope: "decidim.admin")) %>
|
73
|
-
</th>
|
74
|
-
<th></th>
|
75
|
-
</tr>
|
76
|
-
</thead>
|
77
|
-
<tbody>
|
78
|
-
<% @participatory_processes.each do |process| %>
|
79
|
-
<tr>
|
80
|
-
<td>
|
81
|
-
<% if process.promoted? %>
|
82
|
-
<span data-tooltip class="icon-state icon-highlight" aria-haspopup="true" data-disable-hover="false" title="<%= t("models.participatory_process.fields.promoted", scope: "decidim.admin") %>">
|
83
|
-
<%= icon "star" %>
|
84
|
-
</span>
|
85
|
-
<% end %>
|
86
|
-
<% if allowed_to? :update, :process, process: process %>
|
87
|
-
<%= link_to translated_attribute(process.title), edit_participatory_process_path(process) %><br>
|
88
|
-
<% elsif allowed_to? :read, :component, process: process %>
|
89
|
-
<%= link_to translated_attribute(process.title), components_path(process) %><br>
|
90
|
-
<% elsif allowed_to? :preview, :process, process: process %>
|
91
|
-
<%= link_to translated_attribute(process.title), decidim_participatory_processes.participatory_process_path(process) %><br>
|
92
|
-
<% elsif allowed_to? :read, :moderation, process: process %>
|
93
|
-
<%= link_to translated_attribute(process.title), moderations_path(process) %><br>
|
94
|
-
<% else %>
|
95
|
-
<%= translated_attribute(process.title) %>
|
96
|
-
<% end %>
|
97
|
-
</td>
|
98
|
-
<td>
|
99
|
-
<% if(process.area != nil) %>
|
100
|
-
<%= translated_attribute(process.area.name)%>
|
101
|
-
<% end %>
|
102
|
-
</td>
|
103
|
-
<td>
|
104
|
-
<% if(process.area != nil) %>
|
105
|
-
<%= process.area.users.map(&:name).join(", ") %>
|
106
|
-
<% end %>
|
107
|
-
</td>
|
108
|
-
<td>
|
109
|
-
<%= process.users_with_any_role.map(&:name).join(", ") %>
|
110
|
-
</td>
|
111
|
-
<td>
|
112
|
-
<%= l process.created_at, format: :short %>
|
113
|
-
</td>
|
114
|
-
<td class="table-list__state">
|
115
|
-
<% if process.private_space? %>
|
116
|
-
<strong class="text-alert"><%= t("participatory_processes.index.private", scope: "decidim.admin") %></strong>
|
117
|
-
<% else %>
|
118
|
-
<strong class="text-success"><%= t("participatory_processes.index.public", scope: "decidim.admin") %></strong>
|
119
|
-
<% end %>
|
120
|
-
</td>
|
121
|
-
<td class="table-list__state">
|
122
|
-
<% if process.published? %>
|
123
|
-
<strong class="text-success"><%= t("participatory_processes.index.published", scope: "decidim.admin") %></strong>
|
124
|
-
<% else %>
|
125
|
-
<strong class="text-alert"><%= t("participatory_processes.index.not_published", scope: "decidim.admin") %></strong>
|
126
|
-
<% end %>
|
127
|
-
</td>
|
128
|
-
<td class="table-list__actions">
|
129
|
-
<% if allowed_to? :create, :process, process: process %>
|
130
|
-
<%= icon_link_to "data-transfer-download", participatory_process_export_path(process), t("actions.export", scope: "decidim.admin"), method: :post, class: "action-icon--export" %>
|
131
|
-
<% else %>
|
132
|
-
<span class="action-space icon"></span>
|
133
|
-
<% end %>
|
134
93
|
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
94
|
+
<% if allowed_to? :create, :process, process: process %>
|
95
|
+
<%= icon_link_to "file-copy-line", new_participatory_process_copy_path(process), t("actions.duplicate", scope: "decidim.admin"), class: "action-icon--copy" %>
|
96
|
+
<% else %>
|
97
|
+
<span class="action-space icon"></span>
|
98
|
+
<% end %>
|
140
99
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
100
|
+
<% if allowed_to? :preview, :process, process: process %>
|
101
|
+
<%= icon_link_to "eye-line", decidim_participatory_processes.participatory_process_path(process), t("actions.preview", scope: "decidim.admin"), class: "action-icon--preview", target: "_blank", data: { "external-link": false } %>
|
102
|
+
<% else %>
|
103
|
+
<span class="action-space icon"></span>
|
104
|
+
<% end %>
|
146
105
|
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
<%= paginate @participatory_processes, theme: "decidim" %>
|
158
|
-
</div>
|
159
|
-
</div>
|
106
|
+
<% if allowed_to? :read, :moderation, process: process %>
|
107
|
+
<%= icon_link_to "flag-line", moderations_path(process), t("actions.moderate", scope: "decidim.admin"), class: "action-icon--moderate" %>
|
108
|
+
<% else %>
|
109
|
+
<span class="action-space icon"></span>
|
110
|
+
<% end %>
|
111
|
+
</td>
|
112
|
+
</tr>
|
113
|
+
<% end %>
|
114
|
+
</tbody>
|
115
|
+
</table>
|
160
116
|
</div>
|
117
|
+
<%= decidim_paginate @participatory_processes %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-department_admin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Valls
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-admin
|
@@ -16,70 +16,70 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.28.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.28.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: decidim-core
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.28.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.28.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: decidim
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.28.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.28.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: decidim-conferences
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.28.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.28.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: decidim-dev
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.28.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.28.0
|
83
83
|
description: This Dedicim's module produces a new "department admin" role which restricts
|
84
84
|
the permissions of an Admin into participatory spaces of a given Area.
|
85
85
|
email:
|
@@ -162,26 +162,6 @@ files:
|
|
162
162
|
- lib/decidim/department_admin/engine.rb
|
163
163
|
- lib/decidim/department_admin/test/factories.rb
|
164
164
|
- lib/decidim/department_admin/version.rb
|
165
|
-
- spec/commands/decidim/admin/deliver_newsletter_spec.rb
|
166
|
-
- spec/commands/decidim/invite_user_spec.rb
|
167
|
-
- spec/controllers/decidim/admin/users_controller_spec.rb
|
168
|
-
- spec/factories.rb
|
169
|
-
- spec/features/check_overrides_spec.rb
|
170
|
-
- spec/i18n_spec.rb
|
171
|
-
- spec/models/decidim/area_spec.rb
|
172
|
-
- spec/permissions/decidim/department_admin/department_admin_permissions_spec.rb
|
173
|
-
- spec/queries/parent_assemblies_for_select_spec.rb
|
174
|
-
- spec/spec_helper.rb
|
175
|
-
- spec/system/admin_explores_processes_spec.rb
|
176
|
-
- spec/system/admin_invite_department_admin_spec.rb
|
177
|
-
- spec/system/department_admin_manages_newsletters_spec.rb
|
178
|
-
- spec/system/department_admin_should_be_able_to_access_admin_dashboard_spec.rb
|
179
|
-
- spec/system/department_admin_should_be_able_to_manage_assemblies_spec.rb
|
180
|
-
- spec/system/department_admin_should_be_able_to_manage_conferences_spec.rb
|
181
|
-
- spec/system/department_admin_should_be_able_to_manage_processes_spec.rb
|
182
|
-
- spec/system/department_admin_should_be_able_to_see_only_assemblies_from_her_area_spec.rb
|
183
|
-
- spec/system/department_admin_should_be_able_to_see_only_newsletters_from_her_area_spec.rb
|
184
|
-
- spec/system/department_admin_should_be_able_to_see_only_processes_from_her_area_spec.rb
|
185
165
|
homepage: https://github.com/decidim/decidim-module-department_admin
|
186
166
|
licenses:
|
187
167
|
- AGPL-3.0
|
@@ -195,35 +175,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
195
175
|
requirements:
|
196
176
|
- - ">="
|
197
177
|
- !ruby/object:Gem::Version
|
198
|
-
version: 3.
|
178
|
+
version: 3.1.1
|
199
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
200
180
|
requirements:
|
201
181
|
- - ">="
|
202
182
|
- !ruby/object:Gem::Version
|
203
183
|
version: '0'
|
204
184
|
requirements: []
|
205
|
-
rubygems_version: 3.
|
185
|
+
rubygems_version: 3.3.7
|
206
186
|
signing_key:
|
207
187
|
specification_version: 4
|
208
188
|
summary: A decidim department_admin module
|
209
|
-
test_files:
|
210
|
-
- spec/commands/decidim/admin/deliver_newsletter_spec.rb
|
211
|
-
- spec/commands/decidim/invite_user_spec.rb
|
212
|
-
- spec/controllers/decidim/admin/users_controller_spec.rb
|
213
|
-
- spec/factories.rb
|
214
|
-
- spec/features/check_overrides_spec.rb
|
215
|
-
- spec/i18n_spec.rb
|
216
|
-
- spec/models/decidim/area_spec.rb
|
217
|
-
- spec/permissions/decidim/department_admin/department_admin_permissions_spec.rb
|
218
|
-
- spec/queries/parent_assemblies_for_select_spec.rb
|
219
|
-
- spec/spec_helper.rb
|
220
|
-
- spec/system/admin_explores_processes_spec.rb
|
221
|
-
- spec/system/admin_invite_department_admin_spec.rb
|
222
|
-
- spec/system/department_admin_manages_newsletters_spec.rb
|
223
|
-
- spec/system/department_admin_should_be_able_to_access_admin_dashboard_spec.rb
|
224
|
-
- spec/system/department_admin_should_be_able_to_manage_assemblies_spec.rb
|
225
|
-
- spec/system/department_admin_should_be_able_to_manage_conferences_spec.rb
|
226
|
-
- spec/system/department_admin_should_be_able_to_manage_processes_spec.rb
|
227
|
-
- spec/system/department_admin_should_be_able_to_see_only_assemblies_from_her_area_spec.rb
|
228
|
-
- spec/system/department_admin_should_be_able_to_see_only_newsletters_from_her_area_spec.rb
|
229
|
-
- spec/system/department_admin_should_be_able_to_see_only_processes_from_her_area_spec.rb
|
189
|
+
test_files: []
|
@@ -1,175 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
module Decidim::Admin
|
6
|
-
describe DeliverNewsletter do
|
7
|
-
describe "call" do
|
8
|
-
let(:organization) { create(:organization) }
|
9
|
-
let(:newsletter) do
|
10
|
-
create(:newsletter,
|
11
|
-
organization: organization,
|
12
|
-
author: current_user)
|
13
|
-
end
|
14
|
-
let(:area) { create(:area, organization: organization) }
|
15
|
-
let(:current_user) { create(:department_admin, :confirmed, organization: organization, area: area) }
|
16
|
-
let(:send_to_all_users) { false }
|
17
|
-
let(:send_to_followers) { false }
|
18
|
-
let(:send_to_participants) { false }
|
19
|
-
let(:participatory_space_types) { [] }
|
20
|
-
let(:scope_ids) { [] }
|
21
|
-
|
22
|
-
let(:form_params) do
|
23
|
-
{
|
24
|
-
send_to_all_users: send_to_all_users,
|
25
|
-
send_to_followers: send_to_followers,
|
26
|
-
send_to_participants: send_to_participants,
|
27
|
-
participatory_space_types: participatory_space_types,
|
28
|
-
scope_ids: scope_ids,
|
29
|
-
}
|
30
|
-
end
|
31
|
-
|
32
|
-
let(:form) do
|
33
|
-
SelectiveNewsletterForm.from_params(
|
34
|
-
form_params
|
35
|
-
).with_context(
|
36
|
-
current_organization: organization,
|
37
|
-
current_user: current_user
|
38
|
-
)
|
39
|
-
end
|
40
|
-
|
41
|
-
let(:command) { described_class.new(newsletter, form, current_user) }
|
42
|
-
|
43
|
-
shared_examples_for "selective newsletter" do
|
44
|
-
context "when everything is ok" do
|
45
|
-
it "updates the counters and delivers to the right users" do
|
46
|
-
clear_emails
|
47
|
-
expect(emails.length).to eq(0)
|
48
|
-
|
49
|
-
perform_enqueued_jobs { command.call }
|
50
|
-
|
51
|
-
expect(emails.length).to eq(deliverable_users.count)
|
52
|
-
|
53
|
-
newsletter.reload
|
54
|
-
expect(newsletter.total_deliveries).to eq(deliverable_users.count)
|
55
|
-
expect(newsletter.total_recipients).to eq(deliverable_users.count)
|
56
|
-
end
|
57
|
-
|
58
|
-
it "logs the action", versioning: true do
|
59
|
-
expect(Decidim.traceability)
|
60
|
-
.to receive(:perform_action!)
|
61
|
-
.with("deliver", newsletter, current_user)
|
62
|
-
.and_call_original
|
63
|
-
|
64
|
-
expect do
|
65
|
-
perform_enqueued_jobs { command.call }
|
66
|
-
end.to change(Decidim::ActionLog, :count)
|
67
|
-
|
68
|
-
action_log = Decidim::ActionLog.last
|
69
|
-
expect(action_log.version).to be_present
|
70
|
-
expect(action_log.version.event).to eq "update"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
context "when the user is a department admin" do
|
76
|
-
let!(:participatory_process) { create(:participatory_process, organization: organization, area: area) }
|
77
|
-
let!(:component) { create(:dummy_component, organization: newsletter.organization, participatory_space: participatory_process) }
|
78
|
-
|
79
|
-
context "when no spaces selected" do
|
80
|
-
it "is not valid" do
|
81
|
-
expect { command.call }.to broadcast(:invalid)
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
context "when spaces selected" do
|
86
|
-
let(:participatory_space_types) do
|
87
|
-
[
|
88
|
-
{ "id" => nil,
|
89
|
-
"manifest_name" => "participatory_processes",
|
90
|
-
"ids" => [component.participatory_space.id.to_s] },
|
91
|
-
{ "id" => nil,
|
92
|
-
"manifest_name" => "assemblies",
|
93
|
-
"ids" => [] },
|
94
|
-
{ "id" => nil,
|
95
|
-
"manifest_name" => "conferences",
|
96
|
-
"ids" => [] },
|
97
|
-
{ "id" => nil,
|
98
|
-
"manifest_name" => "consultations",
|
99
|
-
"ids" => [] },
|
100
|
-
{ "id" => nil,
|
101
|
-
"manifest_name" => "initiatives",
|
102
|
-
"ids" => [] },
|
103
|
-
]
|
104
|
-
end
|
105
|
-
|
106
|
-
context "when sending to followers" do
|
107
|
-
let(:send_to_followers) { true }
|
108
|
-
|
109
|
-
let!(:deliverable_users) do
|
110
|
-
create_list(:user, rand(2..9), :confirmed, organization: organization, newsletter_notifications_at: Time.current)
|
111
|
-
end
|
112
|
-
|
113
|
-
let!(:undeliverable_users) do
|
114
|
-
create_list(:user, rand(2..9), :confirmed, organization: organization, newsletter_notifications_at: Time.current)
|
115
|
-
end
|
116
|
-
|
117
|
-
before do
|
118
|
-
deliverable_users.each do |follower|
|
119
|
-
create(:follow, followable: participatory_process, user: follower)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
|
123
|
-
it_behaves_like "selective newsletter"
|
124
|
-
end
|
125
|
-
|
126
|
-
context "when sending to all space participants" do
|
127
|
-
let(:send_to_participants) { true }
|
128
|
-
let!(:deliverable_users) do
|
129
|
-
create_list(:user, rand(2..9), :confirmed, organization: organization, newsletter_notifications_at: Time.current)
|
130
|
-
end
|
131
|
-
|
132
|
-
before do
|
133
|
-
deliverable_users.each do |participant|
|
134
|
-
create(:dummy_resource, component: component, author: participant, published_at: Time.current)
|
135
|
-
end
|
136
|
-
end
|
137
|
-
|
138
|
-
it_behaves_like "selective newsletter"
|
139
|
-
end
|
140
|
-
|
141
|
-
context "when sending to followers and participants" do
|
142
|
-
let(:send_to_participants) { true }
|
143
|
-
let(:send_to_followers) { true }
|
144
|
-
|
145
|
-
let!(:participant_users) do
|
146
|
-
create_list(:user, rand(2..9), :confirmed, organization: organization, newsletter_notifications_at: Time.current)
|
147
|
-
end
|
148
|
-
|
149
|
-
let!(:follower_users) do
|
150
|
-
create_list(:user, rand(2..9), :confirmed, organization: organization, newsletter_notifications_at: Time.current)
|
151
|
-
end
|
152
|
-
|
153
|
-
let!(:deliverable_users) { participant_users + follower_users }
|
154
|
-
|
155
|
-
let!(:undeliverable_users) do
|
156
|
-
create_list(:user, rand(2..9), :confirmed, organization: organization, newsletter_notifications_at: Time.current)
|
157
|
-
end
|
158
|
-
|
159
|
-
before do
|
160
|
-
participant_users.each do |participant|
|
161
|
-
create(:dummy_resource, component: component, author: participant, published_at: Time.current)
|
162
|
-
end
|
163
|
-
|
164
|
-
follower_users.each do |follower|
|
165
|
-
create(:follow, followable: component.participatory_space, user: follower)
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
it_behaves_like "selective newsletter"
|
170
|
-
end
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
174
|
-
end
|
175
|
-
end
|
@@ -1,42 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "spec_helper"
|
4
|
-
|
5
|
-
module Decidim
|
6
|
-
describe InviteUser do
|
7
|
-
describe "call" do
|
8
|
-
let(:organization) { create(:organization) }
|
9
|
-
|
10
|
-
let(:current_user) { create(:admin, :confirmed, organization: organization) }
|
11
|
-
|
12
|
-
let(:form_params) do
|
13
|
-
{
|
14
|
-
name: "user_name",
|
15
|
-
email: "user_name@example.org",
|
16
|
-
organization: organization,
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
|
-
let(:form) do
|
21
|
-
InviteUserForm.from_params(
|
22
|
-
form_params
|
23
|
-
).with_context(
|
24
|
-
current_organization: organization,
|
25
|
-
current_user: current_user
|
26
|
-
)
|
27
|
-
end
|
28
|
-
|
29
|
-
let(:command) { described_class.new(form, current_user) }
|
30
|
-
|
31
|
-
shared_examples_for "inviting_users" do
|
32
|
-
context "when everything is ok" do
|
33
|
-
it "invites the user with no area" do
|
34
|
-
invite_user
|
35
|
-
user = Decidim::User.find_by(email: "user_name@example.org")
|
36
|
-
expect(user).to exist
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|