decidim-admin 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim-admin might be problematic. Click here for more details.

Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/app/assets/javascripts/decidim/admin/application.js.es6 +0 -1
  4. data/app/assets/stylesheets/decidim/admin/_foundation_and_overrides.scss +1 -0
  5. data/app/assets/stylesheets/decidim/admin/_icons.scss +9 -0
  6. data/app/assets/stylesheets/decidim/admin/application.scss +1 -0
  7. data/app/commands/decidim/admin/create_feature.rb +3 -1
  8. data/app/commands/decidim/admin/create_participatory_process.rb +26 -14
  9. data/app/commands/decidim/admin/destroy_feature.rb +5 -0
  10. data/app/commands/decidim/admin/destroy_participatory_process_step.rb +29 -0
  11. data/app/commands/decidim/admin/update_feature.rb +47 -0
  12. data/app/commands/decidim/admin/update_organization.rb +3 -1
  13. data/app/controllers/decidim/admin/features_controller.rb +37 -2
  14. data/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb +0 -16
  15. data/app/controllers/decidim/admin/participatory_process_steps_controller.rb +10 -3
  16. data/app/controllers/decidim/admin/static_pages_controller.rb +4 -4
  17. data/app/controllers/decidim/admin/user_groups_controller.rb +32 -0
  18. data/app/controllers/decidim/admin/users_controller.rb +87 -0
  19. data/app/forms/decidim/admin/category_form.rb +1 -7
  20. data/app/forms/decidim/admin/feature_form.rb +26 -0
  21. data/app/forms/decidim/admin/organization_form.rb +2 -0
  22. data/app/forms/decidim/admin/participatory_process_step_form.rb +1 -1
  23. data/app/forms/decidim/admin/static_page_form.rb +2 -3
  24. data/app/models/decidim/admin/abilities/admin_user.rb +6 -0
  25. data/app/views/decidim/admin/features/_feature.html.erb +4 -1
  26. data/app/views/decidim/admin/features/_form.html.erb +49 -0
  27. data/app/views/decidim/admin/features/_settings_fields.html.erb +5 -0
  28. data/app/views/decidim/admin/features/edit.html.erb +9 -0
  29. data/app/views/decidim/admin/features/index.html.erb +6 -0
  30. data/app/views/decidim/admin/features/new.html.erb +1 -1
  31. data/app/views/decidim/admin/organization/_form.html.erb +8 -0
  32. data/app/views/decidim/admin/participatory_process_attachments/_form.html.erb +1 -1
  33. data/app/views/decidim/admin/participatory_process_steps/index.html.erb +2 -6
  34. data/app/views/decidim/admin/user_groups/index.html.erb +32 -0
  35. data/app/views/decidim/admin/users/_form.html.erb +6 -0
  36. data/app/views/decidim/admin/users/index.html.erb +54 -0
  37. data/app/views/decidim/admin/users/new.html.erb +11 -0
  38. data/app/views/layouts/decidim/admin/_sidebar.html.erb +2 -0
  39. data/app/views/layouts/decidim/admin/participatory_process.html.erb +1 -1
  40. data/config/i18n-tasks.yml +1 -0
  41. data/config/locales/ca.yml +103 -5
  42. data/config/locales/en.yml +57 -4
  43. data/config/locales/es.yml +103 -5
  44. data/config/routes.rb +11 -0
  45. data/lib/decidim/admin/features/base_controller.rb +7 -3
  46. data/lib/decidim/admin/test/factories.rb +8 -0
  47. metadata +23 -25
@@ -0,0 +1,5 @@
1
+ <% form.object.manifest.attributes.each do |name, attribute| %>
2
+ <% if attribute.type == :boolean %>
3
+ <%= form.check_box name, label: t("decidim.features.#{feature.manifest.name}.settings.#{settings_name}.#{name}") %>
4
+ <% end %>
5
+ <% end %>
@@ -0,0 +1,9 @@
1
+ <h3><%= t ".title", name: t("#{@feature.manifest.name}.name", scope: "decidim.features") %></h3>
2
+
3
+ <%= form_for([participatory_process, @form], url: participatory_process_feature_path(participatory_process, @feature), method: "put") do |form| %>
4
+ <%= render partial: 'form', object: form, locals: { feature: @feature } %>
5
+
6
+ <div class="actions">
7
+ <%= form.submit t(".update") %>
8
+ </div>
9
+ <% end %>
@@ -16,6 +16,12 @@
16
16
  </div>
17
17
 
18
18
  <table>
19
+ <thead>
20
+ <th><%= t(".headers.name") %></th>
21
+ <th><%= t(".headers.type") %></th>
22
+ <th><%= t(".headers.actions") %></th>
23
+ </thead>
24
+
19
25
  <tbody>
20
26
  <%= render partial: "feature", collection: @features %>
21
27
  </tbody>
@@ -1,7 +1,7 @@
1
1
  <h3><%= t ".title", name: t("#{manifest.name}.name", scope: "decidim.features") %></h3>
2
2
 
3
3
  <%= form_for([participatory_process, @form], url: participatory_process_features_path(type: params[:type]), method: "post") do |form| %>
4
- <%= render partial: 'form', object: form %>
4
+ <%= render partial: 'form', object: form, locals: { feature: @feature } %>
5
5
 
6
6
  <div class="actions">
7
7
  <%= form.submit t(".add") %>
@@ -2,6 +2,10 @@
2
2
  <%= form.text_field :name %>
3
3
  </div>
4
4
 
5
+ <div class="field">
6
+ <%= form.text_field :twitter_handler %>
7
+ </div>
8
+
5
9
  <div class="field">
6
10
  <%= form.translated :editor, :description %>
7
11
  </div>
@@ -21,3 +25,7 @@
21
25
  <div class="field">
22
26
  <%= form.file_field :logo %>
23
27
  </div>
28
+
29
+ <div class="field">
30
+ <%= form.check_box :show_statistics %>
31
+ </div>
@@ -3,7 +3,7 @@
3
3
  </div>
4
4
 
5
5
  <div class="field">
6
- <%= form.translated :editor, :description, toolbar: :full, lines: 20 %>
6
+ <%= form.translated :text_field, :description %>
7
7
  </div>
8
8
 
9
9
  <div class="field">
@@ -40,12 +40,8 @@
40
40
  </td>
41
41
  <td class="actions">
42
42
  <%= link_to t("actions.edit", scope: "decidim.admin"), edit_participatory_process_step_path(participatory_process, step) if can? :update, step %>
43
- <% if can? :activate, step %>
44
- <% if step.active? %>
45
- <%= link_to t("actions.deactivate", scope: "decidim.admin"), participatory_process_step_activate_path(participatory_process, step), method: :delete, class: "small button secondary" %>
46
- <% else %>
47
- <%= link_to t("actions.activate", scope: "decidim.admin"), participatory_process_step_activate_path(participatory_process, step), method: :post, class: "small button secondary" %>
48
- <% end %>
43
+ <% if can?(:activate, step) && !step.active? %>
44
+ <%= link_to t("actions.activate", scope: "decidim.admin"), participatory_process_step_activate_path(participatory_process, step), method: :post, class: "small button secondary" %>
49
45
  <% end %>
50
46
  <%= link_to t("actions.destroy", scope: "decidim.admin"), participatory_process_step_path(participatory_process, step), method: :delete, class: "small alert button", data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } if can? :destroy, step %>
51
47
  </td>
@@ -0,0 +1,32 @@
1
+ <% content_for :title do %>
2
+ <h2><%= t "decidim.admin.titles.user_groups" %></h2>
3
+ <% end %>
4
+
5
+ <table class="stack user-groups">
6
+ <thead>
7
+ <tr>
8
+ <th><%= t("models.user_group.fields.name", scope: "decidim.admin") %></th>
9
+ <th><%= t("models.user_group.fields.document_number", scope: "decidim.admin") %></th>
10
+ <th><%= t("models.user_group.fields.phone", scope: "decidim.admin") %></th>
11
+ <th><%= t("models.user_group.fields.users_count", scope: "decidim.admin") %></th>
12
+ <th><%= t("models.user_group.fields.created_at", scope: "decidim.admin") %></th>
13
+ <th class="actions"><%= t("actions.title", scope: "decidim.admin") %></th>
14
+ </tr>
15
+ </thead>
16
+ <tbody>
17
+ <% @user_groups.each do |user_group| %>
18
+ <tr data-user-group-id="<%= user_group.id %>">
19
+ <td><%= user_group.name %></td>
20
+ <td><%= user_group.document_number %></td>
21
+ <td><%= user_group.phone %></td>
22
+ <td><%= user_group.users.size %></td>
23
+ <td><%= l user_group.created_at, format: :short %></td>
24
+ <td class="actions">
25
+ <% if can?(:verify, user_group) && !user_group.verified? %>
26
+ <%= button_to t("actions.verify", scope: "decidim.admin"), decidim_admin.verify_user_group_path(user_group), method: :put %>
27
+ <% end %>
28
+ </td>
29
+ </tr>
30
+ <% end %>
31
+ </tbody>
32
+ </table>
@@ -0,0 +1,6 @@
1
+ <div class="field">
2
+ <%= form.text_field :name %>
3
+ </div>
4
+ <div class="field">
5
+ <%= form.email_field :email %>
6
+ </div>
@@ -0,0 +1,54 @@
1
+ <% content_for :title do %>
2
+ <h2><%= t "decidim.admin.titles.users" %></h2>
3
+ <% end %>
4
+
5
+ <div class="actions title">
6
+ <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.user.name", scope: "decidim.admin")), ['new', 'user'], class: 'new' %>
7
+ </div>
8
+
9
+ <table class="stack">
10
+ <thead>
11
+ <tr>
12
+ <th><%= t("models.user.fields.name", scope: "decidim.admin") %></th>
13
+ <th><%= t("models.user.fields.email", scope: "decidim.admin") %></th>
14
+ <th><%= t("models.user.fields.invitation_sent_at", scope: "decidim.admin") %></th>
15
+ <th><%= t("models.user.fields.invitation_accepted_at", scope: "decidim.admin") %></th>
16
+ <th><%= t("models.user.fields.last_sign_in_at", scope: "decidim.admin") %></th>
17
+ <th><%= t("models.user.fields.created_at", scope: "decidim.admin") %></th>
18
+ <th class="actions"><%= t("actions.title", scope: "decidim.admin") %></th>
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ <% @users.each do |user| %>
23
+ <tr data-user-id="<%= user.id %>">
24
+ <td><%= user.name %></td>
25
+ <td><%= user.email %></td>
26
+ <td>
27
+ <% if user.invitation_sent_at %>
28
+ <%= l user.invitation_sent_at, format: :short %>
29
+ <% end %>
30
+ </td>
31
+ <td>
32
+ <% if user.invitation_accepted_at %>
33
+ <%= l user.invitation_accepted_at, format: :short %>
34
+ <% end %>
35
+ </td>
36
+ <td>
37
+ <% if user.last_sign_in_at %>
38
+ <%= l user.last_sign_in_at, format: :short %>
39
+ <% end %>
40
+ </td>
41
+ <td><%= l user.created_at, format: :short %></td>
42
+ <td class="actions">
43
+ <% if can?(:invite, user) && user.invited_to_sign_up? %>
44
+ <%= link_to t("actions.resend_invitation", scope: "decidim.admin"), ['resend_invitation', user], method: :post %>
45
+ <% end %>
46
+
47
+ <% if can? :destroy, user %>
48
+ <%= link_to t("actions.destroy", scope: "decidim.admin"), user, method: :delete, class: "small alert button", data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
49
+ <% end %>
50
+ </td>
51
+ </tr>
52
+ <% end %>
53
+ </tbody>
54
+ </table>
@@ -0,0 +1,11 @@
1
+ <% content_for :title do %>
2
+ <h2><%= t ".title" %></h2>
3
+ <% end %>
4
+
5
+ <%= form_for(@form) do |f| %>
6
+ <%= render partial: 'form', object: f %>
7
+
8
+ <div class="actions">
9
+ <%= f.submit t(".create") %>
10
+ </div>
11
+ <% end %>
@@ -11,6 +11,8 @@
11
11
  <%= active_link_to t("menu.participatory_processes", scope: "decidim.admin"), decidim_admin.participatory_processes_path, active: :inclusive %>
12
12
  <%= active_link_to t("menu.static_pages", scope: "decidim.admin"), decidim_admin.static_pages_path, active: :inclusive if can? :read, Decidim::StaticPage %>
13
13
  <%= active_link_to t("menu.scopes", scope: "decidim.admin"), decidim_admin.scopes_path, active: :inclusive if can? :read, Decidim::Scope %>
14
+ <%= active_link_to t("menu.users", scope: "decidim.admin"), decidim_admin.users_path, active: :inclusive if can? :read, Decidim::User %>
15
+ <%= active_link_to t("menu.user_groups", scope: "decidim.admin"), decidim_admin.user_groups_path, active: :inclusive if can? :index, Decidim::UserGroup %>
14
16
  <%= active_link_to t("menu.settings", scope: "decidim.admin"), decidim_admin.edit_organization_path, active: :inclusive if can? :read, current_organization %>
15
17
  </nav>
16
18
 
@@ -45,7 +45,7 @@
45
45
  </div>
46
46
  <div class="medium-9 columns">
47
47
  <div class="tabs-content vertical">
48
- <div class="tabs-panel is-active">
48
+ <div class="tabs-panel" aria-hidden="false">
49
49
  <%= yield %>
50
50
  </div>
51
51
  </div>
@@ -91,6 +91,7 @@ search:
91
91
  ignore_unused:
92
92
  - activerecord.attributes.*
93
93
  - activemodel.attributes.*
94
+ - decidim.admin.participatory_process_steps.default_title
94
95
  # - '{devise,kaminari,will_paginate}.*'
95
96
  # - 'simple_form.{yes,no}'
96
97
  # - 'simple_form.{placeholders,hints,labels}.*'
@@ -1,4 +1,50 @@
1
1
  ca:
2
+ activemodel:
3
+ attributes:
4
+ category:
5
+ description: Descripció
6
+ name: Nom
7
+ parent: Pare
8
+ feature:
9
+ name: Nom
10
+ organization:
11
+ default_locale: Idioma per defecte
12
+ description: Descripció
13
+ homepage_image: Imatge de la portada
14
+ logo: Logotip
15
+ name: Nom
16
+ show_statistics: Mostra Estadístiques
17
+ welcome_text: Text de benvinguda
18
+ participatory_process:
19
+ banner_image: Imatge de bandera
20
+ description: Descripció
21
+ hashtag: Etiqueta
22
+ hero_image: Imatge de portada
23
+ promoted: Promogut
24
+ short_description: Descripció breu
25
+ slug: Nom curt d'URL
26
+ subtitle: Subtítol
27
+ title: Títol
28
+ participatory_process_attachment:
29
+ description: Descripció
30
+ file: Arxiu
31
+ title: Títol
32
+ participatory_process_step:
33
+ description: Descripció
34
+ end_date: Data de finalització
35
+ short_description: Descripció breu
36
+ start_date: Data d'inici
37
+ title: Títol
38
+ participatory_process_user_role:
39
+ email: Correu electrònic
40
+ scope:
41
+ name: Nom
42
+ organization: Organització
43
+ static_page:
44
+ content: Contingut
45
+ organization: Organització
46
+ slug: Nom curt d'URL
47
+ title: Títol
2
48
  activerecord:
3
49
  attributes:
4
50
  decidim/participatory_process:
@@ -10,14 +56,16 @@ ca:
10
56
  configure: Configurar
11
57
  confirm_destroy: Segur que ho vols eliminar?
12
58
  create: Crear
13
- deactivate: Desactivar
14
59
  destroy: Eliminar
15
60
  edit: Editar
61
+ manage: Gestionar
16
62
  new: Nou %{name}
17
63
  preview: Previsualitzar
18
64
  publish: Publicar
65
+ resend_invitation: Tornar a enviar invitació
19
66
  title: Accions
20
67
  unpublish: Despublicar
68
+ verify: Verificar
21
69
  categories:
22
70
  create:
23
71
  error: S'ha produït un error en crear aquesta categoria.
@@ -56,12 +104,25 @@ ca:
56
104
  destroy:
57
105
  error: S'ha produït un error destruir aquesta funcionalitat.
58
106
  success: Característica eliminada correctament.
107
+ edit:
108
+ title: Editar funcionalitat
109
+ update: Actualitza
110
+ form:
111
+ global_settings: Configuració global
112
+ step_settings: Configuració de fase
59
113
  index:
60
114
  add: Afegir funcionalitat
115
+ headers:
116
+ actions: Accions
117
+ name: Nom de la funcionalitat
118
+ type: Tipus de funcionalitat
61
119
  new:
62
120
  add: Afegir funcionalitat
63
121
  title: 'Afegir funcionalitat: %{name}'
64
122
  title: Funcionalitats
123
+ update:
124
+ error: S'ha produït un error en actualitzar aquesta funcionalitat.
125
+ success: La funcionalitat s'ha actualitzat correctament.
65
126
  menu:
66
127
  dashboard: Tauler de control
67
128
  participatory_processes: Processos participatius
@@ -76,6 +137,8 @@ ca:
76
137
  scopes: Àmbits
77
138
  settings: Configuració
78
139
  static_pages: Pàgines
140
+ user_groups: Grups d'usuaris
141
+ users: Administradors
79
142
  models:
80
143
  category:
81
144
  fields:
@@ -113,6 +176,22 @@ ca:
113
176
  created_at: Data de creació
114
177
  title: Títol
115
178
  name: Pàgina
179
+ user:
180
+ fields:
181
+ created_at: Data de creació
182
+ email: Correu electrònic
183
+ invitation_accepted_at: Data d'acceptació de la invitació
184
+ invitation_sent_at: Data d'enviament de la invitació
185
+ last_sign_in_at: Darrera data d'identificació
186
+ name: Nom
187
+ name: Usuari
188
+ user_group:
189
+ fields:
190
+ created_at: Data de creació
191
+ document_number: Número de document
192
+ name: Nom
193
+ phone: Telèfon
194
+ users_count: Número d'usuaris
116
195
  organization:
117
196
  edit:
118
197
  title: Edita organització
@@ -146,14 +225,15 @@ ca:
146
225
  create:
147
226
  error: S'ha produït un error en activar aquesta fase de procés participatiu.
148
227
  success: La fase de procés participatiu s'ha activat correctament.
149
- destroy:
150
- error: S'ha produït un error en desactivar aquesta fase de procés participatiu.
151
- success: La fase de procés participatiu s'ha desactivat correctament.
152
228
  participatory_process_steps:
153
229
  create:
154
230
  error: S'ha produït un error en crear una nova fase de procés participatiu.
155
231
  success: La fase de procés participatiu s'ha creat correctament.
232
+ default_title: Introducció
156
233
  destroy:
234
+ error:
235
+ active_step: No es pot eliminar la fase activa.
236
+ last_step: No es pot eliminar l'última fase d'un procés.
157
237
  success: La fase de procés participatiu s'ha eliminat correctament.
158
238
  edit:
159
239
  title: Editar fase de procés participatiu
@@ -222,4 +302,22 @@ ca:
222
302
  dashboard: Tauler de control
223
303
  participatory_processes: Processos participatius
224
304
  scopes: Àmbits
225
- static_pages: Pàgines
305
+ static_pages: Pàgines
306
+ user_groups: Grups d'usuaris
307
+ users: Usuaris
308
+ user_groups:
309
+ verify:
310
+ success: El grup d'usuaris ha estat verificat exitosament.
311
+ users:
312
+ create:
313
+ error: Hi ha hagut un error en convidar a aquest usuari.
314
+ success: Usuari convidat amb èxit.
315
+ destroy:
316
+ error: S'ha produït un error en intentar eliminar aquest usuari.
317
+ success: L'usuari ja no és un administrador.
318
+ new:
319
+ create: Convidar
320
+ title: Convidar un usuari com a administrador
321
+ resend_invitation:
322
+ error: S'ha produït un error en intentar enviar el missatge d'invitació.
323
+ success: Invitació enviada correctament.
@@ -14,6 +14,7 @@ en:
14
14
  homepage_image: Homepage image
15
15
  logo: Logo
16
16
  name: Name
17
+ show_statistics: Show statistics
17
18
  welcome_text: Welcome text
18
19
  participatory_process:
19
20
  banner_image: Banner image
@@ -56,14 +57,16 @@ en:
56
57
  configure: Configure
57
58
  confirm_destroy: Are you sure you want to delete this?
58
59
  create: Create
59
- deactivate: Deactivate
60
60
  destroy: Destroy
61
61
  edit: Edit
62
+ manage: Manage
62
63
  new: New %{name}
63
64
  preview: Preview
64
65
  publish: Publish
66
+ resend_invitation: Resend invitation
65
67
  title: Actions
66
68
  unpublish: Unpublish
69
+ verify: Verify
67
70
  categories:
68
71
  create:
69
72
  error: There was an error creating this category.
@@ -102,12 +105,25 @@ en:
102
105
  destroy:
103
106
  error: There has been an error destroying this feature.
104
107
  success: Feature deleted successfully.
108
+ edit:
109
+ title: Edit feature
110
+ update: Update
111
+ form:
112
+ global_settings: Global settings
113
+ step_settings: Step settings
105
114
  index:
106
115
  add: Add feature
116
+ headers:
117
+ actions: Actions
118
+ name: Feature name
119
+ type: Feature type
107
120
  new:
108
121
  add: Add feature
109
122
  title: 'Add feature: %{name}'
110
123
  title: Features
124
+ update:
125
+ error: There has been an error updating this feature.
126
+ success: The feature was updated successfully.
111
127
  menu:
112
128
  dashboard: Dashboard
113
129
  participatory_processes: Participatory processes
@@ -122,6 +138,8 @@ en:
122
138
  scopes: Scopes
123
139
  settings: Settings
124
140
  static_pages: Pages
141
+ user_groups: User groups
142
+ users: Admin users
125
143
  models:
126
144
  category:
127
145
  fields:
@@ -159,6 +177,22 @@ en:
159
177
  created_at: Created at
160
178
  title: Title
161
179
  name: Page
180
+ user:
181
+ fields:
182
+ created_at: Creation date
183
+ email: Email
184
+ invitation_accepted_at: Invitation accepted date
185
+ invitation_sent_at: Invitation sent date
186
+ last_sign_in_at: Last sign in date
187
+ name: Name
188
+ name: User
189
+ user_group:
190
+ fields:
191
+ created_at: Created at
192
+ document_number: Document number
193
+ name: Name
194
+ phone: Phone
195
+ users_count: Users count
162
196
  organization:
163
197
  edit:
164
198
  title: Edit organization
@@ -192,14 +226,15 @@ en:
192
226
  create:
193
227
  error: There was an error activating this participatory process step.
194
228
  success: Participatory process step activated successfully.
195
- destroy:
196
- error: There was an error deactivating this participatory process step.
197
- success: Participatory process step deactivated successfully.
198
229
  participatory_process_steps:
199
230
  create:
200
231
  error: There was an error creating a new participatory process step.
201
232
  success: Participatory process step created successfully.
233
+ default_title: Introduction
202
234
  destroy:
235
+ error:
236
+ active_step: Can't delete the active step.
237
+ last_step: Can't delete the last step of a process.
203
238
  success: Participatory process step destroyed successfully.
204
239
  edit:
205
240
  title: Edit participatory process step
@@ -269,3 +304,21 @@ en:
269
304
  participatory_processes: Participatory processes
270
305
  scopes: Scopes
271
306
  static_pages: Pages
307
+ user_groups: User groups
308
+ users: Users
309
+ user_groups:
310
+ verify:
311
+ success: The user group was verified successfully.
312
+ users:
313
+ create:
314
+ error: There was an error when inviting this user.
315
+ success: User invited successfully.
316
+ destroy:
317
+ error: There was an error when trying to delete this user.
318
+ success: User is no longer an administrator.
319
+ new:
320
+ create: Invite
321
+ title: Invite user as administrator
322
+ resend_invitation:
323
+ error: There was an error when trying to send the invitation email.
324
+ success: Invitation email sent successfully.