decidim-department_admin 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE-AGPLv3.txt +661 -0
- data/README.md +132 -0
- data/Rakefile +9 -0
- data/app/controllers/decidim/department_admin/admin/application_controller.rb +15 -0
- data/app/controllers/decidim/department_admin/application_controller.rb +13 -0
- data/app/decorators/decidim/admin/newsletters_controller_decorator.rb +30 -0
- data/app/decorators/decidim/admin/users_controller_decorator.rb +128 -0
- data/app/decorators/decidim/area_decorator.rb +44 -0
- data/app/decorators/decidim/assemblies/admin/assemblies_controller_decorator.rb +25 -0
- data/app/decorators/decidim/assemblies/admin/assemblies_helper_decorator.rb +24 -0
- data/app/decorators/decidim/assemblies/create_assembly_decorator.rb +19 -0
- data/app/decorators/decidim/assemblies/parent_assemblies_for_select_decorator.rb +38 -0
- data/app/decorators/decidim/assemblies/permissions_decorator.rb +22 -0
- data/app/decorators/decidim/assemblies/update_assembly_decorator.rb +19 -0
- data/app/decorators/decidim/assemblies_decorator.rb +21 -0
- data/app/decorators/decidim/assemblies_with_user_role_decorator.rb +27 -0
- data/app/decorators/decidim/conference_form_decorator.rb +23 -0
- data/app/decorators/decidim/conferences/admin/conferences_controller_decorator.rb +27 -0
- data/app/decorators/decidim/conferences/create_conference_decorator.rb +51 -0
- data/app/decorators/decidim/conferences/permissions_decorator.rb +24 -0
- data/app/decorators/decidim/conferences/update_conference_decorator.rb +21 -0
- data/app/decorators/decidim/conferences_decorator.rb +27 -0
- data/app/decorators/decidim/conferences_with_user_role_decorator.rb +29 -0
- data/app/decorators/decidim/decidim_form_helper_decorator.rb +23 -0
- data/app/decorators/decidim/invite_user_decorator.rb +56 -0
- data/app/decorators/decidim/invite_user_form_decorator.rb +45 -0
- data/app/decorators/decidim/newsletter_decorator.rb +20 -0
- data/app/decorators/decidim/newsletters_helper_decorator.rb +44 -0
- data/app/decorators/decidim/participatory_process_decorator.rb +21 -0
- data/app/decorators/decidim/participatory_process_group_decorator.rb +17 -0
- data/app/decorators/decidim/participatory_processes/admin/participatory_processes_controller_decorator.rb +25 -0
- data/app/decorators/decidim/participatory_processes/create_participatory_process_decorator.rb +19 -0
- data/app/decorators/decidim/participatory_processes/permissions_decorator.rb +22 -0
- data/app/decorators/decidim/participatory_processes/update_participatory_process_decorator.rb +19 -0
- data/app/decorators/decidim/participatory_processes_with_user_role_decorator.rb +27 -0
- data/app/decorators/decidim/user_decorator.rb +59 -0
- data/app/decorators/lib/decidim/participatory_space_resourceable_decorator.rb +36 -0
- data/app/helpers/decidim/admin/user_roles_helper.rb +25 -0
- data/app/helpers/decidim/department_admin/application_helper.rb +54 -0
- data/app/models/decidim/participatory_space_role_config/department_admin.rb +8 -0
- data/app/overrides/decidim/admin/shared/add_radio_buttons_to_filters.rb +6 -0
- data/app/packs/entrypoints/decidim_department_admin.js +4 -0
- data/app/packs/entrypoints/decidim_department_admin.scss +1 -0
- data/app/packs/images/decidim/department_admin/icon.svg +1 -0
- data/app/packs/stylesheets/decidim/admin/department_admin.scss +5 -0
- data/app/permissions/decidim/assemblies/participatory_space_permissions.rb +14 -0
- data/app/permissions/decidim/conferences/participatory_space_permissions.rb +17 -0
- data/app/permissions/decidim/department_admin/permissions.rb +240 -0
- data/app/permissions/decidim/participatory_processes/participatory_space_permissions.rb +14 -0
- data/app/queries/decidim/admin/user_admin_by_space_name_filter.rb +67 -0
- data/app/queries/decidim/admin/user_admin_filter.rb +50 -0
- data/app/views/decidim/admin/users/_filters.html.erb +28 -0
- data/app/views/decidim/admin/users/_form.html.erb +30 -0
- data/app/views/decidim/admin/users/index.html.erb +93 -0
- data/app/views/decidim/admin/users/show.html.erb +99 -0
- data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +147 -0
- data/app/views/decidim/conferences/admin/conferences/_form.html.erb +127 -0
- data/app/views/decidim/conferences/admin/conferences/index.html.erb +85 -0
- data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +160 -0
- data/config/assets.rb +27 -0
- data/config/i18n-tasks.yml +148 -0
- data/config/initializers/user_roles.rb +4 -0
- data/config/locales/ca.yml +61 -0
- data/config/locales/cs.yml +46 -0
- data/config/locales/en.yml +61 -0
- data/config/locales/es.yml +61 -0
- data/db/migrate/20190328130102_create_department_admin_areas.rb +10 -0
- data/db/migrate/20210420143021_add_area_to_conferences.rb +7 -0
- data/lib/decidim/department_admin/admin.rb +10 -0
- data/lib/decidim/department_admin/admin_engine.rb +27 -0
- data/lib/decidim/department_admin/engine.rb +137 -0
- data/lib/decidim/department_admin/test/factories.rb +17 -0
- data/lib/decidim/department_admin/version.rb +11 -0
- data/lib/decidim/department_admin.rb +15 -0
- data/spec/commands/decidim/admin/deliver_newsletter_spec.rb +175 -0
- data/spec/commands/decidim/invite_user_spec.rb +42 -0
- data/spec/controllers/decidim/admin/users_controller_spec.rb +119 -0
- data/spec/factories.rb +4 -0
- data/spec/features/check_overrides_spec.rb +11 -0
- data/spec/i18n_spec.rb +29 -0
- data/spec/models/decidim/area_spec.rb +23 -0
- data/spec/permissions/decidim/department_admin/department_admin_permissions_spec.rb +120 -0
- data/spec/queries/parent_assemblies_for_select_spec.rb +52 -0
- data/spec/spec_helper.rb +47 -0
- data/spec/system/admin_explores_processes_spec.rb +53 -0
- data/spec/system/admin_invite_department_admin_spec.rb +118 -0
- data/spec/system/department_admin_manages_newsletters_spec.rb +237 -0
- data/spec/system/department_admin_should_be_able_to_access_admin_dashboard_spec.rb +75 -0
- data/spec/system/department_admin_should_be_able_to_manage_assemblies_spec.rb +99 -0
- data/spec/system/department_admin_should_be_able_to_manage_conferences_spec.rb +74 -0
- data/spec/system/department_admin_should_be_able_to_manage_processes_spec.rb +117 -0
- data/spec/system/department_admin_should_be_able_to_see_only_assemblies_from_her_area_spec.rb +46 -0
- data/spec/system/department_admin_should_be_able_to_see_only_newsletters_from_her_area_spec.rb +53 -0
- data/spec/system/department_admin_should_be_able_to_see_only_processes_from_her_area_spec.rb +50 -0
- metadata +229 -0
@@ -0,0 +1,99 @@
|
|
1
|
+
<% @user = Decidim::User.find_by_id(params[:id]) %>
|
2
|
+
<div class="process-title">
|
3
|
+
<div class="process-title-content">
|
4
|
+
<a target="_blank" href="/admin/users?role=space_admin"><%= t("models.user.fields.administrated_spaces", scope: "decidim.admin") %></a>
|
5
|
+
</div>
|
6
|
+
</div>
|
7
|
+
<div class="card">
|
8
|
+
<div class="card-divider">
|
9
|
+
<h2 class="card-title">
|
10
|
+
<%= @user.name + '(' + @user.email + ')' %>
|
11
|
+
</h2>
|
12
|
+
</div>
|
13
|
+
<div class="card-section">
|
14
|
+
<div class="table-scroll">
|
15
|
+
<table class="table-list">
|
16
|
+
<thead>
|
17
|
+
<tr>
|
18
|
+
<th class="table-list__actions">
|
19
|
+
<% if params[:sort_column] == 'title' && params[:sort_order] == 'asc' %>
|
20
|
+
<%= link_to(t("models.user.fields.title", scope: "decidim.admin") + '▲', :sort_column => 'title', :sort_order => 'desc') %>
|
21
|
+
<% elsif params[:sort_column] == 'title' && params[:sort_order] == 'desc' %>
|
22
|
+
<%= link_to(t("models.user.fields.title", scope: "decidim.admin") + '▼', :sort_column => '', :sort_order => '') %>
|
23
|
+
<% else %>
|
24
|
+
<%= link_to(t("models.user.fields.title", scope: "decidim.admin"), :sort_column => 'title', :sort_order => 'asc') %>
|
25
|
+
<% end %>
|
26
|
+
</th>
|
27
|
+
<th class="table-list__actions">
|
28
|
+
<% if params[:sort_column] == 'type' && params[:sort_order] == 'asc' %>
|
29
|
+
<%= link_to(t("models.user.fields.type", scope: "decidim.admin") + '▲', :sort_column => 'type', :sort_order => 'desc') %>
|
30
|
+
<% elsif params[:sort_column] == 'type' && params[:sort_order] == 'desc' %>
|
31
|
+
<%= link_to(t("models.user.fields.type", scope: "decidim.admin") + '▼', :sort_column => '', :sort_order => '') %>
|
32
|
+
<% else %>
|
33
|
+
<%= link_to(t("models.user.fields.type", scope: "decidim.admin"), :sort_column => 'type', :sort_order => 'asc') %>
|
34
|
+
<% end %>
|
35
|
+
</th>
|
36
|
+
<th class="table-list__actions">
|
37
|
+
<% if params[:sort_column] == 'area' && params[:sort_order] == 'asc' %>
|
38
|
+
<%= link_to(t("models.user.fields.department", scope: "decidim.admin") + '▲', :sort_column => 'area', :sort_order => 'desc') %>
|
39
|
+
<% elsif params[:sort_column] == 'area' && params[:sort_order] == 'desc' %>
|
40
|
+
<%= link_to(t("models.user.fields.department", scope: "decidim.admin") + '▼', :sort_column => '', :sort_order => '') %>
|
41
|
+
<% else %>
|
42
|
+
<%= link_to(t("models.user.fields.department", scope: "decidim.admin"), :sort_column => 'area', :sort_order => 'asc') %>
|
43
|
+
<% end %>
|
44
|
+
</th>
|
45
|
+
<th class="table-list__actions">
|
46
|
+
<% if params[:sort_column] == 'created_at' && params[:sort_order] == 'desc' %>
|
47
|
+
<%= link_to(t("models.user.fields.created_at", scope: "decidim.admin") + '▲', :sort_column => 'created_at', :sort_order => 'asc') %>
|
48
|
+
<% elsif params[:sort_column] == 'created_at' && params[:sort_order] == 'asc' %>
|
49
|
+
<%= link_to(t("models.user.fields.created_at", scope: "decidim.admin") + '▼', :sort_column => '', :sort_order => '') %>
|
50
|
+
<% else %>
|
51
|
+
<%= link_to(t("models.user.fields.created_at", scope: "decidim.admin"), :sort_column => 'created_at', :sort_order => 'desc') %>
|
52
|
+
<% end %>
|
53
|
+
</th>
|
54
|
+
<th class="table-list__actions">
|
55
|
+
<% if params[:sort_column] == 'private' && params[:sort_order] == 'desc' %>
|
56
|
+
<%= link_to(t("models.user.fields.private", scope: "decidim.admin") + '▲', :sort_column => 'private', :sort_order => 'asc') %>
|
57
|
+
<% elsif params[:sort_column] == 'private' && params[:sort_order] == 'asc' %>
|
58
|
+
<%= link_to(t("models.user.fields.private", scope: "decidim.admin") + '▼', :sort_column => '', :sort_order => '') %>
|
59
|
+
<% else %>
|
60
|
+
<%= link_to(t("models.user.fields.private", scope: "decidim.admin"), :sort_column => 'private', :sort_order => 'desc') %>
|
61
|
+
<% end %>
|
62
|
+
</th>
|
63
|
+
<th class="table-list__actions">
|
64
|
+
<% if params[:sort_column] == 'published' && params[:sort_order] == 'desc' %>
|
65
|
+
<%= link_to(t("models.user.fields.published", scope: "decidim.admin") + '▲', :sort_column => 'published', :sort_order => 'asc') %>
|
66
|
+
<% elsif params[:sort_column] == 'published' && params[:sort_order] == 'asc' %>
|
67
|
+
<%= link_to(t("models.user.fields.published", scope: "decidim.admin") + '▼', :sort_column => '', :sort_order => '') %>
|
68
|
+
<% else %>
|
69
|
+
<%= link_to(t("models.user.fields.published", scope: "decidim.admin"), :sort_column => 'published', :sort_order => 'desc') %>
|
70
|
+
<% end %>
|
71
|
+
</th>
|
72
|
+
</tr>
|
73
|
+
</thead>
|
74
|
+
<tbody>
|
75
|
+
<% @spaces.each do |space| %>
|
76
|
+
<tr>
|
77
|
+
<td><%= space["title"] %></td>
|
78
|
+
<td><%= space["type"] %></td>
|
79
|
+
<td><%= space["area"] %></td>
|
80
|
+
<td><%= l space["created_at"], format: :short %></td>
|
81
|
+
<td>
|
82
|
+
<% if space["private"] %>
|
83
|
+
<strong class="text-alert"><%= t("assemblies.index.private", scope: "decidim.admin") %></strong>
|
84
|
+
<% else %>
|
85
|
+
<strong class="text-success"><%= t("assemblies.index.public", scope: "decidim.admin") %></strong>
|
86
|
+
<% end %></td>
|
87
|
+
<td>
|
88
|
+
<% if space["published"] %>
|
89
|
+
<strong class="text-success"><%= t("assemblies.index.published", scope: "decidim.admin") %></strong>
|
90
|
+
<% else %>
|
91
|
+
<strong class="text-alert"><%= t("assemblies.index.not_published", scope: "decidim.admin") %></strong>
|
92
|
+
<% end %></td>
|
93
|
+
</tr>
|
94
|
+
<% end %>
|
95
|
+
</tbody>
|
96
|
+
</table>
|
97
|
+
</div>
|
98
|
+
</div>
|
99
|
+
</div>
|
@@ -0,0 +1,147 @@
|
|
1
|
+
<div class="card with-overflow" id="assemblies">
|
2
|
+
<div class="card-divider">
|
3
|
+
<h2 class="card-title">
|
4
|
+
<% parent_assembly.self_and_ancestors.each do |assembly| %>
|
5
|
+
<%= link_to translated_attribute(assembly.title), edit_assembly_path(assembly) %>
|
6
|
+
<span>></span>
|
7
|
+
<% end if parent_assembly %>
|
8
|
+
|
9
|
+
<%= t("assemblies", scope: "decidim.admin.titles") %>
|
10
|
+
|
11
|
+
<% if allowed_to? :create, :assembly %>
|
12
|
+
<%= link_to t("actions.new_assembly", scope: "decidim.admin"),
|
13
|
+
new_assembly_path(parent_id: parent_assembly&.id),
|
14
|
+
class: "button tiny button--title" %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<% if allowed_to? :import, :assembly %>
|
18
|
+
<%= link_to t("actions.import_assembly", scope: "decidim.admin"),
|
19
|
+
new_import_path,
|
20
|
+
class: "button tiny button--title" %>
|
21
|
+
<% end %>
|
22
|
+
</h2>
|
23
|
+
</div>
|
24
|
+
<%= admin_filter_selector %>
|
25
|
+
<div class="card-section">
|
26
|
+
<div class="table-scroll">
|
27
|
+
<table class="table-list">
|
28
|
+
<thead>
|
29
|
+
<tr>
|
30
|
+
<th>
|
31
|
+
<%= sort_link(query, :title, t("models.assembly.fields.title", scope: "decidim.admin")) %>
|
32
|
+
</th>
|
33
|
+
<th>
|
34
|
+
<%= sort_link(query, :area_name, t("models.assembly.fields.department", scope: "decidim.admin")) %>
|
35
|
+
</th>
|
36
|
+
<th>
|
37
|
+
<%= t("models.assembly.fields.department_role", scope: "decidim.admin") %>
|
38
|
+
</th>
|
39
|
+
<th>
|
40
|
+
<%= t("models.assembly.fields.assembly_role", scope: "decidim.admin") %>
|
41
|
+
</th>
|
42
|
+
<th>
|
43
|
+
<%= sort_link(query, :created_at, t("models.assembly.fields.created_at", scope: "decidim.admin"), default_order: :desc) %>
|
44
|
+
</th>
|
45
|
+
<th>
|
46
|
+
<%= sort_link(query, :private_space, t("models.assembly.fields.private", scope: "decidim.admin")) %>
|
47
|
+
</th>
|
48
|
+
<th class="table-list__actions">
|
49
|
+
<%= sort_link(query, :published_at, t("models.assembly.fields.published", scope: "decidim.admin")) %>
|
50
|
+
</th>
|
51
|
+
<th></th>
|
52
|
+
</tr>
|
53
|
+
</thead>
|
54
|
+
<tbody>
|
55
|
+
<% @assemblies.each do |assembly| %>
|
56
|
+
<% next unless allowed_to? :list, :assembly, assembly: assembly %>
|
57
|
+
<tr>
|
58
|
+
<td>
|
59
|
+
<% if assembly.promoted? %>
|
60
|
+
<span data-tooltip class="icon-state icon-highlight" aria-haspopup="true" data-disable-hover="false" title="<%= t("models.assembly.fields.promoted", scope: "decidim.admin") %>">
|
61
|
+
<%= icon "star", role: "img", "aria-hidden": true %>
|
62
|
+
</span>
|
63
|
+
<% end %>
|
64
|
+
<% if allowed_to? :update, :assembly, assembly: assembly %>
|
65
|
+
<%= link_to translated_attribute(assembly.title), edit_assembly_path(assembly) %><br>
|
66
|
+
<% elsif allowed_to? :read, :component, assembly: assembly %>
|
67
|
+
<%= link_to translated_attribute(assembly.title), components_path(assembly) %><br>
|
68
|
+
<% elsif allowed_to? :preview, :assembly, assembly: assembly %>
|
69
|
+
<%= link_to translated_attribute(assembly.title), decidim_assemblies.assembly_path(assembly) %><br>
|
70
|
+
<% elsif allowed_to? :read, :moderation, assembly: assembly %>
|
71
|
+
<%= link_to translated_attribute(assembly.title), moderations_path(assembly) %><br>
|
72
|
+
<% else %>
|
73
|
+
<%= translated_attribute(assembly.title) %>
|
74
|
+
<% end %>
|
75
|
+
</td>
|
76
|
+
<td>
|
77
|
+
<% if(assembly.area != nil) %>
|
78
|
+
<%= translated_attribute(assembly.area.name)%>
|
79
|
+
<% end %>
|
80
|
+
</td>
|
81
|
+
<td>
|
82
|
+
<% if(assembly.area != nil) %>
|
83
|
+
<%= assembly.area.users.map(&:name).join(", ") %>
|
84
|
+
<% end %>
|
85
|
+
</td>
|
86
|
+
<td>
|
87
|
+
<%= assembly.users_with_any_role.map(&:name).join(", ") %>
|
88
|
+
</td>
|
89
|
+
<td>
|
90
|
+
<%= l(assembly.created_at, format: :short) %>
|
91
|
+
</td>
|
92
|
+
<td class="table-list__state">
|
93
|
+
<% if assembly.private_space? %>
|
94
|
+
<strong class="text-alert"><%= t("assemblies.index.private", scope: "decidim.admin") %></strong>
|
95
|
+
<% else %>
|
96
|
+
<strong class="text-success"><%= t("assemblies.index.public", scope: "decidim.admin") %></strong>
|
97
|
+
<% end %>
|
98
|
+
</td>
|
99
|
+
<td class="table-list__state">
|
100
|
+
<% if assembly.published? %>
|
101
|
+
<strong class="text-success"><%= t("assemblies.index.published", scope: "decidim.admin") %></strong>
|
102
|
+
<% else %>
|
103
|
+
<strong class="text-alert"><%= t("assemblies.index.not_published", scope: "decidim.admin") %></strong>
|
104
|
+
<% end %>
|
105
|
+
</td>
|
106
|
+
<td class="table-list__actions">
|
107
|
+
<% if allowed_to? :export, :assembly, assembly: assembly %>
|
108
|
+
<%= icon_link_to "data-transfer-download", assembly_export_path(assembly), t("actions.export", scope: "decidim.admin"), method: :post, class: "action-icon--export" %>
|
109
|
+
<% else %>
|
110
|
+
<span class="action-space icon"></span>
|
111
|
+
<% end %>
|
112
|
+
|
113
|
+
<% if allowed_to? :copy, :assembly, assembly: assembly %>
|
114
|
+
<%= icon_link_to "clipboard", new_assembly_copy_path(assembly), t("actions.duplicate", scope: "decidim.admin"), class: "action-icon--copy" %>
|
115
|
+
<% else %>
|
116
|
+
<span class="action-space icon"></span>
|
117
|
+
<% end %>
|
118
|
+
|
119
|
+
<% if allowed_to? :update, :assembly, assembly: assembly %>
|
120
|
+
<%= icon_link_to "pencil", edit_assembly_path(assembly), t("actions.configure", scope: "decidim.admin"), class: "action-icon--new" %>
|
121
|
+
<% else %>
|
122
|
+
<span class="action-space icon"></span>
|
123
|
+
<% end %>
|
124
|
+
|
125
|
+
<% if assembly.children.count.positive? || allowed_to?(:create, :assembly) %>
|
126
|
+
<%= icon_link_to "dial",
|
127
|
+
url_for(query_params_with(parent_id_eq: assembly.id)),
|
128
|
+
t("decidim.admin.titles.assemblies"),
|
129
|
+
class: "action-icon--dial #{'highlighted' if assembly.children.count.positive?}" %>
|
130
|
+
<% else %>
|
131
|
+
<span class="action-space icon"></span>
|
132
|
+
<% end %>
|
133
|
+
|
134
|
+
<% if allowed_to? :preview, :assembly, assembly: assembly %>
|
135
|
+
<%= icon_link_to "eye", decidim_assemblies.assembly_path(assembly), t("actions.preview", scope: "decidim.admin"), class: "action-icon--preview" %>
|
136
|
+
<% else %>
|
137
|
+
<span class="action-space icon"></span>
|
138
|
+
<% end %>
|
139
|
+
</td>
|
140
|
+
</tr>
|
141
|
+
<% end %>
|
142
|
+
</tbody>
|
143
|
+
</table>
|
144
|
+
<%= paginate @assemblies, theme: "decidim" %>
|
145
|
+
</div>
|
146
|
+
</div>
|
147
|
+
</div>
|
@@ -0,0 +1,127 @@
|
|
1
|
+
<div class="card">
|
2
|
+
<div class="card-divider">
|
3
|
+
<h2 class="card-title"><%= t "conferences.form.title", scope: "decidim.admin" %></h2>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<div class="card-section">
|
7
|
+
<div class="row column">
|
8
|
+
<%= form.translated :text_field, :title, autofocus: true %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="row column">
|
12
|
+
<%= form.translated :text_field, :slogan %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="row">
|
16
|
+
<div class="columns xlarge-6 slug">
|
17
|
+
<%= form.text_field :slug %>
|
18
|
+
<p class="help-text"><%== t(".slug_help", url: decidim_form_slug_url(:conferences, form.object.slug)) %></p>
|
19
|
+
</div>
|
20
|
+
|
21
|
+
<div class="columns xlarge-6">
|
22
|
+
<%= form.text_field :hashtag %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
|
26
|
+
<div class="row column">
|
27
|
+
<%= form.check_box :promoted %>
|
28
|
+
</div>
|
29
|
+
|
30
|
+
<div class="row column">
|
31
|
+
<%= form.translated :editor, :short_description %>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div class="row column">
|
35
|
+
<%= form.translated :editor, :description %>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="row column">
|
39
|
+
<%= form.translated :editor, :objectives %>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<div class="row column">
|
43
|
+
<%= form.text_field :location %>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div class="row">
|
47
|
+
<div class="columns xlarge-6">
|
48
|
+
<%= form.upload :hero_image %>
|
49
|
+
</div>
|
50
|
+
|
51
|
+
<div class="columns xlarge-6">
|
52
|
+
<%= form.upload :banner_image %>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
<div class="row column">
|
57
|
+
<%= form.check_box :scopes_enabled %>
|
58
|
+
</div>
|
59
|
+
|
60
|
+
<div class="row column">
|
61
|
+
<%= scopes_picker_field form, :scope_id, root: nil %>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<div class="row column">
|
65
|
+
<%= form.areas_select :area_id,
|
66
|
+
areas_for_select(current_organization),
|
67
|
+
selected: current_participatory_space.try(:decidim_area_id),
|
68
|
+
include_blank: t(".select_an_area") %>
|
69
|
+
</div>
|
70
|
+
|
71
|
+
<div class="row column">
|
72
|
+
<%= form.check_box :show_statistics %>
|
73
|
+
</div>
|
74
|
+
|
75
|
+
<div class="row column">
|
76
|
+
<%= form.date_field :start_date %>
|
77
|
+
</div>
|
78
|
+
|
79
|
+
<div class="row column">
|
80
|
+
<%= form.date_field :end_date %>
|
81
|
+
</div>
|
82
|
+
|
83
|
+
<div class="row column">
|
84
|
+
<%= form.check_box :registrations_enabled %>
|
85
|
+
</div>
|
86
|
+
|
87
|
+
<div class="row column">
|
88
|
+
<p><%= t(".registrations_count", count: current_participatory_space.present? ? current_participatory_space.conference_registrations.count : 0) %></p>
|
89
|
+
<%= form.number_field :available_slots %>
|
90
|
+
<p class="help-text"><%= t(".available_slots_help") %></p>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
<div class="row column" id="conference_registrations_terms">
|
94
|
+
<%= form.translated :editor, :registration_terms, toolbar: :content %>
|
95
|
+
</div>
|
96
|
+
|
97
|
+
<div class="row column">
|
98
|
+
<% if @form.processes_for_select %>
|
99
|
+
<%= form.select :participatory_processes_ids,
|
100
|
+
options_for_select(@form.processes_for_select, selected: processes_selected ),
|
101
|
+
{ include_blank: true },
|
102
|
+
{ multiple: true, class: "chosen-select" } %>
|
103
|
+
<% end %>
|
104
|
+
</div>
|
105
|
+
|
106
|
+
<div class="row column">
|
107
|
+
<% if @form.assemblies_for_select %>
|
108
|
+
<%= form.select :assemblies_ids,
|
109
|
+
options_for_select(@form.assemblies_for_select, selected: assemblies_selected ),
|
110
|
+
{ include_blank: true },
|
111
|
+
{ multiple: true, class: "chosen-select" } %>
|
112
|
+
<% end %>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
<div class="row column">
|
116
|
+
<% if @form.consultations_for_select %>
|
117
|
+
<%= form.select :consultations_ids,
|
118
|
+
options_for_select(@form.consultations_for_select, selected: consultations_selected ),
|
119
|
+
{ include_blank: true },
|
120
|
+
{ multiple: true, class: "chosen-select" } %>
|
121
|
+
<% end %>
|
122
|
+
</div>
|
123
|
+
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
|
127
|
+
<%= javascript_pack_tag "decidim_conferences_admin" %>
|
@@ -0,0 +1,85 @@
|
|
1
|
+
<div class="card with-overflow" id="conferences">
|
2
|
+
<div class="card-divider">
|
3
|
+
<h2 class="card-title">
|
4
|
+
<%= t "decidim.admin.titles.conferences" %>
|
5
|
+
<%= link_to t("actions.new_conference", scope: "decidim.admin"), new_conference_path, class: "button tiny button--title" if allowed_to? :create, :conference %>
|
6
|
+
</h2>
|
7
|
+
</div>
|
8
|
+
<%= admin_filter_selector %>
|
9
|
+
<div class="card-section">
|
10
|
+
<div class="table-scroll">
|
11
|
+
<table class="table-list">
|
12
|
+
<thead>
|
13
|
+
<tr>
|
14
|
+
<th><%= t("models.conference.fields.title", scope: "decidim.admin") %></th>
|
15
|
+
<th><%= sort_link(query, :area_name, t("models.conference.fields.department", scope: "decidim.admin")) %></th>
|
16
|
+
<th><%= t("models.conference.fields.department_role", scope: "decidim.admin") %></th>
|
17
|
+
<th><%= t("models.conference.fields.conference_role", scope: "decidim.admin") %></th>
|
18
|
+
<th><%= sort_link(query, :created_at, t("models.conference.fields.created_at", scope: "decidim.admin"), default_order: :desc) %></th>
|
19
|
+
<th class="table-list__actions"><%= t("models.conference.fields.published", scope: "decidim.admin") %></th>
|
20
|
+
<th></th>
|
21
|
+
</tr>
|
22
|
+
</thead>
|
23
|
+
<tbody>
|
24
|
+
<% @conferences.each do |conference| %>
|
25
|
+
<tr>
|
26
|
+
<td>
|
27
|
+
<% if conference.promoted? %>
|
28
|
+
<span data-tooltip class="icon-state icon-highlight" aria-haspopup="true" data-disable-hover="false" title="<%= t("models.conference.fields.promoted", scope: "decidim.admin") %>">
|
29
|
+
<%= icon "star", aria_label: t("models.conference.fields.promoted", scope: "decidim.admin"), role: "img" %>
|
30
|
+
</span>
|
31
|
+
<% end %>
|
32
|
+
<% if allowed_to? :update, :conference, conference: conference %>
|
33
|
+
<%= link_to translated_attribute(conference.title), edit_conference_path(conference) %><br>
|
34
|
+
<% elsif allowed_to? :read, :component, conference: conference %>
|
35
|
+
<%= link_to translated_attribute(conference.title), components_path(conference) %><br>
|
36
|
+
<% elsif allowed_to? :preview, :conference, conference: conference %>
|
37
|
+
<%= link_to translated_attribute(conference.title), decidim_conferences.conference_path(conference) %><br>
|
38
|
+
<% elsif allowed_to? :read, :moderation, conference: conference %>
|
39
|
+
<%= link_to translated_attribute(conference.title), moderations_path(conference) %><br>
|
40
|
+
<% else %>
|
41
|
+
<%= translated_attribute(conference.title) %>
|
42
|
+
<% end %>
|
43
|
+
</td>
|
44
|
+
<td>
|
45
|
+
<% if(conference.area != nil) %>
|
46
|
+
<%= translated_attribute(conference.area.name) %>
|
47
|
+
<% end %>
|
48
|
+
</td>
|
49
|
+
<td>
|
50
|
+
<% if(conference.area != nil) %>
|
51
|
+
<%= conference.area.users.map(&:name).join(", ") %>
|
52
|
+
<% end %>
|
53
|
+
</td>
|
54
|
+
<td>
|
55
|
+
<%= conference.users_with_any_role.map(&:name).join(", ") %>
|
56
|
+
</td>
|
57
|
+
<td>
|
58
|
+
<%= l conference.created_at, format: :short %>
|
59
|
+
</td>
|
60
|
+
<td class="table-list__state">
|
61
|
+
<% if conference.published? %>
|
62
|
+
<strong class="text-success"><%= t("conferences.index.published", scope: "decidim.admin") %></strong>
|
63
|
+
<% else %>
|
64
|
+
<strong class="text-alert"><%= t("conferences.index.not_published", scope: "decidim.admin") %></strong>
|
65
|
+
<% end %>
|
66
|
+
</td>
|
67
|
+
<td class="table-list__actions">
|
68
|
+
<% if allowed_to? :create, :conference, conference: conference %>
|
69
|
+
<%= icon_link_to "clipboard", new_conference_copy_path(conference), t("actions.duplicate", scope: "decidim.admin"), class: "action-icon--copy" %>
|
70
|
+
<% end %>
|
71
|
+
<% if allowed_to? :update, :conference, conference: conference %>
|
72
|
+
<%= icon_link_to "pencil", edit_conference_path(conference), t("actions.configure", scope: "decidim.admin"), class: "action-icon--new" %>
|
73
|
+
<% end %>
|
74
|
+
<% if allowed_to? :preview, :conference, conference: conference %>
|
75
|
+
<%= icon_link_to "eye", decidim_conferences.conference_path(conference), t("actions.preview", scope: "decidim.admin"), class: "action-icon--preview" %>
|
76
|
+
<% end %>
|
77
|
+
</td>
|
78
|
+
</tr>
|
79
|
+
<% end %>
|
80
|
+
</tbody>
|
81
|
+
</table>
|
82
|
+
<%= paginate @conferences, theme: "decidim" %>
|
83
|
+
</div>
|
84
|
+
</div>
|
85
|
+
</div>
|
@@ -0,0 +1,160 @@
|
|
1
|
+
<% add_decidim_page_title(t("participatory_processes", scope: "decidim.admin.titles")) %>
|
2
|
+
|
3
|
+
<% content_for :sidebar_menu_nav do %>
|
4
|
+
<%= sidebar_menu(:admin_participatory_processes_menu).render %>
|
5
|
+
<% end %>
|
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 %>
|
23
|
+
|
24
|
+
<% if allowed_to? :import, :process %>
|
25
|
+
<%= link_to t("actions.import_process", scope: "decidim.admin"),
|
26
|
+
new_import_path,
|
27
|
+
class: "button tiny button--title" %>
|
28
|
+
<% end %>
|
29
|
+
|
30
|
+
<button data-toggle="process_groups" class="dropdown button tiny button--title">
|
31
|
+
<%= t("actions.filter.process_groups", scope: "decidim.admin") %>
|
32
|
+
</button>
|
33
|
+
<div id="process_groups" class="dropdown-pane" data-position="bottom" data-dropdown data-auto-focus="true">
|
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>
|
41
|
+
<% 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
|
+
|
135
|
+
<% if allowed_to? :create, :process, process: process %>
|
136
|
+
<%= icon_link_to "clipboard", new_participatory_process_copy_path(process), t("actions.duplicate", scope: "decidim.admin"), class: "action-icon--copy" %>
|
137
|
+
<% else %>
|
138
|
+
<span class="action-space icon"></span>
|
139
|
+
<% end %>
|
140
|
+
|
141
|
+
<% if allowed_to? :update, :process, process: process %>
|
142
|
+
<%= icon_link_to "pencil", edit_participatory_process_path(process), t("actions.configure", scope: "decidim.admin"), class: "action-icon--new" %>
|
143
|
+
<% else %>
|
144
|
+
<span class="action-space icon"></span>
|
145
|
+
<% end %>
|
146
|
+
|
147
|
+
<% if allowed_to? :preview, :process, process: process %>
|
148
|
+
<%= icon_link_to "eye", decidim_participatory_processes.participatory_process_path(process), t("actions.preview", scope: "decidim.admin"), class: "action-icon--preview" %>
|
149
|
+
<% else %>
|
150
|
+
<span class="action-space icon"></span>
|
151
|
+
<% end %>
|
152
|
+
</td>
|
153
|
+
</tr>
|
154
|
+
<% end %>
|
155
|
+
</tbody>
|
156
|
+
</table>
|
157
|
+
<%= paginate @participatory_processes, theme: "decidim" %>
|
158
|
+
</div>
|
159
|
+
</div>
|
160
|
+
</div>
|
data/config/assets.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# This file is located at `config/assets.rb` of your module.
|
4
|
+
|
5
|
+
base_path = File.expand_path("..", __dir__)
|
6
|
+
|
7
|
+
# Register the additonal path for Webpacker in order to make the module's
|
8
|
+
# stylesheets available for inclusion.
|
9
|
+
Decidim::Webpacker.register_path("#{base_path}/app/packs")
|
10
|
+
|
11
|
+
# Register the main application's stylesheet include statement:
|
12
|
+
# Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/your_component/your_component")
|
13
|
+
|
14
|
+
# Register the admin panel's stylesheet include statement:
|
15
|
+
# Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/your_component/your_component_admin", group: :admin)
|
16
|
+
|
17
|
+
# Register the entrypoints for your module. These entrypoints can be included
|
18
|
+
# within your application using `javascript_pack_tag` and if you include any
|
19
|
+
# SCSS files within the entrypoints, they become available for inclusion using
|
20
|
+
# `stylesheet_pack_tag`.
|
21
|
+
Decidim::Webpacker.register_entrypoints(
|
22
|
+
decidim_department_admin: "#{base_path}/app/packs/entrypoints/decidim_department_admin.js"
|
23
|
+
)
|
24
|
+
|
25
|
+
# If you want to do the same but include the SCSS file for the admin panel's
|
26
|
+
# main SCSS file, you can use the following method.
|
27
|
+
Decidim::Webpacker.register_stylesheet_import("stylesheets/decidim/admin/department_admin", group: :admin)
|