decidim-admin 0.7.4 → 0.8.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 (42) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +10 -5
  3. data/app/assets/javascripts/decidim/admin/application.js.es6 +1 -1
  4. data/app/assets/stylesheets/decidim/admin/modules/_buttons.scss +5 -9
  5. data/app/assets/stylesheets/decidim/admin/modules/_cards.scss +1 -0
  6. data/app/assets/stylesheets/decidim/admin/modules/_modules.scss +1 -0
  7. data/app/assets/stylesheets/decidim/admin/modules/_pics.scss +5 -0
  8. data/app/assets/stylesheets/decidim/admin/modules/_table-list.scss +7 -0
  9. data/app/commands/decidim/admin/create_managed_user.rb +1 -1
  10. data/app/controllers/decidim/admin/authorization_workflows_controller.rb +15 -0
  11. data/app/controllers/decidim/admin/feature_permissions_controller.rb +3 -1
  12. data/app/forms/decidim/admin/impersonate_managed_user_form.rb +1 -1
  13. data/app/forms/decidim/admin/managed_user_form.rb +1 -1
  14. data/app/forms/decidim/admin/organization_appearance_form.rb +1 -1
  15. data/app/helpers/decidim/admin/icon_link_helper.rb +6 -4
  16. data/app/models/decidim/admin/abilities/admin_ability.rb +3 -0
  17. data/app/views/decidim/admin/authorization_workflows/index.html.erb +32 -0
  18. data/app/views/decidim/admin/exports/_dropdown.html.erb +1 -1
  19. data/app/views/decidim/admin/feature_permissions/edit.html.erb +1 -1
  20. data/app/views/decidim/admin/moderations/index.html.erb +1 -3
  21. data/app/views/decidim/admin/newsletters/_form.html.erb +1 -1
  22. data/app/views/decidim/admin/newsletters/index.html.erb +3 -9
  23. data/app/views/layouts/decidim/admin/users.html.erb +12 -0
  24. data/config/locales/ca.yml +4 -1
  25. data/config/locales/en.yml +4 -1
  26. data/config/locales/es.yml +4 -1
  27. data/config/locales/eu.yml +4 -1
  28. data/config/locales/fi.yml +4 -1
  29. data/config/locales/fr.yml +4 -1
  30. data/config/locales/it.yml +16 -13
  31. data/config/locales/nl.yml +75 -72
  32. data/config/locales/pl.yml +4 -1
  33. data/config/locales/pt.yml +471 -0
  34. data/config/locales/ru.yml +4 -3
  35. data/config/locales/uk.yml +5 -2
  36. data/config/routes.rb +6 -0
  37. data/lib/decidim/admin/engine.rb +1 -1
  38. data/lib/decidim/admin/test/forms/category_form_examples.rb +3 -3
  39. data/lib/decidim/admin/test/manage_attachments_examples.rb +5 -11
  40. data/lib/decidim/admin/test/manage_feature_permissions_examples.rb +3 -3
  41. data/lib/decidim/admin/version.rb +1 -1
  42. metadata +30 -40
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 274c7f56d154a162fb13149c6147303c700742f6b587c1df8194a903878622aa
4
- data.tar.gz: a16fdeb3eeb31725ddc7354fc39231d21375d832657244314c8f8ae46da0dd47
2
+ SHA1:
3
+ metadata.gz: f46260aa0ada7f6abf12a2fbcbeb49ad934ab96b
4
+ data.tar.gz: dfc683ac1696fb03f7cfe3692a4463bf7686b6ad
5
5
  SHA512:
6
- metadata.gz: 1bff90772aec2d41c6a45eb38e0d7dae5f86dc83bc4a1ffa0f37675e0039babbb5b0cbb6baa0c883c909bf854764c581b68eb3aaf84b51a9b61b19a0866bd7b9
7
- data.tar.gz: aae60f9826eb053730e72f5c66e2dd1c42ddfef10bdef78199454c59a58fcb56c252ff9b73189d71232479dab6410e1fd79bde2639602177eb2600b7d8cc47a5
6
+ metadata.gz: 4e2a00a75e46ffe964dc4d597e283d0c865600bef3fa8f9f6fe541e0e00b5ae521ae562a790da203be8ba88602190fec50b96b1ba99783c5ddeded915569eae4
7
+ data.tar.gz: ed7f0eeae02b8fb07eea69b636552a6a0335338266b9ff91ce17d2a1a4f8d0d9a0bf1cf8a3b3188318a2483981065a120f2200aa3dae58ed0de6bd3827a54584
data/README.md CHANGED
@@ -4,10 +4,12 @@ This library adds an administration dashboard so users can manage their
4
4
  organization, participatory processes and all other entities.
5
5
 
6
6
  ## Usage
7
+
7
8
  This will add an admin dashboard to manage an organization an all its entities.
8
9
  It's included by default with Decidim.
9
10
 
10
11
  ## Installation
12
+
11
13
  Add this line to your application's Gemfile:
12
14
 
13
15
  ```ruby
@@ -15,8 +17,9 @@ gem 'decidim-admin'
15
17
  ```
16
18
 
17
19
  And then execute:
20
+
18
21
  ```bash
19
- $ bundle
22
+ bundle
20
23
  ```
21
24
 
22
25
  ## Features
@@ -26,10 +29,10 @@ $ bundle
26
29
  This feature allows an admin to create pages to serve static content. Some
27
30
  example of this kind of pages could be:
28
31
 
29
- * Terms and Conditions
30
- * FAQ
31
- * Accessibility guidelines
32
- * About the project
32
+ * Terms and Conditions
33
+ * FAQ
34
+ * Accessibility guidelines
35
+ * About the project
33
36
 
34
37
  All the pages can be created with I18n support and will be accessible as
35
38
  `/pages/:page-slug`. You can link them at your website the same way you link
@@ -40,7 +43,9 @@ are links to them inside the Decidim framework, see `Decidim::StaticPage` for
40
43
  the default list.
41
44
 
42
45
  ## Contributing
46
+
43
47
  See [Decidim](https://github.com/decidim/decidim).
44
48
 
45
49
  ## License
50
+
46
51
  See [Decidim](https://github.com/decidim/decidim).
@@ -1,6 +1,6 @@
1
1
  // = require jquery
2
- // = require jquery_ujs
3
2
  // = require foundation
3
+ // = require rails-ujs
4
4
  // = require ./tab_focus
5
5
  // = require ./toggle_nav
6
6
  // = require ./sort_list.component
@@ -20,9 +20,7 @@
20
20
 
21
21
  .button--title{
22
22
  margin-bottom: 0;
23
- @include breakpoint(mediumlarge){
24
- float: right;
25
- }
23
+ float: right;
26
24
  &:not(:first-child){
27
25
  margin-right: 1rem;
28
26
  }
@@ -33,12 +31,10 @@
33
31
  .button:not(:last-child){
34
32
  margin-right: 1rem;
35
33
  }
36
- @include breakpoint(mediumlarge){
37
- display: flex;
38
- align-items: center;
39
- .button{
40
- margin-bottom: 0;
41
- }
34
+ display: flex;
35
+ align-items: center;
36
+ .button{
37
+ margin-bottom: 0;
42
38
  }
43
39
  }
44
40
 
@@ -4,6 +4,7 @@ $card-padding-small: 1rem;
4
4
  @include smallcaps;
5
5
  font-size: 1rem;
6
6
  @include clearfix;
7
+ width: 100%;
7
8
  }
8
9
 
9
10
  .card-footer{
@@ -22,3 +22,4 @@
22
22
  @import "action-icon";
23
23
  @import "char-counter";
24
24
  @import "component-counter";
25
+ @import "pics";
@@ -0,0 +1,5 @@
1
+ .thumbnail-list{
2
+ @include thumbnail;
3
+
4
+ margin-bottom: 0;
5
+ }
@@ -38,6 +38,13 @@
38
38
  }
39
39
  }
40
40
 
41
+ &.table-list--lastleft{
42
+ th:last-child,
43
+ td:last-child{
44
+ text-align: left;
45
+ }
46
+ }
47
+
41
48
  a:not(.button){
42
49
  color: $body-font-color;
43
50
  &:hover{
@@ -45,7 +45,7 @@ module Decidim
45
45
 
46
46
  def authorized_user?
47
47
  form.authorization.user = @user
48
- AuthorizeUser.call(form.authorization) do
48
+ Verifications::AuthorizeUser.call(form.authorization) do
49
49
  on(:ok) do
50
50
  return true
51
51
  end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Admin
5
+ class AuthorizationWorkflowsController < Decidim::Admin::ApplicationController
6
+ layout "decidim/admin/users"
7
+
8
+ def index
9
+ authorize! :index, :authorization_workflows
10
+
11
+ @workflows = Decidim::Verifications.admin_workflows
12
+ end
13
+ end
14
+ end
15
+ end
@@ -46,7 +46,9 @@ module Decidim
46
46
  end
47
47
 
48
48
  def authorizations
49
- current_organization.available_authorizations.map(&:constantize).map(&:handler_name)
49
+ Verifications::Adapter.from_collection(
50
+ current_organization.available_authorizations
51
+ )
50
52
  end
51
53
 
52
54
  def feature
@@ -11,7 +11,7 @@ module Decidim
11
11
  extend(Virtus.model)
12
12
 
13
13
  # Set the authorization dynamic attribute as a nested form class based on the handler name.
14
- attribute(:authorization, attributes.dig(:authorization, :handler_name).classify.constantize)
14
+ attribute(:authorization, Decidim::AuthorizationHandler.handler_for(attributes.dig(:authorization, :handler_name)))
15
15
 
16
16
  super
17
17
  end
@@ -16,7 +16,7 @@ module Decidim
16
16
  extend(Virtus.model)
17
17
 
18
18
  # Set the authorization dynamic attribute as a nested form class based on the handler name.
19
- attribute(:authorization, attributes.dig(:authorization, :handler_name).classify.constantize)
19
+ attribute(:authorization, Decidim::AuthorizationHandler.handler_for(attributes.dig(:authorization, :handler_name)))
20
20
 
21
21
  super
22
22
  end
@@ -29,7 +29,7 @@ module Decidim
29
29
  translatable_attribute :description, String
30
30
  translatable_attribute :welcome_text, String
31
31
 
32
- validates :cta_button_path, format: { with: %r{\A[a-zA-Z]+[a-zA-Z0-9-/]+\z} }, allow_blank: true
32
+ validates :cta_button_path, format: { with: %r{\A[a-zA-Z]+[a-zA-Z0-9\-/]+\z} }, allow_blank: true
33
33
  validates :official_img_header,
34
34
  :official_img_footer,
35
35
  :homepage_image,
@@ -18,12 +18,14 @@ module Decidim
18
18
  link_to(link,
19
19
  method: options[:method],
20
20
  class: "action-icon #{options[:class]}",
21
- data: { tooltip: true, disable_hover: false }.merge(options[:data] || {}),
22
- tooltip: true,
23
- disable_hover: false,
21
+ data: options[:data] || {},
24
22
  title: title,
25
23
  target: options[:target]) do
26
- icon(icon_name)
24
+ content_tag(:span, class: "simple-has-tip",
25
+ data: { tooltip: true, disable_hover: false, click_open: false },
26
+ title: title) do
27
+ icon(icon_name)
28
+ end
27
29
  end
28
30
  end
29
31
  end
@@ -45,6 +45,9 @@ module Decidim
45
45
  end
46
46
 
47
47
  can [:index, :verify, :reject], UserGroup
48
+
49
+ can :index, :authorization_workflows
50
+ can [:index, :update], Authorization
48
51
  end
49
52
 
50
53
  private
@@ -0,0 +1,32 @@
1
+ <div class="card">
2
+ <div class="card-divider">
3
+ <h2 class="card-title">
4
+ <%= t("decidim.admin.titles.authorization_workflows") %>
5
+ </h2>
6
+ </div>
7
+ <div class="card-section">
8
+ <table class="table-list table-list--lastleft">
9
+ <thead>
10
+ <tr>
11
+ <th><%= t("decidim.authorization_handlers.name") %></th>
12
+ <th><%= t("decidim.authorization_handlers.help") %></th>
13
+ </tr>
14
+ </thead>
15
+ <tbody>
16
+ <% @workflows.each do |manifest| %>
17
+ <tr>
18
+ <% workflow = Decidim::Verifications::Adapter.new(manifest) %>
19
+ <td><%= link_to workflow.fullname, workflow.admin_root_path %></td>
20
+ <td>
21
+ <ul>
22
+ <% t("decidim.authorization_handlers.admin.#{workflow.key}.help").each do |tip| %>
23
+ <li><%= tip %></li>
24
+ <% end %>
25
+ </ul>
26
+ </td>
27
+ </tr>
28
+ <% end %>
29
+ </tbody>
30
+ </table>
31
+ </div>
32
+ </div>
@@ -1,5 +1,5 @@
1
1
  <span class="exports dropdown tiny button button--simple" data-toggle="export-dropdown"><%= t "actions.export", scope: "decidim.admin" %></span>
2
- <div class="dropdown-pane" id="export-dropdown" data-dropdown data-auto-focus="true" data-close-on-click="true">
2
+ <div class="dropdown-pane" id="export-dropdown" data-dropdown data-position=bottom data-alignment=right data-auto-focus="true" data-close-on-click="true">
3
3
  <ul class="vertical menu add-features">
4
4
  <% feature.manifest.export_manifests.each do |manifest| %>
5
5
  <% %w{CSV JSON Excel}.each do |format| %>
@@ -14,7 +14,7 @@
14
14
  <div class="card-section">
15
15
  <%= form.select :authorization_handler_name,
16
16
  authorizations.map { |authorization|
17
- [t("#{authorization}.name", scope: "decidim.authorization_handlers"), authorization]
17
+ [authorization.description, authorization.key]
18
18
  }, include_blank: t(".everyone") %>
19
19
  <%= form.text_field :options %>
20
20
  </div>
@@ -34,9 +34,7 @@
34
34
  </td>
35
35
  <td>
36
36
  <%=
37
- link_to moderation.reportable.reported_content_url, target: "_blank" do
38
- (moderation.reportable.reported_content_url + " " + icon("external-link")).html_safe
39
- end
37
+ link_to t("models.moderation.fields.visit_url", scope: "decidim.moderations"), moderation.reportable.reported_content_url
40
38
  %>
41
39
  </td>
42
40
  <td>
@@ -3,7 +3,7 @@
3
3
  </div>
4
4
 
5
5
  <div class="row column">
6
- <%= form.translated :editor, :body %>
6
+ <%= form.translated :editor, :body, toolbar: "basic-no-video" %>
7
7
  </div>
8
8
 
9
9
  <div class="row column">
@@ -30,19 +30,13 @@
30
30
  </td>
31
31
  <td class="table-list__actions">
32
32
  <% if can?(:update, newsletter) && !newsletter.sent? %>
33
- <%= link_to decidim_admin.edit_newsletter_path(newsletter), data: { tooltip: true, disable_hover: false }, :'aria-haspopup' => true, title: t("actions.edit", scope: "decidim.admin"), class: "action-icon edit" do %>
34
- <%= icon "pencil" %>
35
- <% end %>
33
+ <%= icon_link_to "pencil", decidim_admin.edit_newsletter_path(newsletter), t("actions.edit", scope: "decidim.admin"), class: "edit" %>
36
34
  <% end %>
37
35
 
38
- <%= link_to decidim_admin.newsletter_path(newsletter), data: { tooltip: true, disable_hover: false }, :'aria-haspopup' => true, title: t("actions.preview", scope: "decidim.admin"), class: "action-icon preview" do %>
39
- <%= icon "eye" %>
40
- <% end %>
36
+ <%= icon_link_to "eye", decidim_admin.newsletter_path(newsletter), t("actions.preview", scope: "decidim.admin"), class: "preview" %>
41
37
 
42
38
  <% if can?(:destroy, newsletter) && !newsletter.sent? %>
43
- <%= link_to decidim_admin.newsletter_path(newsletter), method: :delete, data: { confirm: t(".confirm_delete"), tooltip: true, disable_hover: false }, :'aria-haspopup' => true, title: t("actions.destroy", scope: "decidim.admin"), class: "action-icon action-icon--remove" do %>
44
- <%= icon "circle-x" %>
45
- <% end %>
39
+ <%= icon_link_to "circle-x", decidim_admin.newsletter_path(newsletter), t("actions.destroy", scope: "decidim.admin"), method: :delete, data: { confirm: t(".confirm_delete") }, class: "action-icon--remove" %>
46
40
  <% end %>
47
41
  </td>
48
42
  </tr>
@@ -17,6 +17,18 @@
17
17
  <li <% if is_active_link?(decidim_admin.managed_users_path) %> class="is-active" <% end %>>
18
18
  <%= link_to t("menu.managed_users", scope: "decidim.admin"), decidim_admin.managed_users_path %>
19
19
  </li>
20
+ <li <% if is_active_link?(decidim_admin.authorization_workflows_path) %> class="is-active" <% end %>>
21
+ <%= link_to t("menu.authorization_workflows", scope: "decidim.admin"), decidim_admin.authorization_workflows_path %>
22
+ <ul>
23
+ <% Decidim::Verifications.admin_workflows.each do |manifest| %>
24
+ <% workflow = Decidim::Verifications::Adapter.new(manifest) %>
25
+
26
+ <li <% if is_active_link?(workflow.admin_root_path) %> class="is-active" <% end %>>
27
+ <%= link_to workflow.fullname, workflow.admin_root_path %>
28
+ </li>
29
+ <% end %>
30
+ </ul>
31
+ </li>
20
32
  </ul>
21
33
  </div>
22
34
  <% end %>
@@ -13,6 +13,7 @@ ca:
13
13
  feature:
14
14
  name: Nom
15
15
  weight: Pes
16
+ id: ID
16
17
  newsletter:
17
18
  body: Cos
18
19
  subject: Assumpte
@@ -132,7 +133,7 @@ ca:
132
133
  success: Categoria actualitzada correctament.
133
134
  dashboard:
134
135
  show:
135
- welcome: Benvingut al nou panell d'administració de Decidim.
136
+ welcome: Benvingut al tauler d'administració de Decidim.
136
137
  exports:
137
138
  export_as: "%{name} com a %{export_format}"
138
139
  notice: La teva exportació està actualment en curs. Rebràs un correu electrònic quan hagi finalitzat.
@@ -386,6 +387,7 @@ ca:
386
387
  error: S'ha produït un error en l'actualització d'aquests pàgina.
387
388
  success: La pàgina s'ha actualitzat correctament.
388
389
  titles:
390
+ authorization_workflows: Mètodes de verificació
389
391
  dashboard: Tauler de control
390
392
  impersonations: Suplantacions
391
393
  managed_users: Usuaris gestionats
@@ -451,6 +453,7 @@ ca:
451
453
  reportable: Tipus
452
454
  reported_content_url: URL contingut del contingut reportat
453
455
  reports: Denúncies
456
+ visit_url: Visiteu l'URL
454
457
  errors:
455
458
  messages:
456
459
  invalid_json: JSON no vàlid
@@ -13,6 +13,7 @@ en:
13
13
  feature:
14
14
  name: Name
15
15
  weight: Weight
16
+ id: ID
16
17
  newsletter:
17
18
  body: Body
18
19
  subject: Subject
@@ -132,7 +133,7 @@ en:
132
133
  success: Category updated successfully.
133
134
  dashboard:
134
135
  show:
135
- welcome: Welcome to the new Decidim Panel Admin.
136
+ welcome: Welcome to the Decidim Admin Panel.
136
137
  exports:
137
138
  export_as: "%{name} as %{export_format}"
138
139
  notice: Your export is currently in progress. You'll receive an email when it's complete.
@@ -386,6 +387,7 @@ en:
386
387
  error: There was an error when updating this page.
387
388
  success: Page updated successfully
388
389
  titles:
390
+ authorization_workflows: Verification methods
389
391
  dashboard: Dashboard
390
392
  impersonations: Impersonations
391
393
  managed_users: Managed users
@@ -451,6 +453,7 @@ en:
451
453
  reportable: Reportable
452
454
  reported_content_url: Reported content URL
453
455
  reports: Reports
456
+ visit_url: Visit URL
454
457
  errors:
455
458
  messages:
456
459
  invalid_json: Invalid JSON
@@ -13,6 +13,7 @@ es:
13
13
  feature:
14
14
  name: Nombre
15
15
  weight: Peso
16
+ id: ID
16
17
  newsletter:
17
18
  body: Cuerpo
18
19
  subject: Asunto
@@ -132,7 +133,7 @@ es:
132
133
  success: Categoría actualizada correctamente.
133
134
  dashboard:
134
135
  show:
135
- welcome: Bienvenido al nuevo panel de administración de Decidim.
136
+ welcome: Bienvenido al panel de administración de Decidim.
136
137
  exports:
137
138
  export_as: "%{name} como %{export_format}"
138
139
  notice: Su exportación está actualmente en curso. Recibirá un correo electrónico cuando esté completo.
@@ -386,6 +387,7 @@ es:
386
387
  error: Se ha producido un error en la actualización de ésta página.
387
388
  success: La página se ha actualizado correctamente.
388
389
  titles:
390
+ authorization_workflows: Métodos de verificación
389
391
  dashboard: Panel de control
390
392
  impersonations: Suplantaciones
391
393
  managed_users: Usuarios gestionados
@@ -451,6 +453,7 @@ es:
451
453
  reportable: Tipo
452
454
  reported_content_url: URL del contenido reportado
453
455
  reports: Denuncias
456
+ visit_url: Visita la URL
454
457
  errors:
455
458
  messages:
456
459
  invalid_json: JSON no válido