decidim-admin 0.4.4 → 0.5.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/decidim/admin/application.js.es6 +3 -0
- data/app/assets/javascripts/decidim/admin/participatory_processes.js.es6 +12 -0
- data/app/assets/javascripts/decidim/admin/scopes.js.es6 +20 -0
- data/app/assets/javascripts/decidim/admin/select2.js.es6 +8 -0
- data/app/assets/stylesheets/decidim/admin/_decidim.scss +2 -0
- data/app/assets/stylesheets/decidim/admin/extra/_categories.scss +1 -1
- data/app/assets/stylesheets/decidim/admin/extra/_login.scss +1 -1
- data/app/assets/stylesheets/decidim/admin/extra/_sort.scss +1 -1
- data/app/assets/stylesheets/decidim/admin/modules/_buttons.scss +3 -0
- data/app/assets/stylesheets/decidim/admin/modules/_callouts.scss +0 -1
- data/app/assets/stylesheets/decidim/admin/modules/_cards.scss +47 -0
- data/app/assets/stylesheets/decidim/admin/modules/_secondary-nav.scss +2 -2
- data/app/assets/stylesheets/decidim/admin/modules/_typography.scss +1 -1
- data/app/assets/stylesheets/decidim/admin/plugins/_select2.scss +27 -0
- data/app/assets/stylesheets/decidim/admin/utils/_toggle-expand.scss +1 -1
- data/app/commands/decidim/admin/close_session_managed_user.rb +44 -0
- data/app/commands/decidim/admin/create_feature.rb +2 -1
- data/app/commands/decidim/admin/create_managed_user.rb +61 -0
- data/app/commands/decidim/admin/create_scope.rb +7 -2
- data/app/commands/decidim/admin/create_scope_type.rb +40 -0
- data/app/commands/decidim/admin/impersonate_managed_user.rb +61 -0
- data/app/commands/decidim/admin/promote_managed_user.rb +56 -0
- data/app/commands/decidim/admin/update_participatory_process.rb +3 -1
- data/app/commands/decidim/admin/update_scope.rb +4 -1
- data/app/commands/decidim/admin/update_scope_type.rb +45 -0
- data/app/controllers/decidim/admin/application_controller.rb +2 -1
- data/app/controllers/decidim/admin/categories_controller.rb +3 -3
- data/app/controllers/decidim/admin/exports_controller.rb +1 -1
- data/app/controllers/decidim/admin/managed_users/impersonations_controller.rb +78 -0
- data/app/controllers/decidim/admin/managed_users/promotions_controller.rb +43 -0
- data/app/controllers/decidim/admin/managed_users_controller.rb +69 -0
- data/app/controllers/decidim/admin/moderations_controller.rb +4 -4
- data/app/controllers/decidim/admin/newsletters_controller.rb +1 -1
- data/app/controllers/decidim/admin/participatory_processes_controller.rb +0 -5
- data/app/controllers/decidim/admin/scope_types_controller.rb +79 -0
- data/app/controllers/decidim/admin/scopes_controller.rb +22 -7
- data/app/controllers/decidim/admin/user_groups_controller.rb +1 -1
- data/app/controllers/decidim/admin/users_controller.rb +1 -2
- data/app/forms/decidim/admin/impersonate_managed_user_form.rb +20 -0
- data/app/forms/decidim/admin/managed_user_form.rb +35 -0
- data/app/forms/decidim/admin/managed_user_promotion_form.rb +13 -0
- data/app/forms/decidim/admin/participatory_process_form.rb +2 -0
- data/app/forms/decidim/admin/scope_form.rb +17 -6
- data/app/forms/decidim/admin/scope_type_form.rb +21 -0
- data/app/helpers/decidim/admin/scopes_helper.rb +46 -0
- data/app/helpers/decidim/admin/settings_helper.rb +12 -1
- data/app/jobs/decidim/admin/expire_impersonation_job.rb +16 -0
- data/app/models/decidim/admin/abilities/admin_ability.rb +17 -0
- data/app/models/decidim/admin/abilities/user_manager_ability.rb +30 -0
- data/app/views/decidim/admin/categories/_form.html.erb +1 -1
- data/app/views/decidim/admin/categories/edit.html.erb +1 -1
- data/app/views/decidim/admin/categories/index.html.erb +7 -7
- data/app/views/decidim/admin/categories/new.html.erb +1 -1
- data/app/views/decidim/admin/features/_form.html.erb +6 -3
- data/app/views/decidim/admin/features/_settings_fields.html.erb +2 -1
- data/app/views/decidim/admin/managed_users/_form.html.erb +12 -0
- data/app/views/decidim/admin/managed_users/impersonations/_form.html.erb +10 -0
- data/app/views/decidim/admin/managed_users/impersonations/index.html.erb +34 -0
- data/app/views/decidim/admin/managed_users/impersonations/new.html.erb +15 -0
- data/app/views/decidim/admin/managed_users/index.html.erb +44 -0
- data/app/views/decidim/admin/managed_users/new.html.erb +47 -0
- data/app/views/decidim/admin/managed_users/promotions/_form.html.erb +3 -0
- data/app/views/decidim/admin/managed_users/promotions/new.html.erb +21 -0
- data/app/views/decidim/admin/moderations/index.html.erb +4 -4
- data/app/views/decidim/admin/participatory_process_copies/_form.html.erb +1 -1
- data/app/views/decidim/admin/participatory_process_user_roles/edit.html.erb +1 -1
- data/app/views/decidim/admin/participatory_processes/_form.html.erb +13 -8
- data/app/views/decidim/admin/participatory_processes/index.html.erb +1 -1
- data/app/views/decidim/admin/scope_types/_form.html.erb +7 -0
- data/app/views/decidim/admin/scope_types/edit.html.erb +13 -0
- data/app/views/decidim/admin/scope_types/index.html.erb +40 -0
- data/app/views/decidim/admin/scope_types/new.html.erb +13 -0
- data/app/views/decidim/admin/scopes/_form.html.erb +12 -2
- data/app/views/decidim/admin/scopes/index.html.erb +19 -7
- data/app/views/decidim/admin/scopes/new.html.erb +1 -1
- data/app/views/decidim/admin/users/_form.html.erb +4 -0
- data/app/views/decidim/admin/users/index.html.erb +2 -0
- data/app/views/layouts/decidim/admin/newsletters.erb +1 -1
- data/app/views/layouts/decidim/admin/pages.html.erb +1 -1
- data/app/views/layouts/decidim/admin/participatory_process.html.erb +4 -4
- data/app/views/layouts/decidim/admin/participatory_process_groups.html.erb +1 -1
- data/app/views/layouts/decidim/admin/settings.html.erb +4 -1
- data/app/views/layouts/decidim/admin/users.html.erb +8 -3
- data/config/i18n-tasks.yml +2 -1
- data/config/locales/ca.yml +80 -3
- data/config/locales/en.yml +82 -2
- data/config/locales/es.yml +80 -3
- data/config/locales/eu.yml +44 -7
- data/config/locales/fi.yml +0 -7
- data/config/locales/fr.yml +21 -6
- data/config/locales/it.yml +0 -10
- data/config/locales/nl.yml +1 -1
- data/config/locales/pl.yml +7 -0
- data/config/routes.rb +24 -11
- data/lib/decidim/admin/engine.rb +6 -3
- data/lib/decidim/admin/test/manage_attachments_examples.rb +77 -79
- metadata +56 -9
- data/app/views/decidim/admin/participatory_processes/show.html.erb +0 -54
@@ -6,10 +6,15 @@ module Decidim
|
|
6
6
|
#
|
7
7
|
class ScopesController < Decidim::Admin::ApplicationController
|
8
8
|
layout "decidim/admin/settings"
|
9
|
+
helper_method :scope, :parent_scope, :add_scope_path, :current_scopes_path
|
9
10
|
|
10
11
|
def index
|
11
12
|
authorize! :index, Scope
|
12
|
-
@scopes =
|
13
|
+
@scopes = if parent_scope
|
14
|
+
parent_scope.children
|
15
|
+
else
|
16
|
+
collection.top_level
|
17
|
+
end
|
13
18
|
end
|
14
19
|
|
15
20
|
def new
|
@@ -20,11 +25,10 @@ module Decidim
|
|
20
25
|
def create
|
21
26
|
authorize! :new, Scope
|
22
27
|
@form = form(ScopeForm).from_params(params)
|
23
|
-
|
24
|
-
CreateScope.call(@form) do
|
28
|
+
CreateScope.call(@form, parent_scope) do
|
25
29
|
on(:ok) do
|
26
30
|
flash[:notice] = I18n.t("scopes.create.success", scope: "decidim.admin")
|
27
|
-
redirect_to
|
31
|
+
redirect_to current_scopes_path
|
28
32
|
end
|
29
33
|
|
30
34
|
on(:invalid) do
|
@@ -40,14 +44,13 @@ module Decidim
|
|
40
44
|
end
|
41
45
|
|
42
46
|
def update
|
43
|
-
@scope = collection.find(params[:id])
|
44
47
|
authorize! :update, scope
|
45
48
|
@form = form(ScopeForm).from_params(params)
|
46
49
|
|
47
50
|
UpdateScope.call(scope, @form) do
|
48
51
|
on(:ok) do
|
49
52
|
flash[:notice] = I18n.t("scopes.update.success", scope: "decidim.admin")
|
50
|
-
redirect_to
|
53
|
+
redirect_to current_scopes_path
|
51
54
|
end
|
52
55
|
|
53
56
|
on(:invalid) do
|
@@ -63,7 +66,7 @@ module Decidim
|
|
63
66
|
|
64
67
|
flash[:notice] = I18n.t("scopes.destroy.success", scope: "decidim.admin")
|
65
68
|
|
66
|
-
redirect_to
|
69
|
+
redirect_to current_scopes_path
|
67
70
|
end
|
68
71
|
|
69
72
|
private
|
@@ -72,9 +75,21 @@ module Decidim
|
|
72
75
|
@scope ||= collection.find(params[:id])
|
73
76
|
end
|
74
77
|
|
78
|
+
def parent_scope
|
79
|
+
@parent_scope ||= @scope ? @scope.parent : collection.find_by_id(params[:scope_id])
|
80
|
+
end
|
81
|
+
|
75
82
|
def collection
|
76
83
|
current_organization.scopes
|
77
84
|
end
|
85
|
+
|
86
|
+
def current_scopes_path
|
87
|
+
if parent_scope
|
88
|
+
scope_scopes_path(parent_scope)
|
89
|
+
else
|
90
|
+
scopes_path
|
91
|
+
end
|
92
|
+
end
|
78
93
|
end
|
79
94
|
end
|
80
95
|
end
|
@@ -4,7 +4,7 @@ module Decidim
|
|
4
4
|
module Admin
|
5
5
|
# Controller that allows managing user groups at the admin panel.
|
6
6
|
#
|
7
|
-
class UserGroupsController < ApplicationController
|
7
|
+
class UserGroupsController < Decidim::Admin::ApplicationController
|
8
8
|
layout "decidim/admin/users"
|
9
9
|
|
10
10
|
def index
|
@@ -21,7 +21,6 @@ module Decidim
|
|
21
21
|
default_params = {
|
22
22
|
organization: current_organization,
|
23
23
|
invitation_instructions: "invite_admin",
|
24
|
-
admin: true,
|
25
24
|
invited_by: current_user,
|
26
25
|
comments_notifications: true,
|
27
26
|
replies_notifications: true
|
@@ -81,7 +80,7 @@ module Decidim
|
|
81
80
|
end
|
82
81
|
|
83
82
|
def collection
|
84
|
-
@collection ||= current_organization.admins
|
83
|
+
@collection ||= current_organization.admins.or(current_organization.users_with_any_role)
|
85
84
|
end
|
86
85
|
end
|
87
86
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
# A form object used to impersonate managed users from the admin dashboard.
|
6
|
+
#
|
7
|
+
# This form will contain a dynamic attribute for the user authorization.
|
8
|
+
# This authorization will be selected by the admin user if more than one exists.
|
9
|
+
class ImpersonateManagedUserForm < Form
|
10
|
+
def initialize(attributes)
|
11
|
+
extend(Virtus.model)
|
12
|
+
|
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)
|
15
|
+
|
16
|
+
super
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
# A form object used to create managed users from the admin dashboard.
|
6
|
+
#
|
7
|
+
# This form will contain a dynamic attribute for the user authorization.
|
8
|
+
# This authorization will be selected by the admin user if more than one exists.
|
9
|
+
class ManagedUserForm < Form
|
10
|
+
attribute :name, String
|
11
|
+
|
12
|
+
validates :name, presence: true
|
13
|
+
validate :authorization_uniqueness
|
14
|
+
|
15
|
+
def initialize(attributes)
|
16
|
+
extend(Virtus.model)
|
17
|
+
|
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)
|
20
|
+
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def authorization_uniqueness
|
27
|
+
errors.add :authorization, :invalid if Authorization.where(
|
28
|
+
user: current_organization.users,
|
29
|
+
name: authorization.handler_name,
|
30
|
+
unique_id: authorization.unique_id
|
31
|
+
).exists?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
# A form object used to promote managed users from the admin dashboard.
|
6
|
+
#
|
7
|
+
class ManagedUserPromotionForm < Form
|
8
|
+
attribute :email, String
|
9
|
+
|
10
|
+
validates :email, presence: true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -18,6 +18,7 @@ module Decidim
|
|
18
18
|
translatable_attribute :target, String
|
19
19
|
translatable_attribute :participatory_scope, String
|
20
20
|
translatable_attribute :participatory_structure, String
|
21
|
+
translatable_attribute :announcement, String
|
21
22
|
|
22
23
|
mimic :participatory_process
|
23
24
|
|
@@ -25,6 +26,7 @@ module Decidim
|
|
25
26
|
attribute :slug, String
|
26
27
|
attribute :hashtag, String
|
27
28
|
attribute :promoted, Boolean
|
29
|
+
attribute :scopes_enabled, Boolean
|
28
30
|
attribute :scope_id, Integer
|
29
31
|
attribute :hero_image
|
30
32
|
attribute :remove_hero_image
|
@@ -4,21 +4,32 @@ module Decidim
|
|
4
4
|
module Admin
|
5
5
|
# A form object to create or update scopes.
|
6
6
|
class ScopeForm < Form
|
7
|
-
|
7
|
+
include TranslatableAttributes
|
8
|
+
|
9
|
+
translatable_attribute :name, String
|
8
10
|
attribute :organization, Decidim::Organization
|
11
|
+
attribute :code, String
|
12
|
+
attribute :parent_id, Integer
|
13
|
+
attribute :scope_type_id, Integer
|
14
|
+
|
9
15
|
mimic :scope
|
10
16
|
|
11
|
-
validates :name, :
|
12
|
-
|
17
|
+
validates :name, translatable_presence: true
|
18
|
+
validates :organization, :code, presence: true
|
19
|
+
validate :code, :code_uniqueness
|
13
20
|
|
14
21
|
alias organization current_organization
|
15
22
|
|
23
|
+
def scope_type
|
24
|
+
Decidim::ScopeType.find_by_id(scope_type_id) if scope_type_id
|
25
|
+
end
|
26
|
+
|
16
27
|
private
|
17
28
|
|
18
|
-
def
|
19
|
-
return unless organization && organization.scopes.where(
|
29
|
+
def code_uniqueness
|
30
|
+
return unless organization && organization.scopes.where(code: code).where.not(id: id).any?
|
20
31
|
|
21
|
-
errors.add(:
|
32
|
+
errors.add(:code, :taken)
|
22
33
|
end
|
23
34
|
end
|
24
35
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
# A form object to create or update scopes.
|
6
|
+
class ScopeTypeForm < Form
|
7
|
+
include TranslatableAttributes
|
8
|
+
|
9
|
+
translatable_attribute :name, String
|
10
|
+
translatable_attribute :plural, String
|
11
|
+
attribute :organization, Decidim::Organization
|
12
|
+
|
13
|
+
mimic :scope_type
|
14
|
+
|
15
|
+
validates :name, :plural, translatable_presence: true
|
16
|
+
validates :organization, presence: true
|
17
|
+
|
18
|
+
alias organization current_organization
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
# This module includes helpers to show scopes in admin
|
6
|
+
module ScopesHelper
|
7
|
+
Option = Struct.new(:id, :name)
|
8
|
+
|
9
|
+
# Public: This helper shows the path to the given scope, linking each ancestor.
|
10
|
+
#
|
11
|
+
# current_scope - Scope object to show
|
12
|
+
#
|
13
|
+
def scope_breadcrumbs(current_scope)
|
14
|
+
current_scope.part_of_scopes.map do |scope|
|
15
|
+
if scope == current_scope
|
16
|
+
translated_attribute(scope.name)
|
17
|
+
else
|
18
|
+
link_to translated_attribute(scope.name), scope_scopes_path(scope)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Public: A formatted collection of scopes for a given organization to be used
|
24
|
+
# in forms.
|
25
|
+
#
|
26
|
+
# organization - Organization object
|
27
|
+
#
|
28
|
+
# Returns an Array.
|
29
|
+
def organization_scope_types(organization = current_organization)
|
30
|
+
[Option.new("", "-")] +
|
31
|
+
organization.scope_types.map do |scope_type|
|
32
|
+
Option.new(scope_type.id, translated_attribute(scope_type.name))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# Public: Check if the given scopable object has the scope enabled or not.
|
37
|
+
#
|
38
|
+
# scopable - A scopable object.
|
39
|
+
#
|
40
|
+
# Returns a Boolean.
|
41
|
+
def scopes_enabled?(scopable)
|
42
|
+
scopable.scopes_enabled?
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -23,7 +23,18 @@ module Decidim
|
|
23
23
|
#
|
24
24
|
# Returns a rendered form field.
|
25
25
|
def settings_attribute_input(form, attribute, name, options = {})
|
26
|
-
|
26
|
+
if attribute.translated?
|
27
|
+
form.send(:translated, form_method_for_attribute(attribute), name, options.merge(tabs_id: "#{options[:tabs_prefix]}-#{name}-tabs"))
|
28
|
+
else
|
29
|
+
form.send(form_method_for_attribute(attribute), name, options)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
private
|
34
|
+
|
35
|
+
def form_method_for_attribute(attribute)
|
36
|
+
return :editor if attribute.type.to_sym == :text && attribute.editor?
|
37
|
+
TYPES[attribute.type.to_sym]
|
27
38
|
end
|
28
39
|
end
|
29
40
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
class ExpireImpersonationJob < ApplicationJob
|
6
|
+
queue_as :default
|
7
|
+
|
8
|
+
def perform(user, current_user)
|
9
|
+
impersonation_log = Decidim::ImpersonationLog.where(admin: current_user, user: user).active.first
|
10
|
+
return unless impersonation_log
|
11
|
+
impersonation_log.expired_at = Time.current
|
12
|
+
impersonation_log.save!
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -26,9 +26,20 @@ module Decidim
|
|
26
26
|
|
27
27
|
can :manage, Feature
|
28
28
|
can :manage, :admin_users
|
29
|
+
|
30
|
+
can :manage, :managed_users
|
31
|
+
cannot [:new, :create], :managed_users if empty_available_authorizations?
|
32
|
+
can :impersonate, Decidim::User do |user_to_impersonate|
|
33
|
+
user_to_impersonate.managed? && Decidim::ImpersonationLog.active.empty?
|
34
|
+
end
|
35
|
+
can :promote, Decidim::User do |user_to_promote|
|
36
|
+
user_to_promote.managed? && Decidim::ImpersonationLog.active.empty?
|
37
|
+
end
|
38
|
+
|
29
39
|
can :manage, Moderation
|
30
40
|
can :manage, Attachment
|
31
41
|
can :manage, Scope
|
42
|
+
can :manage, ScopeType
|
32
43
|
can :manage, Newsletter
|
33
44
|
can [:create, :index, :new, :read, :invite], User
|
34
45
|
|
@@ -38,6 +49,12 @@ module Decidim
|
|
38
49
|
|
39
50
|
can [:index, :verify, :reject], UserGroup
|
40
51
|
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def empty_available_authorizations?
|
56
|
+
@context[:current_organization] && @context[:current_organization].available_authorizations.empty?
|
57
|
+
end
|
41
58
|
end
|
42
59
|
end
|
43
60
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Admin
|
5
|
+
module Abilities
|
6
|
+
# Defines the abilities for a user with role 'user_manager' in the admin section.
|
7
|
+
# Intended to be used with `cancancan`.
|
8
|
+
class UserManagerAbility < Decidim::Abilities::UserManagerAbility
|
9
|
+
def define_abilities
|
10
|
+
super
|
11
|
+
|
12
|
+
can :manage, :managed_users
|
13
|
+
cannot [:new, :create], :managed_users if empty_available_authorizations?
|
14
|
+
can :impersonate, Decidim::User do |user_to_impersonate|
|
15
|
+
user_to_impersonate.managed? && Decidim::ImpersonationLog.active.empty?
|
16
|
+
end
|
17
|
+
can :promote, Decidim::User do |user_to_promote|
|
18
|
+
user_to_promote.managed? && Decidim::ImpersonationLog.active.empty?
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def empty_available_authorizations?
|
25
|
+
@context[:current_organization] && @context[:current_organization].available_authorizations.empty?
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<%= decidim_form_for(@form, url:
|
1
|
+
<%= decidim_form_for(@form, url: category_path(@category.participatory_process, @category), html: { class: "form edit_participatory_process_category" }) do |f| %>
|
2
2
|
<%= render partial: 'form', object: f, locals: { title: t('.title') } %>
|
3
3
|
|
4
4
|
<div class="button--double form-general-submit">
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<h2 class='card-title'>
|
4
4
|
<%= t(".categories_title") %>
|
5
5
|
<% if can? :create, Decidim::Category %>
|
6
|
-
<%= link_to t("actions.new", scope: "decidim.admin", name: t("models.category.name", scope: "decidim.admin")),
|
6
|
+
<%= link_to t("actions.new", scope: "decidim.admin", name: t("models.category.name", scope: "decidim.admin")), new_category_path(current_participatory_process), class: 'button tiny button--title new' %>
|
7
7
|
<% end %>
|
8
8
|
</h2>
|
9
9
|
</div>
|
@@ -22,16 +22,16 @@
|
|
22
22
|
<% current_participatory_process.categories.first_class.each do |category| %>
|
23
23
|
<tr>
|
24
24
|
<td>
|
25
|
-
<%= link_to translated_attribute(category.name),
|
25
|
+
<%= link_to translated_attribute(category.name), edit_category_path(current_participatory_process, category) %><br />
|
26
26
|
</td>
|
27
27
|
<td class="table-list__actions">
|
28
28
|
<% if can? :update, category %>
|
29
|
-
<%= icon_link_to "pencil",
|
29
|
+
<%= icon_link_to "pencil", edit_category_path(current_participatory_process, category), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
|
30
30
|
<% end %>
|
31
31
|
|
32
32
|
<% if can? :destroy, category %>
|
33
33
|
<% if category.unused? %>
|
34
|
-
<%= icon_link_to "circle-x",
|
34
|
+
<%= icon_link_to "circle-x", category_path(current_participatory_process, category), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
|
35
35
|
<% else %>
|
36
36
|
<span class="action-icon" title="<%= t('.category_used') %>" data-tooltip="true" data-disable-hover="false">
|
37
37
|
<%= icon "circle-x", class: "action-icon action-icon--disabled" %>
|
@@ -43,15 +43,15 @@
|
|
43
43
|
<% category.subcategories.each do |subcategory| %>
|
44
44
|
<tr class="extra__table-list__subcategory">
|
45
45
|
<td>
|
46
|
-
<%= link_to translated_attribute(subcategory.name),
|
46
|
+
<%= link_to translated_attribute(subcategory.name), edit_category_path(current_participatory_process, subcategory) %><br />
|
47
47
|
</td>
|
48
48
|
<td class="table-list__actions">
|
49
49
|
<% if can? :update, subcategory %>
|
50
|
-
<%= icon_link_to "pencil",
|
50
|
+
<%= icon_link_to "pencil", edit_category_path(current_participatory_process, subcategory), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
|
51
51
|
<% end %>
|
52
52
|
|
53
53
|
<% if can? :destroy, subcategory %>
|
54
|
-
<%= icon_link_to "circle-x",
|
54
|
+
<%= icon_link_to "circle-x", category_path(current_participatory_process, subcategory), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
|
55
55
|
<% end %>
|
56
56
|
</td>
|
57
57
|
</tr>
|