decidim-admin 0.5.1 → 0.6.0

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 (113) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -7
  3. data/app/assets/javascripts/decidim/admin/application.js.es6 +0 -1
  4. data/app/assets/stylesheets/decidim/admin/extra/_quill.scss +5 -0
  5. data/app/commands/decidim/admin/create_category.rb +4 -4
  6. data/app/commands/decidim/admin/create_feature.rb +7 -7
  7. data/app/commands/decidim/admin/create_managed_user.rb +0 -2
  8. data/app/commands/decidim/admin/update_organization.rb +1 -0
  9. data/app/controllers/decidim/admin/application_controller.rb +0 -2
  10. data/app/controllers/decidim/admin/categories_controller.rb +10 -10
  11. data/app/controllers/decidim/admin/exports_controller.rb +1 -2
  12. data/app/controllers/decidim/admin/feature_permissions_controller.rb +2 -3
  13. data/app/controllers/decidim/admin/features/base_controller.rb +9 -3
  14. data/app/controllers/decidim/admin/features_controller.rb +5 -7
  15. data/app/controllers/decidim/admin/moderations_controller.rb +5 -7
  16. data/app/controllers/decidim/admin/scopes_controller.rb +12 -10
  17. data/app/controllers/decidim/admin/users_controller.rb +1 -3
  18. data/app/forms/decidim/admin/category_form.rb +2 -2
  19. data/app/forms/decidim/admin/feature_form.rb +1 -18
  20. data/app/forms/decidim/admin/organization_form.rb +1 -0
  21. data/app/helpers/decidim/admin/exports_helper.rb +10 -0
  22. data/app/models/decidim/admin/abilities/admin_ability.rb +0 -3
  23. data/app/models/decidim/admin/abilities/participatory_process_admin_ability.rb +3 -3
  24. data/app/views/decidim/admin/attachments/edit.html.erb +1 -1
  25. data/app/views/decidim/admin/attachments/new.html.erb +1 -1
  26. data/app/views/decidim/admin/categories/edit.html.erb +2 -2
  27. data/app/views/decidim/admin/categories/index.html.erb +11 -11
  28. data/app/views/decidim/admin/categories/new.html.erb +3 -3
  29. data/app/views/decidim/admin/categories/show.html.erb +2 -2
  30. data/app/views/decidim/admin/exports/_dropdown.html.erb +1 -1
  31. data/app/views/decidim/admin/features/_form.html.erb +15 -15
  32. data/app/views/decidim/admin/features/edit.html.erb +1 -1
  33. data/app/views/decidim/admin/features/new.html.erb +1 -1
  34. data/app/views/decidim/admin/moderations/index.html.erb +2 -2
  35. data/app/views/decidim/admin/organization/_form.html.erb +5 -0
  36. data/app/views/decidim/admin/users/index.html.erb +1 -1
  37. data/config/locales/ca.yml +8 -195
  38. data/config/locales/en.yml +6 -197
  39. data/config/locales/es.yml +11 -198
  40. data/config/locales/eu.yml +95 -208
  41. data/config/locales/fi.yml +168 -123
  42. data/config/locales/fr.yml +114 -191
  43. data/config/locales/it.yml +150 -168
  44. data/config/locales/nl.yml +443 -0
  45. data/config/locales/pl.yml +444 -0
  46. data/config/locales/uk.yml +451 -0
  47. data/config/routes.rb +2 -46
  48. data/lib/decidim/admin/engine.rb +0 -14
  49. data/lib/decidim/admin/test/commands/create_category_examples.rb +62 -0
  50. data/lib/decidim/admin/test/commands/destroy_category_examples.rb +46 -0
  51. data/lib/decidim/admin/test/commands/update_category_examples.rb +65 -0
  52. data/lib/decidim/admin/test/forms/category_form_examples.rb +90 -0
  53. data/lib/decidim/admin/test/manage_attachments_examples.rb +2 -2
  54. data/lib/decidim/admin/test/manage_feature_permissions_examples.rb +41 -0
  55. metadata +27 -64
  56. data/app/assets/javascripts/decidim/admin/participatory_processes.js.es6 +0 -12
  57. data/app/commands/decidim/admin/activate_participatory_process_step.rb +0 -44
  58. data/app/commands/decidim/admin/copy_participatory_process.rb +0 -113
  59. data/app/commands/decidim/admin/create_participatory_process.rb +0 -78
  60. data/app/commands/decidim/admin/create_participatory_process_admin.rb +0 -93
  61. data/app/commands/decidim/admin/create_participatory_process_group.rb +0 -55
  62. data/app/commands/decidim/admin/create_participatory_process_step.rb +0 -47
  63. data/app/commands/decidim/admin/deactivate_participatory_process_step.rb +0 -36
  64. data/app/commands/decidim/admin/destroy_participatory_process_step.rb +0 -44
  65. data/app/commands/decidim/admin/publish_participatory_process.rb +0 -32
  66. data/app/commands/decidim/admin/reorder_participatory_process_steps.rb +0 -52
  67. data/app/commands/decidim/admin/unpublish_participatory_process.rb +0 -32
  68. data/app/commands/decidim/admin/update_participatory_process.rb +0 -74
  69. data/app/commands/decidim/admin/update_participatory_process_admin.rb +0 -41
  70. data/app/commands/decidim/admin/update_participatory_process_group.rb +0 -58
  71. data/app/commands/decidim/admin/update_participatory_process_step.rb +0 -49
  72. data/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +0 -20
  73. data/app/controllers/decidim/admin/participatory_process_attachments_controller.rb +0 -25
  74. data/app/controllers/decidim/admin/participatory_process_copies_controller.rb +0 -33
  75. data/app/controllers/decidim/admin/participatory_process_groups_controller.rb +0 -86
  76. data/app/controllers/decidim/admin/participatory_process_publications_controller.rb +0 -43
  77. data/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb +0 -37
  78. data/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb +0 -27
  79. data/app/controllers/decidim/admin/participatory_process_steps_controller.rb +0 -89
  80. data/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +0 -97
  81. data/app/controllers/decidim/admin/participatory_processes_controller.rb +0 -96
  82. data/app/forms/decidim/admin/participatory_process_copy_form.rb +0 -33
  83. data/app/forms/decidim/admin/participatory_process_form.rb +0 -69
  84. data/app/forms/decidim/admin/participatory_process_group_form.rb +0 -24
  85. data/app/forms/decidim/admin/participatory_process_step_form.rb +0 -35
  86. data/app/forms/decidim/admin/participatory_process_user_role_form.rb +0 -29
  87. data/app/helpers/decidim/admin/process_groups_for_select_helper.rb +0 -21
  88. data/app/helpers/decidim/admin/processes_for_select_helper.rb +0 -23
  89. data/app/queries/decidim/admin/process_admins.rb +0 -44
  90. data/app/views/decidim/admin/participatory_process_copies/_form.html.erb +0 -38
  91. data/app/views/decidim/admin/participatory_process_copies/new.html.erb +0 -7
  92. data/app/views/decidim/admin/participatory_process_groups/_form.html.erb +0 -17
  93. data/app/views/decidim/admin/participatory_process_groups/edit.html.erb +0 -19
  94. data/app/views/decidim/admin/participatory_process_groups/index.html.erb +0 -44
  95. data/app/views/decidim/admin/participatory_process_groups/new.html.erb +0 -13
  96. data/app/views/decidim/admin/participatory_process_groups/show.html.erb +0 -23
  97. data/app/views/decidim/admin/participatory_process_steps/_form.html.erb +0 -25
  98. data/app/views/decidim/admin/participatory_process_steps/edit.html.erb +0 -8
  99. data/app/views/decidim/admin/participatory_process_steps/index.html.erb +0 -63
  100. data/app/views/decidim/admin/participatory_process_steps/new.html.erb +0 -7
  101. data/app/views/decidim/admin/participatory_process_steps/show.html.erb +0 -18
  102. data/app/views/decidim/admin/participatory_process_user_roles/_form.html.erb +0 -22
  103. data/app/views/decidim/admin/participatory_process_user_roles/edit.html.erb +0 -7
  104. data/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +0 -65
  105. data/app/views/decidim/admin/participatory_process_user_roles/new.html.erb +0 -7
  106. data/app/views/decidim/admin/participatory_processes/_form.html.erb +0 -101
  107. data/app/views/decidim/admin/participatory_processes/edit.html.erb +0 -19
  108. data/app/views/decidim/admin/participatory_processes/index.html.erb +0 -66
  109. data/app/views/decidim/admin/participatory_processes/new.html.erb +0 -11
  110. data/app/views/layouts/decidim/admin/participatory_process.html.erb +0 -64
  111. data/app/views/layouts/decidim/admin/participatory_process_groups.html.erb +0 -14
  112. data/app/views/layouts/decidim/admin/participatory_processes.html.erb +0 -14
  113. data/config/i18n-tasks.yml +0 -132
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Admin
5
- # A form object used to copy a participatory processes from the admin
6
- # dashboard.
7
- #
8
- class ParticipatoryProcessCopyForm < Form
9
- include TranslatableAttributes
10
-
11
- translatable_attribute :title, String
12
-
13
- mimic :participatory_process
14
-
15
- attribute :slug, String
16
- attribute :copy_steps, Boolean
17
- attribute :copy_categories, Boolean
18
- attribute :copy_features, Boolean
19
-
20
- validates :slug, presence: true
21
- validates :title, translatable_presence: true
22
- validate :slug, :slug_uniqueness
23
-
24
- private
25
-
26
- def slug_uniqueness
27
- return unless OrganizationParticipatoryProcesses.new(current_organization).query.where(slug: slug).where.not(id: id).any?
28
-
29
- errors.add(:slug, :taken)
30
- end
31
- end
32
- end
33
- end
@@ -1,69 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Admin
5
- # A form object used to create participatory processes from the admin
6
- # dashboard.
7
- #
8
- class ParticipatoryProcessForm < Form
9
- include TranslatableAttributes
10
-
11
- translatable_attribute :title, String
12
- translatable_attribute :subtitle, String
13
- translatable_attribute :description, String
14
- translatable_attribute :short_description, String
15
- translatable_attribute :meta_scope, String
16
- translatable_attribute :developer_group, String
17
- translatable_attribute :local_area, String
18
- translatable_attribute :target, String
19
- translatable_attribute :participatory_scope, String
20
- translatable_attribute :participatory_structure, String
21
- translatable_attribute :announcement, String
22
-
23
- mimic :participatory_process
24
-
25
- attribute :end_date, Date
26
- attribute :slug, String
27
- attribute :hashtag, String
28
- attribute :promoted, Boolean
29
- attribute :scopes_enabled, Boolean
30
- attribute :scope_id, Integer
31
- attribute :hero_image
32
- attribute :remove_hero_image
33
- attribute :banner_image
34
- attribute :remove_banner_image
35
- attribute :participatory_process_group_id, Integer
36
- attribute :show_statistics, Boolean
37
-
38
- validates :slug, presence: true
39
- validates :title, :subtitle, :description, :short_description, translatable_presence: true
40
- validates :scope, presence: true, if: proc { |object| object.scope_id.present? }
41
-
42
- validate :slug, :slug_uniqueness
43
-
44
- validates :hero_image, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } }, file_content_type: { allow: ["image/jpeg", "image/png"] }
45
- validates :banner_image, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } }, file_content_type: { allow: ["image/jpeg", "image/png"] }
46
-
47
- def map_model(model)
48
- self.scope_id = model.decidim_scope_id
49
- self.participatory_process_group_id = model.decidim_participatory_process_group_id
50
- end
51
-
52
- def scope
53
- @scope ||= current_organization.scopes.where(id: scope_id).first
54
- end
55
-
56
- def participatory_process_group
57
- Decidim::ParticipatoryProcessGroup.where(id: participatory_process_group_id).first
58
- end
59
-
60
- private
61
-
62
- def slug_uniqueness
63
- return unless OrganizationParticipatoryProcesses.new(current_organization).query.where(slug: slug).where.not(id: id).any?
64
-
65
- errors.add(:slug, :taken)
66
- end
67
- end
68
- end
69
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Admin
5
- # A form object used to create participatory process groups from the admin
6
- # dashboard.
7
- #
8
- class ParticipatoryProcessGroupForm < Form
9
- include TranslatableAttributes
10
-
11
- translatable_attribute :name, String
12
- translatable_attribute :description, String
13
- attribute :participatory_process_ids, Array[Integer]
14
-
15
- mimic :participatory_process_group
16
-
17
- attribute :hero_image
18
-
19
- validates :name, :description, translatable_presence: true
20
-
21
- validates :hero_image, file_size: { less_than_or_equal_to: ->(_record) { Decidim.maximum_attachment_size } }, file_content_type: { allow: ["image/jpeg", "image/png"] }
22
- end
23
- end
24
- end
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Admin
5
- # A form object used to create participatory processes steps from the admin
6
- # dashboard.
7
- #
8
- class ParticipatoryProcessStepForm < Form
9
- include TranslatableAttributes
10
-
11
- translatable_attribute :title, String
12
- translatable_attribute :description, String
13
-
14
- mimic :participatory_process_step
15
-
16
- attribute :start_date, DateTime
17
- attribute :end_date, DateTime
18
-
19
- validates :title, translatable_presence: true
20
-
21
- validates :start_date, date: { before: :end_date, allow_blank: true, if: proc { |obj| obj.end_date.present? } }
22
- validates :end_date, date: { after: :start_date, allow_blank: true, if: proc { |obj| obj.start_date.present? } }
23
-
24
- def start_date
25
- return nil unless super.respond_to?(:at_midnight)
26
- super.at_midnight
27
- end
28
-
29
- def end_date
30
- return nil unless super.respond_to?(:at_midnight)
31
- super.at_midnight
32
- end
33
- end
34
- end
35
- end
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Admin
5
- # A form object used to create participatory process user roles from the
6
- # admin dashboard.
7
- #
8
- class ParticipatoryProcessUserRoleForm < Form
9
- mimic :participatory_process_user_role
10
-
11
- attribute :name, String
12
- attribute :email, String
13
- attribute :role, String
14
-
15
- validates :email, :role, presence: true
16
- validates :name, presence: true
17
- validates :role, inclusion: { in: Decidim::ParticipatoryProcessUserRole::ROLES }
18
-
19
- def roles
20
- Decidim::ParticipatoryProcessUserRole::ROLES.map do |role|
21
- [
22
- I18n.t(role, scope: "decidim.admin.models.participatory_process_user_role.roles"),
23
- role
24
- ]
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Admin
5
- # This class contains helpers needed to format ParticipatoryProcessGroups
6
- # in order to use them in select forms.
7
- #
8
- module ProcessGroupsForSelectHelper
9
- # Public: A formatted collection of ParticipatoryProcessGroups to be used
10
- # in forms.
11
- #
12
- # Returns an Array.
13
- def process_groups_for_select
14
- @process_groups_for_select ||=
15
- OrganizationParticipatoryProcessGroups.new(current_organization).map do |group|
16
- [translated_attribute(group.name), group.id]
17
- end
18
- end
19
- end
20
- end
21
- end
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Admin
5
- # This class contains helpers needed to format ParticipatoryProcesses
6
- # in order to use them in select forms.
7
- #
8
- module ProcessesForSelectHelper
9
- # Public: A formatted collection of ParticipatoryProcesses to be used
10
- # in forms.
11
- #
12
- # Returns an Array.
13
- def processes_for_select
14
- @processes_for_select ||= OrganizationParticipatoryProcesses.new(current_organization).map do |process|
15
- [
16
- translated_attribute(process.title),
17
- process.id
18
- ]
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,44 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Decidim
4
- module Admin
5
- # A class used to find the admins for a participatory process including
6
- # organization admins.
7
- class ProcessAdmins < Rectify::Query
8
- # Syntactic sugar to initialize the class and return the queried objects.
9
- #
10
- # process - a process that needs to find its process admins
11
- def self.for(process)
12
- new(process).query
13
- end
14
-
15
- # Initializes the class.
16
- #
17
- # process - a process that needs to find its process admins
18
- def initialize(process)
19
- @process = process
20
- end
21
-
22
- # Finds organization admins and the users with role admin for the given process.
23
- #
24
- # Returns an ActiveRecord::Relation.
25
- def query
26
- Decidim::User.where(id: organization_admins).or(Decidim::User.where(id: process_admins))
27
- end
28
-
29
- private
30
-
31
- attr_reader :process
32
-
33
- def organization_admins
34
- process.organization.admins
35
- end
36
-
37
- def process_admins
38
- Decidim::ParticipatoryProcessUserRole
39
- .where(participatory_process: process, role: :admin)
40
- .pluck(:decidim_user_id)
41
- end
42
- end
43
- end
44
- end
@@ -1,38 +0,0 @@
1
- <div class="card" id="processes">
2
- <div class="card-divider">
3
- <h2 class="card-title"><%= title %></h2>
4
- </div>
5
-
6
- <div class="card-section">
7
- <div class="row column">
8
- <div class="row">
9
- <div class="column xlarge-8">
10
- <%= form.translated :text_field, :title, autofocus: true %>
11
- </div>
12
- <div class="column xlarge-4">
13
- <%= form.text_field :slug %>
14
- </div>
15
- </div>
16
- <div class="card">
17
- <div class="card-divider">
18
- <legend><%= select %></legend>
19
- </div>
20
- <div class="card-section">
21
- <div class="row">
22
- <div class="columns xlarge-3">
23
- <%= form.check_box :copy_steps %>
24
- </div>
25
-
26
- <div class="columns xlarge-3">
27
- <%= form.check_box :copy_categories %>
28
- </div>
29
-
30
- <div class="columns xlarge-6">
31
- <%= form.check_box :copy_features %>
32
- </div>
33
- </div>
34
- </div>
35
- </div>
36
- </div>
37
- </div>
38
- </div>
@@ -1,7 +0,0 @@
1
- <%= decidim_form_for(@form, url: participatory_process_copies_path(current_participatory_process), method: :post, html: { class: "form copy_participatory_process" }) do |f| %>
2
- <%= render partial: 'form', object: f, locals: { title: t('.title'), select: t('.select')} %>
3
-
4
- <div class="button--double form-general-submit">
5
- <%= f.submit t(".copy") %>
6
- </div>
7
- <% end %>
@@ -1,17 +0,0 @@
1
- <div class="row column">
2
- <%= form.translated :text_field, :name, autofocus: true %>
3
- </div>
4
-
5
- <div class="row column">
6
- <%= form.translated :editor, :description, toolbar: :full, lines: 25 %>
7
- </div>
8
-
9
- <div class="row column">
10
- <% if processes_for_select %>
11
- <%= form.select :participatory_process_ids, processes_for_select, {}, { multiple: true, class: "chosen-select" } %>
12
- <% end %>
13
- </div>
14
-
15
- <div class="row column">
16
- <%= form.upload :hero_image %>
17
- </div>
@@ -1,19 +0,0 @@
1
-
2
- <%= decidim_form_for(@form, html: { class: "form edit_participatory_process_group" }) do |f| %>
3
- <div class="card">
4
- <div class="card-divider">
5
- <h2 class="card-title">
6
- <%= t ".title" %>
7
- <% if can? :destroy, participatory_process_group %>
8
- <%= link_to t("decidim.admin.actions.destroy"), participatory_process_group, method: :delete, class: 'button alert tiny button--title destroy', data: { confirm: t("decidim.admin.actions.confirm_destroy") } %>
9
- <% end %>
10
- </h2>
11
- </div>
12
- <div class="card-section">
13
- <%= render partial: 'form', object: f %>
14
- </div>
15
- </div>
16
- <div class="button--double form-general-submit">
17
- <%= f.submit t(".update") %>
18
- </div>
19
- <% end %>
@@ -1,44 +0,0 @@
1
- <div class="card">
2
- <div class="card-divider">
3
- <h2 class="card-title">
4
- <%= t "decidim.admin.titles.participatory_process_groups" %>
5
- <%= link_to t("actions.new", scope: "decidim.admin", name: t("models.participatory_process_group.name", scope: "decidim.admin")), ['new', 'participatory_process_group'], class: 'button tiny button--title new' if can? :create, Decidim::ParticipatoryProcessGroup %>
6
- </h2>
7
- </div>
8
- <div class="card-section">
9
- <div class="table-scroll">
10
- <table class="table-list">
11
- <thead>
12
- <tr>
13
- <th><%= t("models.participatory_process_group.fields.name", scope: "decidim.admin") %></th>
14
- <th></th>
15
- </tr>
16
- </thead>
17
- <tbody>
18
- <% collection.each do |group| %>
19
- <tr>
20
- <td>
21
- <% if can? :update, group %>
22
- <%= link_to translated_attribute(group.name), ['edit', group] %><br />
23
- <% else %>
24
- <%= translated_attribute(group.name) %>
25
- <% end %>
26
- </td>
27
- <td class="table-list__actions">
28
- <% if can? :update, group %>
29
- <%= icon_link_to "pencil", ['edit', group], t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
30
- <% end %>
31
-
32
- <%= icon_link_to "eye", decidim.participatory_process_group_path(group), t("actions.preview", scope: "decidim.admin"), class: "action-icon--preview" %>
33
-
34
- <% if can? :destroy, group %>
35
- <%= icon_link_to "circle-x", group, t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
36
- <% end %>
37
- </td>
38
- </tr>
39
- <% end %>
40
- </tbody>
41
- </table>
42
- </div>
43
- </div>
44
- </div>
@@ -1,13 +0,0 @@
1
- <%= decidim_form_for(@form, html: { class: "form new_participatory_process_group" }) do |f| %>
2
- <div class="card">
3
- <div class="card-divider">
4
- <h2 class="card-title"><%= t ".title" %></h2>
5
- </div>
6
- <div class="card-section">
7
- <%= render partial: 'form', object: f %>
8
- </div>
9
- </div>
10
- <div class="button--double form-general-submit">
11
- <%= f.submit t(".create") %>
12
- </div>
13
- <% end %>
@@ -1,23 +0,0 @@
1
- <dl>
2
- <%= display_for participatory_process_group,
3
- :name,
4
- :description
5
- %>
6
-
7
- <dt><%= display_label(participatory_process_group, :participatory_processes) %></dt>
8
- <% if participatory_process_group.participatory_processes.any? %>
9
- <dd>
10
- <ul>
11
- <% participatory_process_group.participatory_processes.each do |participatory_process| %>
12
- <li><%= translated_attribute participatory_process.title %></li>
13
- <% end %>
14
- </ul>
15
- </dd>
16
- <% end %>
17
- <dt><%= display_label(participatory_process_group, :hero_image) %></dt>
18
- <dd>
19
- <% if participatory_process_group.hero_image? %>
20
- <%= image_tag participatory_process_group.hero_image.url.to_s %>
21
- <% end %>
22
- </dd>
23
- </dl>