decidim 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 might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +1626 -0
- data/Gemfile.lock +82 -82
- data/decidim-admin/app/assets/stylesheets/decidim/admin/_variables.scss +2 -0
- data/decidim-admin/app/assets/stylesheets/decidim/admin/extra/_cards.scss +6 -0
- data/decidim-admin/app/assets/stylesheets/decidim/admin/modules/_typography.scss +4 -0
- data/decidim-admin/app/commands/decidim/admin/create_participatory_process_admin.rb +3 -5
- data/decidim-admin/app/constraints/decidim/admin/organization_dashboard_constraint.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/application_controller.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/categories_controller.rb +9 -9
- data/decidim-admin/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +1 -8
- data/decidim-admin/app/controllers/decidim/admin/exports_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/feature_permissions_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/features/base_controller.rb +0 -5
- data/decidim-admin/app/controllers/decidim/admin/features_controller.rb +4 -4
- data/decidim-admin/app/controllers/decidim/admin/moderations_controller.rb +1 -1
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_attachments_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_copies_controller.rb +3 -9
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_publications_controller.rb +4 -4
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb +2 -2
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_steps_controller.rb +6 -6
- data/decidim-admin/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +13 -15
- data/decidim-admin/app/controllers/decidim/admin/participatory_processes_controller.rb +16 -18
- data/decidim-admin/app/controllers/decidim/admin/users_controller.rb +4 -4
- data/decidim-admin/app/forms/decidim/admin/participatory_process_user_role_form.rb +2 -2
- data/decidim-admin/app/models/decidim/admin/abilities/{admin_user.rb → admin_ability.rb} +3 -6
- data/decidim-admin/app/models/decidim/admin/abilities/{base.rb → base_ability.rb} +1 -4
- data/decidim-admin/app/models/decidim/admin/abilities/{participatory_process_admin.rb → participatory_process_admin_ability.rb} +18 -28
- data/decidim-admin/app/models/decidim/admin/abilities/participatory_process_collaborator_ability.rb +19 -0
- data/decidim-admin/app/models/decidim/admin/abilities/participatory_process_moderator_ability.rb +23 -0
- data/decidim-admin/app/queries/decidim/admin/process_admins.rb +1 -1
- data/decidim-admin/app/views/decidim/admin/categories/index.html.erb +9 -9
- data/decidim-admin/app/views/decidim/admin/categories/new.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/features/_form.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/features/edit.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/features/new.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_copies/new.html.erb +1 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_groups/index.html.erb +5 -1
- data/decidim-admin/app/views/decidim/admin/participatory_process_steps/index.html.erb +9 -9
- data/decidim-admin/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +6 -6
- data/decidim-admin/app/views/decidim/admin/participatory_processes/edit.html.erb +6 -6
- data/decidim-admin/app/views/decidim/admin/participatory_processes/index.html.erb +11 -1
- data/decidim-admin/app/views/layouts/decidim/admin/participatory_process.html.erb +18 -18
- data/decidim-admin/config/locales/ca.yml +4 -3
- data/decidim-admin/config/locales/en.yml +1 -0
- data/decidim-admin/config/locales/es.yml +1 -2
- data/decidim-admin/db/migrate/20170714083651_rename_participatory_process_user_roles_table.rb +7 -0
- data/decidim-admin/lib/decidim/admin/engine.rb +8 -6
- data/decidim-admin/lib/decidim/admin/test/factories.rb +1 -1
- data/decidim-admin/spec/commands/create_participatory_process_admin_spec.rb +4 -4
- data/decidim-admin/spec/models/abilities/{admin_user_spec.rb → admin_ability_spec.rb} +1 -1
- data/decidim-admin/spec/models/abilities/{participatory_process_admin_spec.rb → participatory_process_admin_ability_spec.rb} +3 -3
- data/decidim-admin/spec/models/abilities/participatory_process_collaborator_ability_spec.rb +18 -0
- data/decidim-admin/spec/queries/process_admins_spec.rb +1 -1
- data/decidim-admin/spec/views/decidim/static_pages/_form.html.erb_spec.rb +1 -1
- data/decidim-budgets/config/locales/ca.yml +2 -2
- data/decidim-comments/app/models/decidim/comments/abilities/admin_ability.rb +19 -0
- data/decidim-comments/app/models/decidim/comments/abilities/{admin_user.rb → current_user_ability.rb} +4 -6
- data/decidim-comments/app/models/decidim/comments/abilities/participatory_process_admin_ability.rb +19 -0
- data/decidim-comments/app/models/decidim/comments/abilities/participatory_process_moderator_ability.rb +19 -0
- data/decidim-comments/lib/decidim/comments/admin_engine.rb +5 -2
- data/decidim-comments/lib/decidim/comments/engine.rb +6 -0
- data/decidim-comments/spec/models/abilities/{admin_user_spec.rb → admin_ability_spec.rb} +1 -1
- data/decidim-comments/spec/models/abilities/{process_admin_user_spec.rb → participatory_process_admin_ability_spec.rb} +3 -2
- data/decidim-meetings/app/controllers/decidim/meetings/meeting_widgets_controller.rb +1 -0
- data/decidim-meetings/app/controllers/decidim/meetings/meetings_controller.rb +2 -2
- data/decidim-meetings/app/views/decidim/meetings/meeting_widgets/show.html.erb +1 -1
- data/decidim-meetings/app/views/decidim/meetings/meetings/_meetings.html.erb +2 -0
- data/decidim-meetings/config/locales/ca.yml +1 -1
- data/decidim-meetings/spec/features/explore_meetings_spec.rb +11 -0
- data/decidim-proposals/app/controllers/decidim/proposals/proposals_controller.rb +2 -1
- data/decidim-proposals/app/forms/decidim/proposals/admin/proposal_answer_form.rb +1 -1
- data/decidim-proposals/app/helpers/decidim/proposals/application_helper.rb +23 -11
- data/decidim-proposals/app/models/decidim/proposals/abilities/{admin_user.rb → admin_ability.rb} +5 -12
- data/decidim-proposals/app/models/decidim/proposals/abilities/{current_user.rb → current_user_ability.rb} +1 -2
- data/decidim-proposals/app/models/decidim/proposals/abilities/{process_admin_user.rb → participatory_process_admin_ability.rb} +10 -22
- data/decidim-proposals/app/models/decidim/proposals/abilities/participatory_process_moderator_ability.rb +19 -0
- data/decidim-proposals/app/models/decidim/proposals/proposal.rb +8 -0
- data/decidim-proposals/app/services/decidim/proposals/proposal_search.rb +5 -2
- data/decidim-proposals/app/views/decidim/proposals/admin/proposal_answers/edit.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_filters.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposal_badge.html.erb +1 -1
- data/decidim-proposals/app/views/decidim/proposals/proposals/_proposals.html.erb +10 -1
- data/decidim-proposals/config/locales/ca.yml +3 -0
- data/decidim-proposals/config/locales/en.yml +3 -0
- data/decidim-proposals/config/locales/es.yml +3 -0
- data/decidim-proposals/lib/decidim/proposals/admin_engine.rb +5 -2
- data/decidim-proposals/lib/decidim/proposals/engine.rb +1 -1
- data/decidim-proposals/lib/decidim/proposals/feature.rb +4 -0
- data/decidim-proposals/lib/decidim/proposals/proposal_serializer.rb +4 -0
- data/decidim-proposals/spec/features/proposals_spec.rb +12 -5
- data/decidim-proposals/spec/models/decidim/proposals/abilities/{admin_user_spec.rb → admin_ability_spec.rb} +1 -1
- data/decidim-proposals/spec/models/decidim/proposals/abilities/{process_admin_user_spec.rb → participatory_process_admin_ability.rb} +10 -2
- data/decidim-proposals/spec/services/decidim/proposals/proposal_serializer_spec.rb +7 -0
- data/decidim-proposals/spec/shared/manage_proposals_examples.rb +21 -0
- data/decidim-results/app/controllers/decidim/results/results_controller.rb +2 -1
- data/decidim-results/app/views/decidim/results/results/_results.html.erb +2 -0
- data/decidim-results/config/locales/ca.yml +1 -1
- data/decidim-results/spec/features/comments_spec.rb +1 -1
- data/decidim-results/spec/features/explore_results_spec.rb +11 -0
- data/decidim-surveys/app/models/decidim/surveys/abilities/admin_ability.rb +17 -0
- data/decidim-surveys/app/models/decidim/surveys/abilities/{current_user.rb → current_user_ability.rb} +1 -1
- data/decidim-surveys/app/models/decidim/surveys/abilities/participatory_process_admin_ability.rb +19 -0
- data/decidim-surveys/config/locales/ca.yml +1 -1
- data/decidim-surveys/lib/decidim/surveys/admin_engine.rb +4 -2
- data/decidim-surveys/lib/decidim/surveys/engine.rb +1 -1
- data/decidim-surveys/spec/models/decidim/surveys/abilities/{admin_user_spec.rb → admin_ability_spec.rb} +1 -1
- data/decidim-surveys/spec/models/decidim/surveys/abilities/{current_user_spec.rb → current_user_ability_spec.rb} +1 -1
- data/decidim-surveys/spec/models/decidim/surveys/abilities/{process_admin_user_spec.rb → participatory_process_admin_ability_spec.rb} +3 -2
- data/decidim-system/app/commands/decidim/system/register_organization.rb +2 -2
- data/decidim-system/spec/commands/decidim/system/register_organization_spec.rb +1 -1
- data/docs/getting_started.md +1 -1
- data/lib/generators/decidim/templates/initializer.rb +2 -2
- data/package.json +1 -3
- data/yarn.lock +21 -18
- metadata +52 -54
- data/decidim-admin/app/models/decidim/admin/abilities/collaborator_user.rb +0 -20
- data/decidim-admin/app/models/decidim/admin/participatory_process_user_role.rb +0 -15
- data/decidim-admin/app/queries/decidim/admin/manageable_participatory_processes_for_user.rb +0 -42
- data/decidim-admin/app/queries/decidim/admin/process_admin_roles_for_process.rb +0 -36
- data/decidim-admin/db/seeds.rb +0 -24
- data/decidim-admin/spec/models/abilities/collaborator_user_spec.rb +0 -67
- data/decidim-admin/spec/models/participatory_process_user_role_spec.rb +0 -39
- data/decidim-admin/spec/queries/manageable_participatory_processes_for_user_spec.rb +0 -39
- data/decidim-admin/spec/queries/process_admin_roles_for_process_spec.rb +0 -19
- data/decidim-comments/app/models/decidim/comments/abilities/process_admin_user.rb +0 -34
- data/decidim-meetings/app/views/decidim/meetings/meeting_widgets/.erb +0 -16
- data/decidim-surveys/app/models/decidim/surveys/abilities/admin_user.rb +0 -34
- data/decidim-surveys/app/models/decidim/surveys/abilities/process_admin_user.rb +0 -44
@@ -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
|
data/decidim-admin/app/controllers/decidim/admin/participatory_process_attachments_controller.rb
CHANGED
@@ -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
|
data/decidim-admin/app/controllers/decidim/admin/participatory_process_publications_controller.rb
CHANGED
@@ -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
|
data/decidim-admin/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb
CHANGED
@@ -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
|
data/decidim-admin/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb
CHANGED
@@ -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
|
@@ -7,8 +7,8 @@ module Decidim
|
|
7
7
|
# Controller that allows managing participatory processes.
|
8
8
|
#
|
9
9
|
class ParticipatoryProcessesController < ApplicationController
|
10
|
-
helper_method :participatory_process
|
11
10
|
helper Decidim::OrganizationScopesHelper
|
11
|
+
helper_method :current_participatory_process
|
12
12
|
|
13
13
|
def index
|
14
14
|
authorize! :index, Decidim::ParticipatoryProcess
|
@@ -38,18 +38,16 @@ module Decidim
|
|
38
38
|
end
|
39
39
|
|
40
40
|
def edit
|
41
|
-
|
42
|
-
|
43
|
-
@form = form(ParticipatoryProcessForm).from_model(@participatory_process)
|
41
|
+
authorize! :update, current_participatory_process
|
42
|
+
@form = form(ParticipatoryProcessForm).from_model(current_participatory_process)
|
44
43
|
render layout: "decidim/admin/participatory_process"
|
45
44
|
end
|
46
45
|
|
47
46
|
def update
|
48
|
-
|
49
|
-
authorize! :update, @participatory_process
|
47
|
+
authorize! :update, current_participatory_process
|
50
48
|
@form = form(ParticipatoryProcessForm).from_params(participatory_process_params)
|
51
49
|
|
52
|
-
UpdateParticipatoryProcess.call(
|
50
|
+
UpdateParticipatoryProcess.call(current_participatory_process, @form) do
|
53
51
|
on(:ok) do |participatory_process|
|
54
52
|
flash[:notice] = I18n.t("participatory_processes.update.success", scope: "decidim.admin")
|
55
53
|
redirect_to edit_participatory_process_path(participatory_process)
|
@@ -63,14 +61,12 @@ module Decidim
|
|
63
61
|
end
|
64
62
|
|
65
63
|
def show
|
66
|
-
|
67
|
-
authorize! :read, @participatory_process
|
64
|
+
authorize! :read, current_participatory_process
|
68
65
|
end
|
69
66
|
|
70
67
|
def destroy
|
71
|
-
|
72
|
-
|
73
|
-
@participatory_process.destroy!
|
68
|
+
authorize! :destroy, current_participatory_process
|
69
|
+
current_participatory_process.destroy!
|
74
70
|
|
75
71
|
flash[:notice] = I18n.t("participatory_processes.destroy.success", scope: "decidim.admin")
|
76
72
|
|
@@ -78,22 +74,24 @@ module Decidim
|
|
78
74
|
end
|
79
75
|
|
80
76
|
def copy
|
81
|
-
|
77
|
+
authorize! :create, Decidim::ParticipatoryProcess
|
82
78
|
end
|
83
79
|
|
84
|
-
|
80
|
+
def current_participatory_process
|
81
|
+
@current_participatory_process ||= collection.find(params[:id]) if params[:id]
|
82
|
+
end
|
85
83
|
|
86
|
-
|
84
|
+
private
|
87
85
|
|
88
86
|
def collection
|
89
|
-
@collection ||=
|
87
|
+
@collection ||= Decidim::ParticipatoryProcessesWithUserRole.for(current_user)
|
90
88
|
end
|
91
89
|
|
92
90
|
def participatory_process_params
|
93
91
|
{
|
94
92
|
id: params[:id],
|
95
|
-
hero_image:
|
96
|
-
banner_image:
|
93
|
+
hero_image: current_participatory_process.hero_image,
|
94
|
+
banner_image: current_participatory_process.banner_image
|
97
95
|
}.merge(params[:participatory_process].to_unsafe_h)
|
98
96
|
end
|
99
97
|
end
|
@@ -14,7 +14,7 @@ module Decidim
|
|
14
14
|
|
15
15
|
def new
|
16
16
|
authorize! :new, :admin_users
|
17
|
-
@form = form(
|
17
|
+
@form = form(InviteUserForm).instance
|
18
18
|
end
|
19
19
|
|
20
20
|
def create
|
@@ -23,13 +23,13 @@ module Decidim
|
|
23
23
|
default_params = {
|
24
24
|
organization: current_organization,
|
25
25
|
invitation_instructions: "invite_admin",
|
26
|
-
|
26
|
+
admin: true,
|
27
27
|
invited_by: current_user,
|
28
28
|
comments_notifications: true,
|
29
29
|
replies_notifications: true
|
30
30
|
}
|
31
31
|
|
32
|
-
@form = form(
|
32
|
+
@form = form(InviteUserForm).from_params(params.merge(default_params))
|
33
33
|
|
34
34
|
InviteUser.call(@form) do
|
35
35
|
on(:ok) do
|
@@ -63,7 +63,7 @@ module Decidim
|
|
63
63
|
def destroy
|
64
64
|
authorize! :destroy, :admin_users
|
65
65
|
|
66
|
-
|
66
|
+
RemoveAdmin.call(user) do
|
67
67
|
on(:ok) do
|
68
68
|
flash[:notice] = I18n.t("users.destroy.success", scope: "decidim.admin")
|
69
69
|
end
|