decidim-admin 0.0.2 → 0.0.3

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 (50) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/decidim/admin/application.js.es6 +3 -2
  3. data/app/assets/javascripts/decidim/admin/tab_focus.js.es6 +1 -1
  4. data/app/assets/stylesheets/decidim/admin/_foundation_and_overrides.scss +1 -1
  5. data/app/commands/decidim/admin/{create_participatory_process_attachment.rb → create_attachment.rb} +6 -7
  6. data/app/commands/decidim/admin/create_participatory_process.rb +12 -3
  7. data/app/commands/decidim/admin/{update_participatory_process_attachment.rb → update_attachment.rb} +7 -6
  8. data/app/commands/decidim/admin/update_feature.rb +2 -1
  9. data/app/commands/decidim/admin/update_organization.rb +1 -0
  10. data/app/commands/decidim/admin/update_participatory_process.rb +16 -4
  11. data/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
  12. data/app/controllers/decidim/admin/application_controller.rb +2 -2
  13. data/app/controllers/decidim/admin/concerns/has_attachments.rb +116 -0
  14. data/app/controllers/decidim/admin/participatory_process_attachments_controller.rb +5 -67
  15. data/app/controllers/decidim/admin/users_controller.rb +5 -5
  16. data/app/forms/decidim/admin/{participatory_process_attachment_form.rb → attachment_form.rb} +2 -2
  17. data/app/forms/decidim/admin/feature_form.rb +1 -0
  18. data/app/forms/decidim/admin/organization_form.rb +1 -0
  19. data/app/forms/decidim/admin/participatory_process_form.rb +8 -1
  20. data/app/helpers/decidim/admin/application_helper.rb +1 -0
  21. data/app/helpers/decidim/admin/feature_settings_helper.rb +29 -0
  22. data/app/models/decidim/admin/abilities/admin_user.rb +4 -4
  23. data/app/models/decidim/admin/abilities/base.rb +3 -3
  24. data/app/models/decidim/admin/abilities/participatory_process_admin.rb +15 -7
  25. data/app/views/decidim/admin/{participatory_process_attachments → attachments}/_form.html.erb +0 -0
  26. data/app/views/decidim/admin/attachments/edit.html.erb +9 -0
  27. data/app/views/decidim/admin/attachments/index.html.erb +37 -0
  28. data/app/views/decidim/admin/attachments/new.html.erb +9 -0
  29. data/app/views/decidim/admin/attachments/show.html.erb +25 -0
  30. data/app/views/decidim/admin/features/_form.html.erb +1 -0
  31. data/app/views/decidim/admin/features/_settings_fields.html.erb +6 -3
  32. data/app/views/decidim/admin/organization/_form.html.erb +4 -0
  33. data/app/views/decidim/admin/participatory_processes/_form.html.erb +16 -0
  34. data/app/views/decidim/admin/participatory_processes/show.html.erb +11 -1
  35. data/app/views/layouts/decidim/admin/_header.html.erb +2 -2
  36. data/app/views/layouts/decidim/admin/_sidebar.html.erb +1 -1
  37. data/app/views/layouts/decidim/admin/participatory_process.html.erb +2 -2
  38. data/config/locales/ca.yml +29 -27
  39. data/config/locales/en.yml +29 -27
  40. data/config/locales/es.yml +29 -27
  41. data/config/routes.rb +1 -1
  42. data/db/migrate/20170128112958_change_user_groups_verified_to_timestamp.rb +9 -0
  43. data/lib/decidim/admin/engine.rb +2 -2
  44. data/lib/decidim/admin/test/manage_attachments_examples.rb +103 -0
  45. metadata +18 -35
  46. data/app/helpers/decidim/admin/aria_selected_link_to_helper.rb +0 -28
  47. data/app/views/decidim/admin/participatory_process_attachments/edit.html.erb +0 -9
  48. data/app/views/decidim/admin/participatory_process_attachments/index.html.erb +0 -37
  49. data/app/views/decidim/admin/participatory_process_attachments/new.html.erb +0 -9
  50. data/app/views/decidim/admin/participatory_process_attachments/show.html.erb +0 -25
@@ -0,0 +1,9 @@
1
+ <h3><%= t ".title" %></h3>
2
+
3
+ <%= form_for(@form, url: url_for([@attachment.attached_to, @attachment])) do |f| %>
4
+ <%= render partial: 'decidim/admin/attachments/form', object: f %>
5
+
6
+ <div class="actions">
7
+ <%= f.submit t(".update") %>
8
+ </div>
9
+ <% end %>
@@ -0,0 +1,37 @@
1
+ <section id="attachments">
2
+ <h4><%= t(".attachments_title", scope: "decidim.admin") %></h4>
3
+
4
+ <% if can? :create, authorization_object %>
5
+ <div class="actions title">
6
+ <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.attachment.name", scope: "decidim.admin")), url_for(action: :new), class: 'new' %>
7
+ </div>
8
+ <% end %>
9
+
10
+ <% if attached_to.attachments.any? %>
11
+ <table class="stack">
12
+ <thead>
13
+ <tr>
14
+ <th><%= t("models.attachment.fields.title", scope: "decidim.admin") %></th>
15
+ <th><%= t("models.attachment.fields.content_type", scope: "decidim.admin") %></th>
16
+ <th class="actions"><%= t("actions.title", scope: "decidim.admin") %></th>
17
+ </tr>
18
+ </thead>
19
+ <tbody>
20
+ <% attached_to.attachments.each do |attachment| %>
21
+ <tr data-id="<%= attachment.id %>">
22
+ <td>
23
+ <%= link_to translated_attribute(attachment.title), polymorphic_path([attached_to, attachment]) %><br />
24
+ </td>
25
+ <td>
26
+ <%= attachment.file_type %>
27
+ </td>
28
+ <td class="actions">
29
+ <%= link_to t("actions.edit", scope: "decidim.admin"), edit_polymorphic_path([attached_to, attachment]) if can? :update, authorization_object %>
30
+ <%= link_to t("actions.destroy", scope: "decidim.admin"), polymorphic_path([attached_to, attachment]), method: :delete, class: "small alert button", data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } if can? :destroy, authorization_object %>
31
+ </td>
32
+ </tr>
33
+ <% end %>
34
+ </tbody>
35
+ </table>
36
+ <% end %>
37
+ </section>
@@ -0,0 +1,9 @@
1
+ <h3><%= t ".title" %></h3>
2
+
3
+ <%= form_for(@form, url: [attached_to, @form]) do |f| %>
4
+ <%= render partial: 'decidim/admin/attachments/form', object: f %>
5
+
6
+ <div class="actions">
7
+ <%= f.submit t(".create") %>
8
+ </div>
9
+ <% end %>
@@ -0,0 +1,25 @@
1
+ <h3><%= translated_attribute(@attachment.title) %></h3>
2
+
3
+ <div class="actions">
4
+ <hr />
5
+ <%= link_to t("decidim.admin.actions.edit"), ['edit', @attachment.attached_to, @attachment] if can? :update, @attachment %>
6
+ <%= link_to t("decidim.admin.actions.destroy"), [@attachment.attached_to, @attachment], method: :delete, class: "alert button", data: { confirm: t("decidim.admin.actions.confirm_destroy") } if can? :destroy, @attachment %>
7
+ </div>
8
+
9
+ <dl>
10
+ <%= display_for @attachment,
11
+ :title,
12
+ :description,
13
+ :file_type
14
+ %>
15
+ <dt><%= display_label(@attachment, :file_size) %></dt>
16
+ <dd><%= number_to_human_size(@attachment.file_size) %></dd>
17
+ <dt><%= display_label(@attachment, :file) %></dt>
18
+ <% if @attachment.photo? %>
19
+ <%= link_to @attachment.big_url do %>
20
+ <%= image_tag @attachment.thumbnail_url, class: "thumbnail", alt: strip_tags(translated_attribute(@attachment.description)) %>
21
+ <% end %>
22
+ <% else %>
23
+ <%= link_to translated_attribute(@attachment.title), @attachment.url %>
24
+ <% end %>
25
+ </dl>
@@ -1,5 +1,6 @@
1
1
  <div class="field">
2
2
  <%= form.translated :text_field, :name, autofocus: true %>
3
+ <%= form.number_field :weight %>
3
4
 
4
5
  <% if form.object.settings? %>
5
6
  <fieldset class="global-settings">
@@ -1,5 +1,8 @@
1
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 %>
2
+ <%= settings_attribute_input(
3
+ form,
4
+ attribute,
5
+ name,
6
+ label: t("decidim.features.#{feature.manifest.name}.settings.#{settings_name}.#{name}")
7
+ )%>
5
8
  <% end %>
@@ -26,6 +26,10 @@
26
26
  <%= form.file_field :logo %>
27
27
  </div>
28
28
 
29
+ <div class="field">
30
+ <%= form.file_field :favicon %>
31
+ </div>
32
+
29
33
  <div class="field">
30
34
  <%= form.check_box :show_statistics %>
31
35
  </div>
@@ -33,3 +33,19 @@
33
33
  <div class="field">
34
34
  <%= form.check_box :promoted %>
35
35
  </div>
36
+
37
+ <div class="field">
38
+ <%= form.translated :text_field, :domain %>
39
+ </div>
40
+
41
+ <div class="field">
42
+ <%= form.translated :text_field, :scope %>
43
+ </div>
44
+
45
+ <div class="field">
46
+ <%= form.text_field :developer_group %>
47
+ </div>
48
+
49
+ <div class="field">
50
+ <%= form.date_field :end_date %>
51
+ </div>
@@ -5,9 +5,19 @@
5
5
  :hashtag,
6
6
  :slug,
7
7
  :short_description,
8
- :description
8
+ :description,
9
+ :scope,
10
+ :domain,
11
+ :developer_group
9
12
  %>
10
13
 
14
+ <dt><%= display_label(participatory_process, :end_date) %></dt>
15
+ <dd>
16
+ <% if participatory_process.end_date %>
17
+ <%= l(participatory_process.end_date, format: :long) %>
18
+ <% end %>
19
+ </dd>
20
+
11
21
  <dt><%= display_label(participatory_process, :hero_image) %></dt>
12
22
  <dd>
13
23
  <% if participatory_process.hero_image? %>
@@ -1,4 +1,4 @@
1
1
  <meta name="viewport" content="width=device-width, initial-scale=1">
2
2
  <%= csrf_meta_tags %>
3
- <%= stylesheet_link_tag 'decidim/admin/application', media: 'all', 'data-turbolinks-track': 'reload' %>
4
- <%= javascript_include_tag 'decidim/admin/application', 'data-turbolinks-track': 'reload' %>
3
+ <%= stylesheet_link_tag 'decidim/admin/application', media: 'all' %>
4
+ <%= javascript_include_tag 'decidim/admin/application' %>
@@ -11,7 +11,7 @@
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 %>
14
+ <%= active_link_to t("menu.users", scope: "decidim.admin"), decidim_admin.users_path, active: :inclusive if can? :read, :admin_users %>
15
15
  <%= active_link_to t("menu.user_groups", scope: "decidim.admin"), decidim_admin.user_groups_path, active: :inclusive if can? :index, Decidim::UserGroup %>
16
16
  <%= active_link_to t("menu.settings", scope: "decidim.admin"), decidim_admin.edit_organization_path, active: :inclusive if can? :read, current_organization %>
17
17
  </nav>
@@ -31,9 +31,9 @@
31
31
  <%= aria_selected_link_to t("process_admins", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_user_roles_path(participatory_process) %>
32
32
  </li>
33
33
  <% end %>
34
- <% if can? :read, Decidim::ParticipatoryProcessAttachment %>
34
+ <% if can? :read, Decidim::Attachment %>
35
35
  <li class="tabs-title">
36
- <%= aria_selected_link_to t("attachments", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_attachments_path(participatory_process) %>
36
+ <%= aria_selected_link_to t("attachments", scope: "decidim.admin.menu.participatory_processes_submenu"), decidim_admin.participatory_process_attachments_path(participatory_process.id) %>
37
37
  </li>
38
38
  <% end %>
39
39
  <% if can? :update, participatory_process %>
@@ -1,15 +1,21 @@
1
1
  ca:
2
2
  activemodel:
3
3
  attributes:
4
+ attachment:
5
+ description: Descripció
6
+ file: Arxiu
7
+ title: Títol
4
8
  category:
5
9
  description: Descripció
6
10
  name: Nom
7
11
  parent: Pare
8
12
  feature:
9
13
  name: Nom
14
+ weight: Pes
10
15
  organization:
11
16
  default_locale: Idioma per defecte
12
17
  description: Descripció
18
+ favicon: Icona
13
19
  homepage_image: Imatge de la portada
14
20
  logo: Logotip
15
21
  name: Nom
@@ -25,10 +31,6 @@ ca:
25
31
  slug: Nom curt d'URL
26
32
  subtitle: Subtítol
27
33
  title: Títol
28
- participatory_process_attachment:
29
- description: Descripció
30
- file: Arxiu
31
- title: Títol
32
34
  participatory_process_step:
33
35
  description: Descripció
34
36
  end_date: Data de finalització
@@ -66,6 +68,21 @@ ca:
66
68
  title: Accions
67
69
  unpublish: Despublicar
68
70
  verify: Verificar
71
+ attachments:
72
+ create:
73
+ error: S'ha produït un error en crear un nou arxiu adjunt.
74
+ success: Adjunt creat correctament.
75
+ destroy:
76
+ success: L'adjunt s'ha eliminat correctament.
77
+ edit:
78
+ title: Edita arxiu adjunt
79
+ update: Actualitza adjunt
80
+ new:
81
+ create: Crea arxiu adjunt
82
+ title: Nou arxiu adjunt
83
+ update:
84
+ error: S'ha produït un error en actualitzar aquest arxiu adjunt.
85
+ success: Adjunt actualitzat correctament.
69
86
  categories:
70
87
  create:
71
88
  error: S'ha produït un error en crear aquesta categoria.
@@ -84,12 +101,12 @@ ca:
84
101
  success: Categoria actualitzada correctament.
85
102
  decidim:
86
103
  admin:
104
+ attachments:
105
+ index:
106
+ attachments_title: Adjunts
87
107
  categories:
88
108
  index:
89
109
  categories_title: Categories
90
- participatory_process_attachments:
91
- index:
92
- attachments_title: Adjunts
93
110
  participatory_process_steps:
94
111
  index:
95
112
  steps_hint: Pots arrossegar les files de la taula per reordenar les fases del procés.
@@ -140,6 +157,11 @@ ca:
140
157
  user_groups: Grups d'usuaris
141
158
  users: Administradors
142
159
  models:
160
+ attachment:
161
+ fields:
162
+ content_type: Tipus
163
+ title: Títol
164
+ name: Arxiu adjunt
143
165
  category:
144
166
  fields:
145
167
  name: Nom
@@ -151,11 +173,6 @@ ca:
151
173
  published: Publicat
152
174
  title: Títol
153
175
  name: Procés participatiu
154
- participatory_process_attachment:
155
- fields:
156
- content_type: Tipus
157
- title: Títol
158
- name: Accessori
159
176
  participatory_process_step:
160
177
  fields:
161
178
  active: Activa
@@ -199,21 +216,6 @@ ca:
199
216
  update:
200
217
  error: S'ha produït un error en actualitzar aquesta organització.
201
218
  success: Organització actualitzada correctament.
202
- participatory_process_attachments:
203
- create:
204
- error: S'ha produït un error en crear un nou arxiu adjunt.
205
- success: Adjunt creat correctament.
206
- destroy:
207
- success: L'adjunt s'ha eliminat correctament.
208
- edit:
209
- title: Edita arxiu adjunt
210
- update: Actualitza adjunt
211
- new:
212
- create: Crear arxiu adjunt
213
- title: Nou arxiu adjunt
214
- update:
215
- error: S'ha produït un error en actualitzar aquest arxiu adjunt.
216
- success: Adjunt actualitzat correctament.
217
219
  participatory_process_publications:
218
220
  create:
219
221
  error: S'ha produït un error en publicar aquest procés participatiu.
@@ -2,15 +2,21 @@
2
2
  en:
3
3
  activemodel:
4
4
  attributes:
5
+ attachment:
6
+ description: Description
7
+ file: File
8
+ title: Title
5
9
  category:
6
10
  description: Description
7
11
  name: Name
8
12
  parent: Parent
9
13
  feature:
10
14
  name: Name
15
+ weight: Weight
11
16
  organization:
12
17
  default_locale: Default locale
13
18
  description: Description
19
+ favicon: Icon
14
20
  homepage_image: Homepage image
15
21
  logo: Logo
16
22
  name: Name
@@ -26,10 +32,6 @@ en:
26
32
  slug: URL slug
27
33
  subtitle: Subtitle
28
34
  title: Title
29
- participatory_process_attachment:
30
- description: Description
31
- file: File
32
- title: Title
33
35
  participatory_process_step:
34
36
  description: Description
35
37
  end_date: End date
@@ -67,6 +69,21 @@ en:
67
69
  title: Actions
68
70
  unpublish: Unpublish
69
71
  verify: Verify
72
+ attachments:
73
+ create:
74
+ error: There was an error creating a new attachment.
75
+ success: Attachment created successfully.
76
+ destroy:
77
+ success: Attachment destroyed successfully.
78
+ edit:
79
+ title: Edit attachment
80
+ update: Update attachment
81
+ new:
82
+ create: Create attachment
83
+ title: New attachment
84
+ update:
85
+ error: There was an error when updating this attachment.
86
+ success: Attachment updated successfully.
70
87
  categories:
71
88
  create:
72
89
  error: There was an error creating this category.
@@ -85,12 +102,12 @@ en:
85
102
  success: Category updated successfully.
86
103
  decidim:
87
104
  admin:
105
+ attachments:
106
+ index:
107
+ attachments_title: Attachments
88
108
  categories:
89
109
  index:
90
110
  categories_title: Categories
91
- participatory_process_attachments:
92
- index:
93
- attachments_title: Attachments
94
111
  participatory_process_steps:
95
112
  index:
96
113
  steps_hint: You can drag the rows of the table in order to reorder the process steps.
@@ -141,6 +158,11 @@ en:
141
158
  user_groups: User groups
142
159
  users: Admin users
143
160
  models:
161
+ attachment:
162
+ fields:
163
+ content_type: Type
164
+ title: Title
165
+ name: Attachment
144
166
  category:
145
167
  fields:
146
168
  name: Name
@@ -152,11 +174,6 @@ en:
152
174
  published: Published
153
175
  title: Title
154
176
  name: Participatory process
155
- participatory_process_attachment:
156
- fields:
157
- content_type: Type
158
- title: Title
159
- name: Attachment
160
177
  participatory_process_step:
161
178
  fields:
162
179
  active: Active
@@ -200,21 +217,6 @@ en:
200
217
  update:
201
218
  error: There was an error when updating this organization.
202
219
  success: Organization updated successfully.
203
- participatory_process_attachments:
204
- create:
205
- error: There was an error creating a new attachment.
206
- success: Attachment created successfully.
207
- destroy:
208
- success: Attachment destroyed successfully.
209
- edit:
210
- title: Edit attachment
211
- update: Update attachment
212
- new:
213
- create: Create attachment
214
- title: New attachment
215
- update:
216
- error: There was an error when updating this attachment.
217
- success: Attachment updated successfully.
218
220
  participatory_process_publications:
219
221
  create:
220
222
  error: There was an error publishing this participatory process.
@@ -1,15 +1,21 @@
1
1
  es:
2
2
  activemodel:
3
3
  attributes:
4
+ attachment:
5
+ description: Descripción
6
+ file: Archivo
7
+ title: Título
4
8
  category:
5
9
  description: Descripción
6
10
  name: Nombre
7
11
  parent: Padre
8
12
  feature:
9
13
  name: Nombre
14
+ weight: Peso
10
15
  organization:
11
16
  default_locale: Configuración regional predeterminada
12
17
  description: Descripción
18
+ favicon: Icono
13
19
  homepage_image: Imagen de portada
14
20
  logo: Logotipo
15
21
  name: Nombre
@@ -25,10 +31,6 @@ es:
25
31
  slug: Texto corto de URL
26
32
  subtitle: Subtítulo
27
33
  title: Título
28
- participatory_process_attachment:
29
- description: Descripción
30
- file: Archivo
31
- title: Título
32
34
  participatory_process_step:
33
35
  description: Descripción
34
36
  end_date: Fecha de finalización
@@ -66,6 +68,21 @@ es:
66
68
  title: Acciones
67
69
  unpublish: Despublicar
68
70
  verify: Verificar
71
+ attachments:
72
+ create:
73
+ error: Se ha producido un error al crear un nuevo archivo adjunto.
74
+ success: Adjunto creado correctamente.
75
+ destroy:
76
+ success: El archivo adjunto se ha eliminado correctamente.
77
+ edit:
78
+ title: Editar archivo adjunto
79
+ update: Actualizar archivo adjunto
80
+ new:
81
+ create: Crear archivo adjunto
82
+ title: Nuevo archivo adjunto
83
+ update:
84
+ error: Se ha producido un error al actualizar este archivo adjunto.
85
+ success: Adjunto actualizado correctamente.
69
86
  categories:
70
87
  create:
71
88
  error: Se ha producido un error al crear esta categoría.
@@ -84,12 +101,12 @@ es:
84
101
  success: Categoría actualizada correctamente.
85
102
  decidim:
86
103
  admin:
104
+ attachments:
105
+ index:
106
+ attachments_title: Archivos adjuntos
87
107
  categories:
88
108
  index:
89
109
  categories_title: Categorías
90
- participatory_process_attachments:
91
- index:
92
- attachments_title: Archivos adjuntos
93
110
  participatory_process_steps:
94
111
  index:
95
112
  steps_hint: Puedes arrastrar las filas de la tabla para reordenar las fases del proceso.
@@ -140,6 +157,11 @@ es:
140
157
  user_groups: Grupos de usuarios
141
158
  users: Administradores
142
159
  models:
160
+ attachment:
161
+ fields:
162
+ content_type: Tipo
163
+ title: Título
164
+ name: Archivo adjunto
143
165
  category:
144
166
  fields:
145
167
  name: Nombre
@@ -151,11 +173,6 @@ es:
151
173
  published: Publicado
152
174
  title: Título
153
175
  name: Proceso participativo
154
- participatory_process_attachment:
155
- fields:
156
- content_type: Tipo
157
- title: Título
158
- name: Archivo adjunto
159
176
  participatory_process_step:
160
177
  fields:
161
178
  active: Activa
@@ -199,21 +216,6 @@ es:
199
216
  update:
200
217
  error: Se produjo un error al actualizar esta organización.
201
218
  success: Organización actualizada correctamente.
202
- participatory_process_attachments:
203
- create:
204
- error: Se ha producido un error al crear un nuevo archivo adjunto.
205
- success: Adjunto creado correctamente.
206
- destroy:
207
- success: El archivo adjunto se ha eliminado correctamente.
208
- edit:
209
- title: Editar archivo adjunto
210
- update: Actualizar archivo adjunto
211
- new:
212
- create: Crear archivo adjunto
213
- title: Nuevo archivo adjunto
214
- update:
215
- error: Se ha producido un error al actualizar este archivo adjunto.
216
- success: Adjunto actualizado correctamente.
217
219
  participatory_process_publications:
218
220
  create:
219
221
  error: Se ha producido un error al publicar este proceso participativo.
data/config/routes.rb CHANGED
@@ -27,7 +27,7 @@ Decidim::Admin::Engine.routes.draw do
27
27
  end
28
28
  end
29
29
 
30
- get "/" => proc { raise "Feature not found" }, as: :manage_feature
30
+ get "/", to: redirect("/404"), as: :manage_feature
31
31
  end
32
32
 
33
33
  resources :static_pages
@@ -0,0 +1,9 @@
1
+ class ChangeUserGroupsVerifiedToTimestamp < ActiveRecord::Migration[5.0]
2
+ def change
3
+ ActiveRecord::Base.transaction do
4
+ add_column :decidim_user_groups, :verified_at, :datetime
5
+ ActiveRecord::Base.connection.execute("UPDATE decidim_user_groups SET verified_at = '#{Time.current.to_s(:db)}' WHERE verified = 't'")
6
+ remove_column :decidim_user_groups, :verified
7
+ end
8
+ end
9
+ end
@@ -7,7 +7,6 @@ require "devise-i18n"
7
7
  require "decidim/core"
8
8
  require "jquery-rails"
9
9
  require "sassc-rails"
10
- require "turbolinks"
11
10
  require "foundation-rails"
12
11
  require "foundation_rails_helper"
13
12
  require "rectify"
@@ -32,7 +31,8 @@ module Decidim
32
31
 
33
32
  initializer "decidim_admin.inject_abilities_to_user" do |_app|
34
33
  Decidim.configure do |config|
35
- config.abilities += [Decidim::Admin::Abilities::AdminUser]
34
+ config.abilities += ["Decidim::Admin::Abilities::AdminUser"]
35
+ config.abilities += ["Decidim::Admin::Abilities::ParticipatoryProcessAdmin"]
36
36
  end
37
37
  end
38
38
  end
@@ -0,0 +1,103 @@
1
+ # -*- coding: utf-8 -*-
2
+ # frozen_string_literal: true
3
+ RSpec.shared_examples "manage attachments examples" do
4
+ let!(:attachment) do
5
+ Decidim::AttachmentUploader.enable_processing = true
6
+ create(:attachment, attached_to: attached_to)
7
+ end
8
+
9
+ before do
10
+ visit current_path
11
+ end
12
+
13
+ it "lists all the attachments for the process" do
14
+ within "#attachments table" do
15
+ expect(page).to have_content(translated(attachment.title, locale: :en))
16
+ expect(page).to have_content(attachment.file_type)
17
+ end
18
+ end
19
+
20
+ it "can view an attachment details" do
21
+ within "#attachments table" do
22
+ click_link translated(attachment.title, locale: :en)
23
+ end
24
+
25
+ expect(page).to have_content(stripped(translated(attachment.title, locale: :en)))
26
+ expect(page).to have_content(stripped(translated(attachment.description, locale: :en)))
27
+ expect(page).to have_content(attachment.file_type)
28
+ expect(page).to have_css("img[src~='#{attachment.thumbnail_url}']")
29
+ end
30
+
31
+ it "can add attachments to a process" do
32
+ find("#attachments .actions .new").click
33
+
34
+ within ".new_attachment" do
35
+ fill_in_i18n(
36
+ :attachment_title,
37
+ "#title-tabs",
38
+ en: "Very Important Document",
39
+ es: "Documento Muy Importante",
40
+ ca: "Document Molt Important"
41
+ )
42
+
43
+ fill_in_i18n(
44
+ :attachment_description,
45
+ "#description-tabs",
46
+ en: "This document contains important information",
47
+ es: "Este documento contiene información importante",
48
+ ca: "Aquest document conté informació important"
49
+ )
50
+
51
+ attach_file :attachment_file, Decidim::Dev.asset("Exampledocument.pdf")
52
+ find("*[type=submit]").click
53
+ end
54
+
55
+ within ".flash" do
56
+ expect(page).to have_content("successfully")
57
+ end
58
+
59
+ within "#attachments table" do
60
+ expect(page).to have_link("Very Important Document")
61
+ end
62
+ end
63
+
64
+ it "can delete an attachment from a process" do
65
+ within find("tr", text: stripped(translated(attachment.title))) do
66
+ click_link "Destroy"
67
+ end
68
+
69
+ within ".flash" do
70
+ expect(page).to have_content("successfully")
71
+ end
72
+
73
+ expect(page).not_to have_content(translated(attachment.title, locale: :en))
74
+ end
75
+
76
+ it "can update an attachment" do
77
+ within "#attachments" do
78
+ within find("tr", text: stripped(translated(attachment.title))) do
79
+ click_link "Edit"
80
+ end
81
+ end
82
+
83
+ within ".edit_attachment" do
84
+ fill_in_i18n(
85
+ :attachment_title,
86
+ "#title-tabs",
87
+ en: "This is a nice photo",
88
+ es: "Una foto muy guay",
89
+ ca: "Aquesta foto és ben xula"
90
+ )
91
+
92
+ find("*[type=submit]").click
93
+ end
94
+
95
+ within ".flash" do
96
+ expect(page).to have_content("successfully")
97
+ end
98
+
99
+ within "#attachments table" do
100
+ expect(page).to have_link("This is a nice photo")
101
+ end
102
+ end
103
+ end