decidim-admin 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/decidim/admin/extra/_label-required.scss +3 -0
  3. data/app/assets/stylesheets/decidim/admin/extra/_title_bar.scss +57 -1
  4. data/app/commands/decidim/admin/create_participatory_process_admin.rb +28 -7
  5. data/app/commands/decidim/admin/create_participatory_process_step.rb +2 -1
  6. data/app/commands/decidim/admin/destroy_participatory_process_step.rb +5 -2
  7. data/app/commands/decidim/admin/update_feature.rb +1 -0
  8. data/app/commands/decidim/admin/update_organization.rb +10 -5
  9. data/app/commands/decidim/admin/update_participatory_process.rb +4 -2
  10. data/app/controllers/decidim/admin/application_controller.rb +2 -0
  11. data/app/controllers/decidim/admin/concerns/has_attachments.rb +10 -1
  12. data/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +0 -5
  13. data/app/controllers/decidim/admin/features/base_controller.rb +0 -1
  14. data/app/controllers/decidim/admin/moderations_controller.rb +7 -4
  15. data/app/controllers/decidim/admin/organization_controller.rb +9 -3
  16. data/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +17 -0
  17. data/app/controllers/decidim/admin/participatory_processes_controller.rb +11 -3
  18. data/app/forms/decidim/admin/feature_form.rb +6 -0
  19. data/app/forms/decidim/admin/organization_form.rb +5 -0
  20. data/app/forms/decidim/admin/participatory_process_copy_form.rb +2 -3
  21. data/app/forms/decidim/admin/participatory_process_form.rb +2 -0
  22. data/app/forms/decidim/admin/static_page_form.rb +6 -0
  23. data/app/helpers/decidim/admin/menu_helper.rb +1 -1
  24. data/app/jobs/decidim/admin/newsletter_job.rb +9 -5
  25. data/app/views/decidim/admin/attachments/_form.html.erb +1 -12
  26. data/app/views/decidim/admin/features/_feature.html.erb +2 -2
  27. data/app/views/decidim/admin/features/_form.html.erb +18 -0
  28. data/app/views/decidim/admin/moderations/_report.html.erb +2 -2
  29. data/app/views/decidim/admin/organization/_form.html.erb +5 -35
  30. data/app/views/decidim/admin/participatory_process_groups/_form.html.erb +1 -1
  31. data/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +16 -0
  32. data/app/views/decidim/admin/participatory_processes/_form.html.erb +2 -14
  33. data/app/views/layouts/decidim/admin/_title_bar.html.erb +26 -19
  34. data/app/views/layouts/decidim/admin/participatory_process.html.erb +2 -2
  35. data/config/i18n-tasks.yml +2 -0
  36. data/config/locales/ca.yml +9 -5
  37. data/config/locales/en.yml +9 -5
  38. data/config/locales/es.yml +11 -5
  39. data/config/locales/eu.yml +0 -5
  40. data/config/locales/fr.yml +18 -23
  41. data/config/locales/it.yml +0 -5
  42. data/config/routes.rb +5 -3
  43. data/lib/decidim/admin/test/manage_attachments_examples.rb +1 -2
  44. metadata +7 -7
  45. data/app/assets/stylesheets/decidim/admin/extra/_language-chooser.scss +0 -4
@@ -10,12 +10,11 @@ module Decidim
10
10
 
11
11
  translatable_attribute :title, String
12
12
 
13
+ mimic :participatory_process
14
+
13
15
  attribute :slug, String
14
16
  attribute :copy_steps, Boolean
15
17
  attribute :copy_categories, Boolean
16
- attribute :copy_process_users, Boolean
17
- attribute :copy_moderations, Boolean
18
- attribute :copy_pages, Boolean
19
18
  attribute :copy_features, Boolean
20
19
 
21
20
  validates :slug, presence: true
@@ -27,7 +27,9 @@ module Decidim
27
27
  attribute :promoted, Boolean
28
28
  attribute :scope_id, Integer
29
29
  attribute :hero_image
30
+ attribute :remove_hero_image
30
31
  attribute :banner_image
32
+ attribute :remove_banner_image
31
33
  attribute :participatory_process_group_id, Integer
32
34
 
33
35
  validates :slug, presence: true
@@ -14,10 +14,16 @@ module Decidim
14
14
 
15
15
  validates :slug, presence: true
16
16
  validates :title, :content, translatable_presence: true
17
+ validates :slug, format: { with: /\A[a-z0-9-]+/ }
18
+
17
19
  validate :slug, :slug_uniqueness
18
20
 
19
21
  alias organization current_organization
20
22
 
23
+ def slug
24
+ super.to_s.downcase
25
+ end
26
+
21
27
  private
22
28
 
23
29
  def slug_uniqueness
@@ -6,7 +6,7 @@ module Decidim
6
6
  module MenuHelper
7
7
  # Public: Returns the main menu presenter object
8
8
  def main_menu
9
- @main_menu ||= MenuPresenter.new(
9
+ @main_menu ||= ::Decidim::MenuPresenter.new(
10
10
  :admin_menu,
11
11
  self,
12
12
  active_class: "is-active"
@@ -8,10 +8,12 @@ module Decidim
8
8
  queue_as :newsletter
9
9
 
10
10
  def perform(newsletter)
11
- newsletter.with_lock do
12
- raise "Newsletter already sent" if newsletter.sent?
11
+ @newsletter = newsletter
13
12
 
14
- newsletter.update_attributes!(
13
+ @newsletter.with_lock do
14
+ raise "Newsletter already sent" if @newsletter.sent?
15
+
16
+ @newsletter.update_attributes!(
15
17
  sent_at: Time.current,
16
18
  total_recipients: recipients.count,
17
19
  total_deliveries: 0
@@ -19,14 +21,16 @@ module Decidim
19
21
  end
20
22
 
21
23
  recipients.find_each do |user|
22
- NewsletterDeliveryJob.perform_later(user, newsletter)
24
+ NewsletterDeliveryJob.perform_later(user, @newsletter)
23
25
  end
24
26
  end
25
27
 
26
28
  private
27
29
 
28
30
  def recipients
29
- @recipients ||= User.where(newsletter_notifications: true).where.not(email: nil, confirmed_at: nil)
31
+ @recipients ||= User.where(newsletter_notifications: true, organization: @newsletter.organization)
32
+ .where.not(email: nil, confirmed_at: nil)
33
+ .not_deleted
30
34
  end
31
35
  end
32
36
  end
@@ -15,18 +15,7 @@
15
15
  </div>
16
16
 
17
17
  <div class="row column">
18
- <%= form.file_field :file %>
18
+ <%= form.upload :file, optional: false %>
19
19
  </div>
20
-
21
- <% if @attachment && @attachment.file.present? %>
22
- <div class="row column">
23
- <label><%= t('.current_file') %></label>
24
- <% if @attachment.photo? %>
25
- <%= image_tag form.object.file.url(:thumbnail) %>
26
- <% end %>
27
- <label><%= t('.url') %></label>
28
- <%= link_to @attachment.file.url, @attachment.file.url, target: "_blank" %>
29
- </div>
30
- <% end %>
31
20
  </div>
32
21
  </div>
@@ -1,6 +1,6 @@
1
1
  <tr class="feature-<%= feature.id %>">
2
2
  <td>
3
- <%= link_to decidim.feature_path(participatory_process, feature), target: "_blank" do %>
3
+ <%= link_to feature_path(feature), target: "_blank" do %>
4
4
  <%= translated_attribute feature.name %>
5
5
  <% end %>
6
6
  </td>
@@ -9,7 +9,7 @@
9
9
  </td>
10
10
  <td class="table-list__actions">
11
11
  <% if feature.manifest.admin_engine %>
12
- <%= icon_link_to "pencil", manage_feature_path(participatory_process, feature), t("actions.manage", scope: "decidim.admin"), class: "action-icon--manage" %>
12
+ <%= icon_link_to "pencil", manage_feature_path(feature), t("actions.manage", scope: "decidim.admin"), class: "action-icon--manage" %>
13
13
  <% end %>
14
14
 
15
15
  <% if can?(:update, feature) %>
@@ -55,6 +55,24 @@
55
55
  </div>
56
56
  </div>
57
57
  </fieldset>
58
+ <% elsif form.object.default_step_settings? %>
59
+ <fieldset class="default-step-settings">
60
+ <div class="card">
61
+ <div class="card-divider">
62
+ <legend><%= t ".default_step_settings" %></legend>
63
+ </div>
64
+ <div class="card-section">
65
+ <%= form.fields_for :default_step_settings, form.object.default_step_settings do |settings_fields| %>
66
+ <%= render partial: "decidim/admin/features/settings_fields",
67
+ locals: {
68
+ form: settings_fields,
69
+ feature: @feature,
70
+ settings_name: "step"
71
+ } %>
72
+ <% end %>
73
+ </div>
74
+ </div>
75
+ </fieldset>
58
76
  <% end %>
59
77
  </div>
60
78
  </div>
@@ -1,11 +1,11 @@
1
1
  <% if report.details.blank? %>
2
- <%= report.reason %>
2
+ <%= t(".reasons.#{report.reason}") %>
3
3
  <% else %>
4
4
  <span
5
5
  data-tooltip
6
6
  aria-haspopup="true"
7
7
  class="has-tip"
8
8
  title="<%= report.details %>">
9
- <%= report.reason %>
9
+ <%= t(".reasons.#{report.reason}") %>
10
10
  </span>
11
11
  <% end %>
@@ -42,55 +42,25 @@
42
42
 
43
43
  <div class="row">
44
44
  <div class="columns xlarge-4">
45
- <%= form.file_field :homepage_image %>
46
- <% if current_organization.homepage_image.present? %>
47
- <label><%= t('.current_image') %></label>
48
- <%= image_tag current_organization.homepage_image.big.url %>
49
- <label><%= t('.url') %></label>
50
- <%= link_to current_organization.homepage_image.file.filename, current_organization.homepage_image.url, target: "_blank" %>
51
- <% end %>
45
+ <%= form.upload :homepage_image %>
52
46
  </div>
53
47
 
54
48
  <div class="columns xlarge-4">
55
- <%= form.file_field :logo %>
56
- <% if current_organization.logo.present? %>
57
- <label><%= t('.current_image') %></label>
58
- <%= image_tag current_organization.logo.medium.url %>
59
- <label><%= t('.url') %></label>
60
- <%= link_to current_organization.logo.file.filename, current_organization.logo.url, target: "_blank" %>
61
- <% end %>
49
+ <%= form.upload :logo %>
62
50
  </div>
63
51
 
64
52
  <div class="columns xlarge-4">
65
- <%= form.file_field :favicon %>
66
- <% if current_organization.favicon.present? %>
67
- <label><%= t('.current_image') %></label>
68
- <%= image_tag current_organization.favicon.big.url %>
69
- <label><%= t('.url') %></label>
70
- <%= link_to current_organization.favicon.file.filename, current_organization.favicon.url, target: "_blank" %>
71
- <% end %>
53
+ <%= form.upload :favicon %>
72
54
  </div>
73
55
  </div>
74
56
 
75
57
  <div class="row">
76
58
  <div class="columns xlarge-6">
77
- <%= form.file_field :official_img_header %>
78
- <% if current_organization.official_img_header.present? %>
79
- <label><%= t('.current_image') %></label>
80
- <%= image_tag current_organization.official_img_header.url %>
81
- <label><%= t('.url') %></label>
82
- <%= link_to current_organization.official_img_header.file.filename, current_organization.official_img_header.url, target: "_blank" %>
83
- <% end %>
59
+ <%= form.upload :official_img_header %>
84
60
  </div>
85
61
 
86
62
  <div class="columns xlarge-6">
87
- <%= form.file_field :official_img_footer %>
88
- <% if current_organization.official_img_footer.present? %>
89
- <label><%= t('.current_image') %></label>
90
- <%= image_tag current_organization.official_img_footer.url %>
91
- <label><%= t('.url') %></label>
92
- <%= link_to current_organization.official_img_footer.file.filename, current_organization.official_img_footer.url, target: "_blank" %>
93
- <% end %>
63
+ <%= form.upload :official_img_footer %>
94
64
  </div>
95
65
  </div>
96
66
 
@@ -13,5 +13,5 @@
13
13
  </div>
14
14
 
15
15
  <div class="row column">
16
- <%= form.file_field :hero_image %>
16
+ <%= form.upload :hero_image %>
17
17
  </div>
@@ -15,6 +15,8 @@
15
15
  <tr>
16
16
  <th><%= t("models.participatory_process_user_role.fields.name", scope: "decidim.admin") %></th>
17
17
  <th><%= t("models.participatory_process_user_role.fields.email", scope: "decidim.admin") %></th>
18
+ <th><%= t("models.user.fields.invitation_sent_at", scope: "decidim.admin") %></th>
19
+ <th><%= t("models.user.fields.invitation_accepted_at", scope: "decidim.admin") %></th>
18
20
  <th><%= t("models.participatory_process_user_role.fields.role", scope: "decidim.admin") %></th>
19
21
  <th class="actions"></th>
20
22
  </tr>
@@ -28,10 +30,24 @@
28
30
  <td>
29
31
  <%= role.user.email %><br />
30
32
  </td>
33
+ <td>
34
+ <% if role.user.invitation_sent_at %>
35
+ <%= l role.user.invitation_sent_at, format: :short %>
36
+ <% end %>
37
+ </td>
38
+ <td>
39
+ <% if role.user.invitation_accepted_at %>
40
+ <%= l role.user.invitation_accepted_at, format: :short %>
41
+ <% end %>
42
+ </td>
31
43
  <td>
32
44
  <%= t("#{role.role}", scope: "decidim.admin.models.participatory_process_user_role.roles") %><br />
33
45
  </td>
34
46
  <td class="table-list__actions">
47
+ <% if can?(:invite, role) && role.user.invited_to_sign_up? %>
48
+ <%= icon_link_to "reload", resend_invitation_participatory_process_user_role_path(participatory_process, role), t("actions.resend_invitation", scope: "decidim.admin"), class: "resend-invitation", method: :post %>
49
+ <% end %>
50
+
35
51
  <% if can? :update, role %>
36
52
  <%= icon_link_to "pencil", edit_participatory_process_user_role_path(participatory_process, role), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
37
53
  <% end %>
@@ -36,23 +36,11 @@
36
36
 
37
37
  <div class="row">
38
38
  <div class="columns xlarge-6">
39
- <%= form.file_field :hero_image %>
40
- <% if @participatory_process && @participatory_process.hero_image.present? %>
41
- <label><%= t('.current_image') %></label>
42
- <%= image_tag @participatory_process.hero_image.url %>
43
- <label><%= t('.url') %></label>
44
- <%= link_to @participatory_process.hero_image.url, @participatory_process.hero_image.url, target: "_blank" %>
45
- <% end %>
39
+ <%= form.upload :hero_image %>
46
40
  </div>
47
41
 
48
42
  <div class="columns xlarge-6">
49
- <%= form.file_field :banner_image %>
50
- <% if @participatory_process && @participatory_process.banner_image.present? %>
51
- <label><%= t('.current_image') %></label>
52
- <%= image_tag @participatory_process.banner_image.url %>
53
- <label><%= t('.url') %></label>
54
- <%= link_to @participatory_process.banner_image.url, @participatory_process.banner_image.url, target: "_blank" %>
55
- <% end %>
43
+ <%= form.upload :banner_image %>
56
44
  </div>
57
45
  </div>
58
46
 
@@ -1,30 +1,37 @@
1
1
  <div class="title-bar">
2
2
  <a href="#menu" class="menu-trigger"><%= icon "menu" %></a>
3
- <%= link_to root_path, class: "logo" do %>
3
+ <%= link_to decidim.root_path, class: "logo", target: "_blank" do %>
4
4
  <% if current_organization.logo.present? %>
5
5
  <%= image_tag current_organization.logo.url, alt: title %>
6
6
  <% else %>
7
7
  <%= title %>
8
8
  <% end %>
9
9
  <% end %>
10
- <div class="user-login">
11
- <ul class="dropdown menu language-chooser" data-dropdown-menu>
12
- <li class="is-dropdown-submenu-parent">
13
- <%= link_to t("name", scope: "locale") %>
14
- <ul class="menu is-dropdown-submenu">
15
- <% (available_locales - [I18n.locale.to_s]).each do |locale| %>
16
- <li><%= link_to locale_name(locale), decidim.locale_path(locale: locale), method: :post%></li>
17
- <% end %>
10
+ <div class='tool-bar'>
11
+ <% if available_locales.length > 1 %>
12
+ <div class="topbar__dropmenu language-choose">
13
+ <ul class="dropdown menu" data-dropdown-menu>
14
+ <li class="is-dropdown-submenu-parent">
15
+ <%= link_to t("name", scope: "locale") %>
16
+ <ul class="menu is-dropdown-submenu">
17
+ <% (available_locales - [I18n.locale.to_s]).each do |locale| %>
18
+ <li><%= link_to locale_name(locale), decidim.locale_path(locale: locale), method: :post%></li>
19
+ <% end %>
20
+ </ul>
21
+ </li>
18
22
  </ul>
19
- </li>
20
- </ul>
21
- <ul class="dropdown menu" data-dropdown-menu>
22
- <li class="is-dropdown-submenu-parent">
23
- <a href="#"><%= current_user.email %></a>
24
- <ul class="menu is-dropdown-submenu">
25
- <li><%= link_to('Logout', decidim.destroy_user_session_path, method: :delete) %></li>
26
- </ul>
27
- </li>
28
- </ul>
23
+ </div>
24
+ <% end %>
25
+
26
+ <div class="user-login">
27
+ <ul class="dropdown menu" data-dropdown-menu>
28
+ <li class="is-dropdown-submenu-parent">
29
+ <a href="#"><%= current_user.email %></a>
30
+ <ul class="menu is-dropdown-submenu">
31
+ <li><%= link_to('Logout', decidim.destroy_user_session_path, method: :delete) %></li>
32
+ </ul>
33
+ </li>
34
+ </ul>
35
+ </div>
29
36
  </div>
30
37
  </div>
@@ -17,8 +17,8 @@
17
17
  <ul>
18
18
  <% participatory_process.features.each do |feature| %>
19
19
  <% if feature.manifest.admin_engine %>
20
- <li <% if is_active_link?(decidim_admin.manage_feature_path(participatory_process, feature)) %> class="is-active" <% end %>>
21
- <%= link_to decidim_admin.manage_feature_path(participatory_process, feature) do %>
20
+ <li <% if is_active_link?(manage_feature_path(feature)) %> class="is-active" <% end %>>
21
+ <%= link_to manage_feature_path(feature) do %>
22
22
  <%= translated_attribute feature.name %>
23
23
  <% if feature.primary_stat.present? %>
24
24
  <span class="component-counter <%= "component-counter--off" if feature.primary_stat.zero? %>"><%= feature.primary_stat %></span>
@@ -88,6 +88,7 @@ ignore_missing:
88
88
  # - '{devise,simple_form}.*'
89
89
  - decidim.participatory_processes.scopes.global
90
90
  - locale.name
91
+ - forms.required
91
92
 
92
93
  ## Consider these keys used:
93
94
  ignore_unused:
@@ -98,6 +99,7 @@ ignore_unused:
98
99
  - actions.confirm_destroy
99
100
  - time.formats.*
100
101
  - date.formats.*
102
+ - forms.*
101
103
 
102
104
  # - '{devise,kaminari,will_paginate}.*'
103
105
  # - 'simple_form.{yes,no}'
@@ -32,6 +32,9 @@ ca:
32
32
  welcome_text: Text de benvinguda
33
33
  participatory_process:
34
34
  banner_image: Imatge de bandera
35
+ copy_categories: Copiar categories
36
+ copy_features: Copiar funcionalitats
37
+ copy_steps: Copiar fases
35
38
  description: Descripció
36
39
  developer_group: Grup promotor
37
40
  domain: Àrees municipals
@@ -136,9 +139,6 @@ ca:
136
139
  edit:
137
140
  title: Edita arxiu adjunt
138
141
  update: Actualitzar
139
- form:
140
- current_file: Fitxer actual
141
- url: URL
142
142
  new:
143
143
  create: Crea arxiu adjunt
144
144
  title: Nou arxiu adjunt
@@ -201,6 +201,7 @@ ca:
201
201
  title: Editar funcionalitat
202
202
  update: Actualitza
203
203
  form:
204
+ default_step_settings: Configuració per defecte
204
205
  global_settings: Configuració global
205
206
  step_settings: Configuració de fase
206
207
  index:
@@ -309,6 +310,11 @@ ca:
309
310
  moderations:
310
311
  index:
311
312
  title: Moderacions
313
+ report:
314
+ reasons:
315
+ does_not_belong: No pertany
316
+ offensive: Ofensiu
317
+ spam: Contingut brossa
312
318
  newsletters:
313
319
  create:
314
320
  error: S'ha produït un error en crear aquest butlletí.
@@ -427,9 +433,7 @@ ca:
427
433
  edit:
428
434
  update: Actualitzar
429
435
  form:
430
- current_image: imatge actual
431
436
  title: Informació general
432
- url: URL
433
437
  index:
434
438
  not_published: No publicat
435
439
  published: Publicat
@@ -33,6 +33,9 @@ en:
33
33
  welcome_text: Welcome text
34
34
  participatory_process:
35
35
  banner_image: Banner image
36
+ copy_categories: Copy categories
37
+ copy_features: Copy features
38
+ copy_steps: Copy steps
36
39
  description: Description
37
40
  developer_group: Developer group
38
41
  domain: Domain
@@ -137,9 +140,6 @@ en:
137
140
  edit:
138
141
  title: Edit attachment
139
142
  update: Update
140
- form:
141
- current_file: Current file
142
- url: Url
143
143
  new:
144
144
  create: Create attachment
145
145
  title: New attachment
@@ -202,6 +202,7 @@ en:
202
202
  title: Edit feature
203
203
  update: Update
204
204
  form:
205
+ default_step_settings: Default step settings
205
206
  global_settings: Global settings
206
207
  step_settings: Step settings
207
208
  index:
@@ -310,6 +311,11 @@ en:
310
311
  moderations:
311
312
  index:
312
313
  title: Moderations
314
+ report:
315
+ reasons:
316
+ does_not_belong: Does not belong
317
+ offensive: Offensive
318
+ spam: Spam
313
319
  newsletters:
314
320
  create:
315
321
  error: There's been an error creating this newsletter.
@@ -428,9 +434,7 @@ en:
428
434
  edit:
429
435
  update: Update
430
436
  form:
431
- current_image: Current image
432
437
  title: General Information
433
- url: Url
434
438
  index:
435
439
  not_published: Not published
436
440
  published: Published