decidim-admin 0.4.0 → 0.4.1
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/stylesheets/decidim/admin/_variables.scss +2 -0
- data/app/assets/stylesheets/decidim/admin/extra/_cards.scss +6 -0
- data/app/assets/stylesheets/decidim/admin/modules/_typography.scss +4 -0
- data/app/commands/decidim/admin/create_participatory_process_admin.rb +3 -5
- data/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
- data/app/controllers/decidim/admin/application_controller.rb +1 -1
- data/app/controllers/decidim/admin/categories_controller.rb +9 -9
- data/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +1 -8
- data/app/controllers/decidim/admin/exports_controller.rb +2 -2
- data/app/controllers/decidim/admin/feature_permissions_controller.rb +2 -2
- data/app/controllers/decidim/admin/features/base_controller.rb +0 -5
- data/app/controllers/decidim/admin/features_controller.rb +4 -4
- data/app/controllers/decidim/admin/moderations_controller.rb +1 -1
- data/app/controllers/decidim/admin/participatory_process_attachments_controller.rb +2 -2
- data/app/controllers/decidim/admin/participatory_process_copies_controller.rb +3 -9
- data/app/controllers/decidim/admin/participatory_process_publications_controller.rb +4 -4
- data/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb +2 -2
- data/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb +2 -2
- data/app/controllers/decidim/admin/participatory_process_steps_controller.rb +6 -6
- data/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +13 -15
- data/app/controllers/decidim/admin/participatory_processes_controller.rb +16 -18
- data/app/controllers/decidim/admin/users_controller.rb +4 -4
- data/app/forms/decidim/admin/participatory_process_user_role_form.rb +2 -2
- data/app/models/decidim/admin/abilities/{admin_user.rb → admin_ability.rb} +3 -6
- data/app/models/decidim/admin/abilities/{base.rb → base_ability.rb} +1 -4
- data/app/models/decidim/admin/abilities/{participatory_process_admin.rb → participatory_process_admin_ability.rb} +18 -28
- data/app/models/decidim/admin/abilities/participatory_process_collaborator_ability.rb +19 -0
- data/app/models/decidim/admin/abilities/participatory_process_moderator_ability.rb +23 -0
- data/app/queries/decidim/admin/process_admins.rb +1 -1
- data/app/views/decidim/admin/categories/index.html.erb +9 -9
- data/app/views/decidim/admin/categories/new.html.erb +1 -1
- data/app/views/decidim/admin/features/_form.html.erb +1 -1
- data/app/views/decidim/admin/features/edit.html.erb +1 -1
- data/app/views/decidim/admin/features/new.html.erb +1 -1
- data/app/views/decidim/admin/participatory_process_copies/new.html.erb +1 -1
- data/app/views/decidim/admin/participatory_process_groups/index.html.erb +5 -1
- data/app/views/decidim/admin/participatory_process_steps/index.html.erb +9 -9
- data/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +6 -6
- data/app/views/decidim/admin/participatory_processes/edit.html.erb +6 -6
- data/app/views/decidim/admin/participatory_processes/index.html.erb +11 -1
- data/app/views/layouts/decidim/admin/participatory_process.html.erb +18 -18
- data/config/locales/ca.yml +4 -3
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +1 -2
- data/db/migrate/20170714083651_rename_participatory_process_user_roles_table.rb +7 -0
- data/lib/decidim/admin/engine.rb +8 -6
- data/lib/decidim/admin/test/factories.rb +1 -1
- metadata +12 -14
- data/app/models/decidim/admin/abilities/collaborator_user.rb +0 -20
- data/app/models/decidim/admin/participatory_process_user_role.rb +0 -15
- data/app/queries/decidim/admin/manageable_participatory_processes_for_user.rb +0 -42
- data/app/queries/decidim/admin/process_admin_roles_for_process.rb +0 -36
- data/db/seeds.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42620ebd8e29a49fbf096b8ae94aa58b2173cabf
|
4
|
+
data.tar.gz: 292d295cd03650b353e3a54fb2bc2f84bfb9dba7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 574157f3e93f0b28797202df966d6ba3cea21a174caf6db438eb15b827f7c20738da96db32e9fd8d4f2bef79abf80582e8b2bdc3cb9ac1ca7630d4aea432a666
|
7
|
+
data.tar.gz: 3ebf17d827c28f0f4268265c58c4b188d40a39b67969758595acdbc8debe099eb7f6b217acde0725fa7622bc3e0a39a1792d640ca2145a1f9f4fb3a73daf1bb1
|
@@ -41,7 +41,7 @@ module Decidim
|
|
41
41
|
attr_reader :form, :participatory_process, :current_user, :user
|
42
42
|
|
43
43
|
def create_role
|
44
|
-
ParticipatoryProcessUserRole.find_or_create_by!(
|
44
|
+
Decidim::ParticipatoryProcessUserRole.find_or_create_by!(
|
45
45
|
role: form.role.to_sym,
|
46
46
|
user: user,
|
47
47
|
participatory_process: @participatory_process
|
@@ -68,9 +68,7 @@ module Decidim
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def new_user
|
71
|
-
|
72
|
-
new_user_form.roles = []
|
73
|
-
@new_user ||= InviteUser.call(new_user_form) do
|
71
|
+
@new_user ||= InviteUser.call(user_form) do
|
74
72
|
on(:ok) do |user|
|
75
73
|
return user
|
76
74
|
end
|
@@ -81,7 +79,7 @@ module Decidim
|
|
81
79
|
OpenStruct.new(name: form.name,
|
82
80
|
email: form.email.downcase,
|
83
81
|
organization: participatory_process.organization,
|
84
|
-
|
82
|
+
admin: false,
|
85
83
|
invited_by: current_user,
|
86
84
|
invitation_instructions: invitation_instructions)
|
87
85
|
end
|
@@ -33,7 +33,7 @@ module Decidim
|
|
33
33
|
# Overwrites `cancancan`'s method to point to the correct ability class,
|
34
34
|
# since the gem expects the ability class to be in the root namespace.
|
35
35
|
def current_ability_klass
|
36
|
-
Decidim::Admin::Abilities::
|
36
|
+
Decidim::Admin::Abilities::BaseAbility
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -15,17 +15,17 @@ module Decidim
|
|
15
15
|
|
16
16
|
def new
|
17
17
|
authorize! :create, Decidim::Category
|
18
|
-
@form = form(CategoryForm).from_params({}, current_process:
|
18
|
+
@form = form(CategoryForm).from_params({}, current_process: current_participatory_process)
|
19
19
|
end
|
20
20
|
|
21
21
|
def create
|
22
22
|
authorize! :create, Decidim::Category
|
23
|
-
@form = form(CategoryForm).from_params(params, current_process:
|
23
|
+
@form = form(CategoryForm).from_params(params, current_process: current_participatory_process)
|
24
24
|
|
25
|
-
CreateCategory.call(@form,
|
25
|
+
CreateCategory.call(@form, current_participatory_process) do
|
26
26
|
on(:ok) do
|
27
27
|
flash[:notice] = I18n.t("categories.create.success", scope: "decidim.admin")
|
28
|
-
redirect_to participatory_process_categories_path(
|
28
|
+
redirect_to participatory_process_categories_path(current_participatory_process)
|
29
29
|
end
|
30
30
|
|
31
31
|
on(:invalid) do
|
@@ -38,18 +38,18 @@ module Decidim
|
|
38
38
|
def edit
|
39
39
|
@category = collection.find(params[:id])
|
40
40
|
authorize! :update, @category
|
41
|
-
@form = form(CategoryForm).from_model(@category, current_process:
|
41
|
+
@form = form(CategoryForm).from_model(@category, current_process: current_participatory_process)
|
42
42
|
end
|
43
43
|
|
44
44
|
def update
|
45
45
|
@category = collection.find(params[:id])
|
46
46
|
authorize! :update, @category
|
47
|
-
@form = form(CategoryForm).from_params(params, current_process:
|
47
|
+
@form = form(CategoryForm).from_params(params, current_process: current_participatory_process)
|
48
48
|
|
49
49
|
UpdateCategory.call(@category, @form) do
|
50
50
|
on(:ok) do
|
51
51
|
flash[:notice] = I18n.t("categories.update.success", scope: "decidim.admin")
|
52
|
-
redirect_to participatory_process_categories_path(
|
52
|
+
redirect_to participatory_process_categories_path(current_participatory_process)
|
53
53
|
end
|
54
54
|
|
55
55
|
on(:invalid) do
|
@@ -77,14 +77,14 @@ module Decidim
|
|
77
77
|
flash[:alert] = I18n.t("categories.destroy.error", scope: "decidim.admin")
|
78
78
|
end
|
79
79
|
|
80
|
-
redirect_back(fallback_location: participatory_process_categories_path(
|
80
|
+
redirect_back(fallback_location: participatory_process_categories_path(current_participatory_process))
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
84
|
private
|
85
85
|
|
86
86
|
def collection
|
87
|
-
@collection ||=
|
87
|
+
@collection ||= current_participatory_process.categories.includes(:subcategories)
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
@@ -10,17 +10,10 @@ module Decidim
|
|
10
10
|
extend ActiveSupport::Concern
|
11
11
|
|
12
12
|
included do
|
13
|
-
|
13
|
+
include Decidim::NeedsParticipatoryProcess
|
14
14
|
|
15
15
|
layout "decidim/admin/participatory_process"
|
16
16
|
end
|
17
|
-
|
18
|
-
private
|
19
|
-
|
20
|
-
def participatory_process
|
21
|
-
@participatory_process ||=
|
22
|
-
current_organization.participatory_processes.find(params[:participatory_process_id])
|
23
|
-
end
|
24
17
|
end
|
25
18
|
end
|
26
19
|
end
|
@@ -23,7 +23,7 @@ module Decidim
|
|
23
23
|
send(
|
24
24
|
"decidim_admin_#{feature.manifest.name}_path",
|
25
25
|
feature_id: feature.id,
|
26
|
-
participatory_process_id:
|
26
|
+
participatory_process_id: current_participatory_process.id
|
27
27
|
)
|
28
28
|
end
|
29
29
|
|
@@ -32,7 +32,7 @@ module Decidim
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def feature
|
35
|
-
@feature ||=
|
35
|
+
@feature ||= current_participatory_process.features.find(params[:feature_id])
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -24,7 +24,7 @@ module Decidim
|
|
24
24
|
UpdateFeaturePermissions.call(@permissions_form, feature) do
|
25
25
|
on(:ok) do
|
26
26
|
flash[:notice] = t("feature_permissions.update.success", scope: "decidim.admin")
|
27
|
-
redirect_to participatory_process_features_path(
|
27
|
+
redirect_to participatory_process_features_path(current_participatory_process)
|
28
28
|
end
|
29
29
|
|
30
30
|
on(:invalid) do
|
@@ -53,7 +53,7 @@ module Decidim
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def feature
|
56
|
-
@feature ||=
|
56
|
+
@feature ||= current_participatory_process.features.find(params[:feature_id])
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -13,7 +13,6 @@ module Decidim
|
|
13
13
|
helper Decidim::Admin::ExportsHelper
|
14
14
|
|
15
15
|
helper_method :current_feature,
|
16
|
-
:current_participatory_process,
|
17
16
|
:parent_path
|
18
17
|
|
19
18
|
delegate :active_step, to: :current_participatory_process, prefix: false
|
@@ -30,10 +29,6 @@ module Decidim
|
|
30
29
|
request.env["decidim.current_feature"]
|
31
30
|
end
|
32
31
|
|
33
|
-
def current_participatory_process
|
34
|
-
request.env["decidim.current_participatory_process"]
|
35
|
-
end
|
36
|
-
|
37
32
|
def parent_path
|
38
33
|
decidim_admin.participatory_process_features_path(current_participatory_process)
|
39
34
|
end
|
@@ -15,7 +15,7 @@ module Decidim
|
|
15
15
|
def index
|
16
16
|
authorize! :read, Feature
|
17
17
|
@manifests = Decidim.feature_manifests
|
18
|
-
@features =
|
18
|
+
@features = current_participatory_process.features
|
19
19
|
end
|
20
20
|
|
21
21
|
def new
|
@@ -24,7 +24,7 @@ module Decidim
|
|
24
24
|
@feature = Feature.new(
|
25
25
|
name: default_name(manifest),
|
26
26
|
manifest_name: params[:type],
|
27
|
-
participatory_process:
|
27
|
+
participatory_process: current_participatory_process
|
28
28
|
)
|
29
29
|
|
30
30
|
@form = form(FeatureForm).from_model(@feature)
|
@@ -34,7 +34,7 @@ module Decidim
|
|
34
34
|
@form = form(FeatureForm).from_params(params)
|
35
35
|
authorize! :create, Feature
|
36
36
|
|
37
|
-
CreateFeature.call(manifest, @form,
|
37
|
+
CreateFeature.call(manifest, @form, current_participatory_process) do
|
38
38
|
on(:ok) do
|
39
39
|
flash[:notice] = I18n.t("features.create.success", scope: "decidim.admin")
|
40
40
|
redirect_to action: :index
|
@@ -112,7 +112,7 @@ module Decidim
|
|
112
112
|
private
|
113
113
|
|
114
114
|
def query_scope
|
115
|
-
|
115
|
+
current_participatory_process.features
|
116
116
|
end
|
117
117
|
|
118
118
|
def manifest
|
@@ -61,7 +61,7 @@ module Decidim
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def participatory_process_moderations
|
64
|
-
@participatory_process_moderations ||= Decidim::Moderation.where(participatory_process:
|
64
|
+
@participatory_process_moderations ||= Decidim::Moderation.where(participatory_process: current_participatory_process)
|
65
65
|
end
|
66
66
|
end
|
67
67
|
end
|
@@ -12,11 +12,11 @@ module Decidim
|
|
12
12
|
include Concerns::HasAttachments
|
13
13
|
|
14
14
|
def after_destroy_path
|
15
|
-
participatory_process_attachments_path(
|
15
|
+
participatory_process_attachments_path(current_participatory_process.id)
|
16
16
|
end
|
17
17
|
|
18
18
|
def attached_to
|
19
|
-
|
19
|
+
current_participatory_process
|
20
20
|
end
|
21
21
|
|
22
22
|
def authorization_object
|
@@ -9,18 +9,16 @@ module Decidim
|
|
9
9
|
class ParticipatoryProcessCopiesController < ApplicationController
|
10
10
|
include Concerns::ParticipatoryProcessAdmin
|
11
11
|
|
12
|
-
helper_method :participatory_process
|
13
|
-
|
14
12
|
def new
|
15
13
|
authorize! :new, Decidim::ParticipatoryProcess
|
16
|
-
@form = form(ParticipatoryProcessCopyForm).from_model(
|
14
|
+
@form = form(ParticipatoryProcessCopyForm).from_model(current_participatory_process)
|
17
15
|
end
|
18
16
|
|
19
17
|
def create
|
20
18
|
authorize! :create, Decidim::ParticipatoryProcess
|
21
19
|
@form = form(ParticipatoryProcessCopyForm).from_params(params)
|
22
20
|
|
23
|
-
CopyParticipatoryProcess.call(@form,
|
21
|
+
CopyParticipatoryProcess.call(@form, current_participatory_process) do
|
24
22
|
on(:ok) do
|
25
23
|
flash[:notice] = I18n.t("participatory_processes_copies.create.success", scope: "decidim.admin")
|
26
24
|
redirect_to participatory_processes_path
|
@@ -36,11 +34,7 @@ module Decidim
|
|
36
34
|
private
|
37
35
|
|
38
36
|
def collection
|
39
|
-
@collection ||=
|
40
|
-
end
|
41
|
-
|
42
|
-
def participatory_process
|
43
|
-
@participatory_process ||= collection.find(params[:participatory_process_id])
|
37
|
+
@collection ||= Decidim::ParticipatoryProcessesWithUserRole.for(current_user, :admin)
|
44
38
|
end
|
45
39
|
end
|
46
40
|
end
|
@@ -10,9 +10,9 @@ module Decidim
|
|
10
10
|
include Concerns::ParticipatoryProcessAdmin
|
11
11
|
|
12
12
|
def create
|
13
|
-
authorize! :publish,
|
13
|
+
authorize! :publish, current_participatory_process
|
14
14
|
|
15
|
-
PublishParticipatoryProcess.call(
|
15
|
+
PublishParticipatoryProcess.call(current_participatory_process) do
|
16
16
|
on(:ok) do
|
17
17
|
flash[:notice] = I18n.t("participatory_process_publications.create.success", scope: "decidim.admin")
|
18
18
|
end
|
@@ -26,9 +26,9 @@ module Decidim
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def destroy
|
29
|
-
authorize! :publish,
|
29
|
+
authorize! :publish, current_participatory_process
|
30
30
|
|
31
|
-
UnpublishParticipatoryProcess.call(
|
31
|
+
UnpublishParticipatoryProcess.call(current_participatory_process) do
|
32
32
|
on(:ok) do
|
33
33
|
flash[:notice] = I18n.t("participatory_process_publications.destroy.success", scope: "decidim.admin")
|
34
34
|
end
|
@@ -21,7 +21,7 @@ module Decidim
|
|
21
21
|
flash.now[:alert] = I18n.t("participatory_process_step_activations.create.error", scope: "decidim.admin")
|
22
22
|
end
|
23
23
|
|
24
|
-
redirect_to participatory_process_steps_path(
|
24
|
+
redirect_to participatory_process_steps_path(current_participatory_process)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -32,7 +32,7 @@ module Decidim
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def collection
|
35
|
-
|
35
|
+
current_participatory_process.steps
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -14,7 +14,7 @@ module Decidim
|
|
14
14
|
ReorderParticipatoryProcessSteps.call(collection, params[:items_ids]) do
|
15
15
|
on(:invalid) do
|
16
16
|
flash.now[:alert] = I18n.t("participatory_process_steps.ordering.error", scope: "decidim.admin")
|
17
|
-
redirect_to participatory_process_path(
|
17
|
+
redirect_to participatory_process_path(current_participatory_process)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -22,7 +22,7 @@ module Decidim
|
|
22
22
|
private
|
23
23
|
|
24
24
|
def collection
|
25
|
-
|
25
|
+
current_participatory_process.steps
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
@@ -22,10 +22,10 @@ module Decidim
|
|
22
22
|
authorize! :create, Decidim::ParticipatoryProcessStep
|
23
23
|
@form = form(ParticipatoryProcessStepForm).from_params(params)
|
24
24
|
|
25
|
-
CreateParticipatoryProcessStep.call(@form,
|
25
|
+
CreateParticipatoryProcessStep.call(@form, current_participatory_process) do
|
26
26
|
on(:ok) do
|
27
27
|
flash[:notice] = I18n.t("participatory_process_steps.create.success", scope: "decidim.admin")
|
28
|
-
redirect_to participatory_process_steps_path(
|
28
|
+
redirect_to participatory_process_steps_path(current_participatory_process)
|
29
29
|
end
|
30
30
|
|
31
31
|
on(:invalid) do
|
@@ -49,7 +49,7 @@ module Decidim
|
|
49
49
|
UpdateParticipatoryProcessStep.call(@participatory_process_step, @form) do
|
50
50
|
on(:ok) do
|
51
51
|
flash[:notice] = I18n.t("participatory_process_steps.update.success", scope: "decidim.admin")
|
52
|
-
redirect_to participatory_process_steps_path(
|
52
|
+
redirect_to participatory_process_steps_path(current_participatory_process)
|
53
53
|
end
|
54
54
|
|
55
55
|
on(:invalid) do
|
@@ -71,12 +71,12 @@ module Decidim
|
|
71
71
|
DestroyParticipatoryProcessStep.call(@participatory_process_step) do
|
72
72
|
on(:ok) do
|
73
73
|
flash[:notice] = I18n.t("participatory_process_steps.destroy.success", scope: "decidim.admin")
|
74
|
-
redirect_to participatory_process_steps_path(
|
74
|
+
redirect_to participatory_process_steps_path(current_participatory_process)
|
75
75
|
end
|
76
76
|
|
77
77
|
on(:invalid) do |reason|
|
78
78
|
flash[:alert] = I18n.t("participatory_process_steps.destroy.error.#{reason}", scope: "decidim.admin")
|
79
|
-
redirect_to participatory_process_steps_path(
|
79
|
+
redirect_to participatory_process_steps_path(current_participatory_process)
|
80
80
|
end
|
81
81
|
end
|
82
82
|
end
|
@@ -84,7 +84,7 @@ module Decidim
|
|
84
84
|
private
|
85
85
|
|
86
86
|
def collection
|
87
|
-
@collection ||=
|
87
|
+
@collection ||= current_participatory_process.steps
|
88
88
|
end
|
89
89
|
end
|
90
90
|
end
|
@@ -9,22 +9,21 @@ module Decidim
|
|
9
9
|
class ParticipatoryProcessUserRolesController < ApplicationController
|
10
10
|
include Concerns::ParticipatoryProcessAdmin
|
11
11
|
|
12
|
-
helper_method :participatory_process, :process_admin_roles
|
13
|
-
|
14
12
|
def index
|
15
|
-
authorize! :read, Decidim::
|
13
|
+
authorize! :read, Decidim::ParticipatoryProcessUserRole
|
14
|
+
@participatory_process_user_roles = collection
|
16
15
|
end
|
17
16
|
|
18
17
|
def new
|
19
|
-
authorize! :create, Decidim::
|
18
|
+
authorize! :create, Decidim::ParticipatoryProcessUserRole
|
20
19
|
@form = form(ParticipatoryProcessUserRoleForm).instance
|
21
20
|
end
|
22
21
|
|
23
22
|
def create
|
24
|
-
authorize! :create, Decidim::
|
23
|
+
authorize! :create, Decidim::ParticipatoryProcessUserRole
|
25
24
|
@form = form(ParticipatoryProcessUserRoleForm).from_params(params)
|
26
25
|
|
27
|
-
CreateParticipatoryProcessAdmin.call(@form, current_user,
|
26
|
+
CreateParticipatoryProcessAdmin.call(@form, current_user, current_participatory_process) do
|
28
27
|
on(:ok) do
|
29
28
|
flash[:notice] = I18n.t("participatory_process_user_roles.create.success", scope: "decidim.admin")
|
30
29
|
end
|
@@ -32,14 +31,14 @@ module Decidim
|
|
32
31
|
on(:invalid) do
|
33
32
|
flash[:alert] = I18n.t("participatory_process_user_roles.create.error", scope: "decidim.admin")
|
34
33
|
end
|
35
|
-
redirect_to participatory_process_user_roles_path(
|
34
|
+
redirect_to participatory_process_user_roles_path(current_participatory_process)
|
36
35
|
end
|
37
36
|
end
|
38
37
|
|
39
38
|
def edit
|
40
39
|
@user_role = collection.find(params[:id])
|
41
40
|
authorize! :update, @user_role
|
42
|
-
@form = form(ParticipatoryProcessUserRoleForm).from_model(@user_role.user, current_process:
|
41
|
+
@form = form(ParticipatoryProcessUserRoleForm).from_model(@user_role.user, current_process: current_participatory_process)
|
43
42
|
end
|
44
43
|
|
45
44
|
def update
|
@@ -50,7 +49,7 @@ module Decidim
|
|
50
49
|
UpdateParticipatoryProcessAdmin.call(@form, @user_role) do
|
51
50
|
on(:ok) do
|
52
51
|
flash[:notice] = I18n.t("participatory_process_user_roles.update.success", scope: "decidim.admin")
|
53
|
-
redirect_to participatory_process_user_roles_path(
|
52
|
+
redirect_to participatory_process_user_roles_path(current_participatory_process)
|
54
53
|
end
|
55
54
|
|
56
55
|
on(:invalid) do
|
@@ -84,17 +83,16 @@ module Decidim
|
|
84
83
|
end
|
85
84
|
end
|
86
85
|
|
87
|
-
redirect_to participatory_process_user_roles_path(
|
86
|
+
redirect_to participatory_process_user_roles_path(current_participatory_process)
|
88
87
|
end
|
89
88
|
|
90
89
|
private
|
91
90
|
|
92
91
|
def collection
|
93
|
-
@collection ||=
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
@process_admin_roles ||= ProcessAdminRolesForProcess.for(@participatory_process)
|
92
|
+
@collection ||= Decidim::ParticipatoryProcessUserRole
|
93
|
+
.includes(:user)
|
94
|
+
.where(participatory_process: current_participatory_process)
|
95
|
+
.order(:role, "decidim_users.name")
|
98
96
|
end
|
99
97
|
end
|
100
98
|
end
|