decidim-admin 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +0 -7
- data/app/assets/javascripts/decidim/admin/application.js.es6 +0 -1
- data/app/assets/stylesheets/decidim/admin/extra/_quill.scss +5 -0
- data/app/commands/decidim/admin/create_category.rb +4 -4
- data/app/commands/decidim/admin/create_feature.rb +7 -7
- data/app/commands/decidim/admin/create_managed_user.rb +0 -2
- data/app/commands/decidim/admin/update_organization.rb +1 -0
- data/app/controllers/decidim/admin/application_controller.rb +0 -2
- data/app/controllers/decidim/admin/categories_controller.rb +10 -10
- data/app/controllers/decidim/admin/exports_controller.rb +1 -2
- data/app/controllers/decidim/admin/feature_permissions_controller.rb +2 -3
- data/app/controllers/decidim/admin/features/base_controller.rb +9 -3
- data/app/controllers/decidim/admin/features_controller.rb +5 -7
- data/app/controllers/decidim/admin/moderations_controller.rb +5 -7
- data/app/controllers/decidim/admin/scopes_controller.rb +12 -10
- data/app/controllers/decidim/admin/users_controller.rb +1 -3
- data/app/forms/decidim/admin/category_form.rb +2 -2
- data/app/forms/decidim/admin/feature_form.rb +1 -18
- data/app/forms/decidim/admin/organization_form.rb +1 -0
- data/app/helpers/decidim/admin/exports_helper.rb +10 -0
- data/app/models/decidim/admin/abilities/admin_ability.rb +0 -3
- data/app/models/decidim/admin/abilities/participatory_process_admin_ability.rb +3 -3
- data/app/views/decidim/admin/attachments/edit.html.erb +1 -1
- data/app/views/decidim/admin/attachments/new.html.erb +1 -1
- data/app/views/decidim/admin/categories/edit.html.erb +2 -2
- data/app/views/decidim/admin/categories/index.html.erb +11 -11
- data/app/views/decidim/admin/categories/new.html.erb +3 -3
- data/app/views/decidim/admin/categories/show.html.erb +2 -2
- data/app/views/decidim/admin/exports/_dropdown.html.erb +1 -1
- data/app/views/decidim/admin/features/_form.html.erb +15 -15
- 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/moderations/index.html.erb +2 -2
- data/app/views/decidim/admin/organization/_form.html.erb +5 -0
- data/app/views/decidim/admin/users/index.html.erb +1 -1
- data/config/locales/ca.yml +8 -195
- data/config/locales/en.yml +6 -197
- data/config/locales/es.yml +11 -198
- data/config/locales/eu.yml +95 -208
- data/config/locales/fi.yml +168 -123
- data/config/locales/fr.yml +114 -191
- data/config/locales/it.yml +150 -168
- data/config/locales/nl.yml +443 -0
- data/config/locales/pl.yml +444 -0
- data/config/locales/uk.yml +451 -0
- data/config/routes.rb +2 -46
- data/lib/decidim/admin/engine.rb +0 -14
- data/lib/decidim/admin/test/commands/create_category_examples.rb +62 -0
- data/lib/decidim/admin/test/commands/destroy_category_examples.rb +46 -0
- data/lib/decidim/admin/test/commands/update_category_examples.rb +65 -0
- data/lib/decidim/admin/test/forms/category_form_examples.rb +90 -0
- data/lib/decidim/admin/test/manage_attachments_examples.rb +2 -2
- data/lib/decidim/admin/test/manage_feature_permissions_examples.rb +41 -0
- metadata +27 -64
- data/app/assets/javascripts/decidim/admin/participatory_processes.js.es6 +0 -12
- data/app/commands/decidim/admin/activate_participatory_process_step.rb +0 -44
- data/app/commands/decidim/admin/copy_participatory_process.rb +0 -113
- data/app/commands/decidim/admin/create_participatory_process.rb +0 -78
- data/app/commands/decidim/admin/create_participatory_process_admin.rb +0 -93
- data/app/commands/decidim/admin/create_participatory_process_group.rb +0 -55
- data/app/commands/decidim/admin/create_participatory_process_step.rb +0 -47
- data/app/commands/decidim/admin/deactivate_participatory_process_step.rb +0 -36
- data/app/commands/decidim/admin/destroy_participatory_process_step.rb +0 -44
- data/app/commands/decidim/admin/publish_participatory_process.rb +0 -32
- data/app/commands/decidim/admin/reorder_participatory_process_steps.rb +0 -52
- data/app/commands/decidim/admin/unpublish_participatory_process.rb +0 -32
- data/app/commands/decidim/admin/update_participatory_process.rb +0 -74
- data/app/commands/decidim/admin/update_participatory_process_admin.rb +0 -41
- data/app/commands/decidim/admin/update_participatory_process_group.rb +0 -58
- data/app/commands/decidim/admin/update_participatory_process_step.rb +0 -49
- data/app/controllers/decidim/admin/concerns/participatory_process_admin.rb +0 -20
- data/app/controllers/decidim/admin/participatory_process_attachments_controller.rb +0 -25
- data/app/controllers/decidim/admin/participatory_process_copies_controller.rb +0 -33
- data/app/controllers/decidim/admin/participatory_process_groups_controller.rb +0 -86
- data/app/controllers/decidim/admin/participatory_process_publications_controller.rb +0 -43
- data/app/controllers/decidim/admin/participatory_process_step_activations_controller.rb +0 -37
- data/app/controllers/decidim/admin/participatory_process_step_ordering_controller.rb +0 -27
- data/app/controllers/decidim/admin/participatory_process_steps_controller.rb +0 -89
- data/app/controllers/decidim/admin/participatory_process_user_roles_controller.rb +0 -97
- data/app/controllers/decidim/admin/participatory_processes_controller.rb +0 -96
- data/app/forms/decidim/admin/participatory_process_copy_form.rb +0 -33
- data/app/forms/decidim/admin/participatory_process_form.rb +0 -69
- data/app/forms/decidim/admin/participatory_process_group_form.rb +0 -24
- data/app/forms/decidim/admin/participatory_process_step_form.rb +0 -35
- data/app/forms/decidim/admin/participatory_process_user_role_form.rb +0 -29
- data/app/helpers/decidim/admin/process_groups_for_select_helper.rb +0 -21
- data/app/helpers/decidim/admin/processes_for_select_helper.rb +0 -23
- data/app/queries/decidim/admin/process_admins.rb +0 -44
- data/app/views/decidim/admin/participatory_process_copies/_form.html.erb +0 -38
- data/app/views/decidim/admin/participatory_process_copies/new.html.erb +0 -7
- data/app/views/decidim/admin/participatory_process_groups/_form.html.erb +0 -17
- data/app/views/decidim/admin/participatory_process_groups/edit.html.erb +0 -19
- data/app/views/decidim/admin/participatory_process_groups/index.html.erb +0 -44
- data/app/views/decidim/admin/participatory_process_groups/new.html.erb +0 -13
- data/app/views/decidim/admin/participatory_process_groups/show.html.erb +0 -23
- data/app/views/decidim/admin/participatory_process_steps/_form.html.erb +0 -25
- data/app/views/decidim/admin/participatory_process_steps/edit.html.erb +0 -8
- data/app/views/decidim/admin/participatory_process_steps/index.html.erb +0 -63
- data/app/views/decidim/admin/participatory_process_steps/new.html.erb +0 -7
- data/app/views/decidim/admin/participatory_process_steps/show.html.erb +0 -18
- data/app/views/decidim/admin/participatory_process_user_roles/_form.html.erb +0 -22
- data/app/views/decidim/admin/participatory_process_user_roles/edit.html.erb +0 -7
- data/app/views/decidim/admin/participatory_process_user_roles/index.html.erb +0 -65
- data/app/views/decidim/admin/participatory_process_user_roles/new.html.erb +0 -7
- data/app/views/decidim/admin/participatory_processes/_form.html.erb +0 -101
- data/app/views/decidim/admin/participatory_processes/edit.html.erb +0 -19
- data/app/views/decidim/admin/participatory_processes/index.html.erb +0 -66
- data/app/views/decidim/admin/participatory_processes/new.html.erb +0 -11
- data/app/views/layouts/decidim/admin/participatory_process.html.erb +0 -64
- data/app/views/layouts/decidim/admin/participatory_process_groups.html.erb +0 -14
- data/app/views/layouts/decidim/admin/participatory_processes.html.erb +0 -14
- data/config/i18n-tasks.yml +0 -132
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Admin
|
|
5
|
-
# A command that sets all steps in a participatory process as inactive
|
|
6
|
-
class DeactivateParticipatoryProcessStep < Rectify::Command
|
|
7
|
-
# Public: Initializes the command.
|
|
8
|
-
#
|
|
9
|
-
# step - A ParticipatoryProcessStep that will be deactivated
|
|
10
|
-
def initialize(step)
|
|
11
|
-
@step = step
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# Executes the command. Broadcasts these events:
|
|
15
|
-
#
|
|
16
|
-
# - :ok when everything is valid.
|
|
17
|
-
# - :invalid if the data wasn't valid and we couldn't proceed.
|
|
18
|
-
#
|
|
19
|
-
# Returns nothing.
|
|
20
|
-
def call
|
|
21
|
-
return broadcast(:invalid) if step.nil? || !step.active?
|
|
22
|
-
|
|
23
|
-
deactivate_active_steps
|
|
24
|
-
broadcast(:ok)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
attr_reader :step
|
|
30
|
-
|
|
31
|
-
def deactivate_active_steps
|
|
32
|
-
step.participatory_process.steps.where(active: true).update_all(active: false)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
end
|
|
36
|
-
end
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Admin
|
|
5
|
-
# A command that sets all steps in a participatory process as inactive
|
|
6
|
-
class DestroyParticipatoryProcessStep < Rectify::Command
|
|
7
|
-
# Public: Initializes the command.
|
|
8
|
-
#
|
|
9
|
-
# step - A ParticipatoryProcessStep that will be deactivated
|
|
10
|
-
def initialize(step)
|
|
11
|
-
@step = step
|
|
12
|
-
@participatory_process = step.participatory_process
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
# Executes the command. Broadcasts these events:
|
|
16
|
-
#
|
|
17
|
-
# - :ok when everything is valid.
|
|
18
|
-
# - :invalid if the data wasn't valid and we couldn't proceed.
|
|
19
|
-
#
|
|
20
|
-
# Returns nothing.
|
|
21
|
-
def call
|
|
22
|
-
return broadcast(:invalid, :active_step) if active_step?
|
|
23
|
-
|
|
24
|
-
@step.destroy!
|
|
25
|
-
reorder_steps
|
|
26
|
-
broadcast(:ok)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
private
|
|
30
|
-
|
|
31
|
-
def active_step?
|
|
32
|
-
@participatory_process.steps.count > 1 && @step.active?
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def reorder_steps
|
|
36
|
-
steps = @participatory_process.steps.reload
|
|
37
|
-
|
|
38
|
-
ReorderParticipatoryProcessSteps
|
|
39
|
-
.new(steps, steps.map(&:id))
|
|
40
|
-
.call
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Admin
|
|
5
|
-
# A command that sets a participatory process as published.
|
|
6
|
-
class PublishParticipatoryProcess < Rectify::Command
|
|
7
|
-
# Public: Initializes the command.
|
|
8
|
-
#
|
|
9
|
-
# process - A ParticipatoryProcess that will be published
|
|
10
|
-
def initialize(process)
|
|
11
|
-
@process = process
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# Executes the command. Broadcasts these events:
|
|
15
|
-
#
|
|
16
|
-
# - :ok when everything is valid.
|
|
17
|
-
# - :invalid if the data wasn't valid and we couldn't proceed.
|
|
18
|
-
#
|
|
19
|
-
# Returns nothing.
|
|
20
|
-
def call
|
|
21
|
-
return broadcast(:invalid) if process.nil? || process.published?
|
|
22
|
-
|
|
23
|
-
process.publish!
|
|
24
|
-
broadcast(:ok)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
attr_reader :process
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Admin
|
|
5
|
-
# A command that reorders the steps in a participatory process.
|
|
6
|
-
class ReorderParticipatoryProcessSteps < Rectify::Command
|
|
7
|
-
# Public: Initializes the command.
|
|
8
|
-
#
|
|
9
|
-
# collection - an ActiveRecord::Relation of steps
|
|
10
|
-
# order - an Array holding the order of IDs of steps
|
|
11
|
-
def initialize(collection, order)
|
|
12
|
-
@collection = collection
|
|
13
|
-
@order = order
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
# Executes the command. Broadcasts these events:
|
|
17
|
-
#
|
|
18
|
-
# - :ok when everything is valid.
|
|
19
|
-
# - :invalid if the data wasn't valid and we couldn't proceed.
|
|
20
|
-
#
|
|
21
|
-
# Returns nothing.
|
|
22
|
-
def call
|
|
23
|
-
return broadcast(:invalid) unless order.present?
|
|
24
|
-
|
|
25
|
-
reorder_steps
|
|
26
|
-
broadcast(:ok)
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
private
|
|
30
|
-
|
|
31
|
-
attr_reader :collection
|
|
32
|
-
|
|
33
|
-
def reorder_steps
|
|
34
|
-
data = order.each_with_index.inject({}) do |hash, (id, index)|
|
|
35
|
-
hash.update(id => { position: index })
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
ParticipatoryProcessStep.transaction do
|
|
39
|
-
collection.update_all(position: nil)
|
|
40
|
-
collection.reload
|
|
41
|
-
collection.update(data.keys, data.values)
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def order
|
|
46
|
-
return nil unless @order.is_a?(Array) && @order.present?
|
|
47
|
-
|
|
48
|
-
@order
|
|
49
|
-
end
|
|
50
|
-
end
|
|
51
|
-
end
|
|
52
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Admin
|
|
5
|
-
# A command that sets a participatory process as unpublished.
|
|
6
|
-
class UnpublishParticipatoryProcess < Rectify::Command
|
|
7
|
-
# Public: Initializes the command.
|
|
8
|
-
#
|
|
9
|
-
# process - A ParticipatoryProcess that will be unpublished
|
|
10
|
-
def initialize(process)
|
|
11
|
-
@process = process
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# Executes the command. Broadcasts these events:
|
|
15
|
-
#
|
|
16
|
-
# - :ok when everything is valid.
|
|
17
|
-
# - :invalid if the data wasn't valid and we couldn't proceed.
|
|
18
|
-
#
|
|
19
|
-
# Returns nothing.
|
|
20
|
-
def call
|
|
21
|
-
return broadcast(:invalid) if process.nil? || !process.published?
|
|
22
|
-
|
|
23
|
-
process.unpublish!
|
|
24
|
-
broadcast(:ok)
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
private
|
|
28
|
-
|
|
29
|
-
attr_reader :process
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Admin
|
|
5
|
-
# A command with all the business logic when creating a new participatory
|
|
6
|
-
# process in the system.
|
|
7
|
-
class UpdateParticipatoryProcess < Rectify::Command
|
|
8
|
-
# Public: Initializes the command.
|
|
9
|
-
#
|
|
10
|
-
# participatory_process - the ParticipatoryProcess to update
|
|
11
|
-
# form - A form object with the params.
|
|
12
|
-
def initialize(participatory_process, form)
|
|
13
|
-
@participatory_process = participatory_process
|
|
14
|
-
@form = form
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# Executes the command. Broadcasts these events:
|
|
18
|
-
#
|
|
19
|
-
# - :ok when everything is valid.
|
|
20
|
-
# - :invalid if the form wasn't valid and we couldn't proceed.
|
|
21
|
-
#
|
|
22
|
-
# Returns nothing.
|
|
23
|
-
def call
|
|
24
|
-
return broadcast(:invalid) if form.invalid?
|
|
25
|
-
update_participatory_process
|
|
26
|
-
|
|
27
|
-
if @participatory_process.valid?
|
|
28
|
-
broadcast(:ok, @participatory_process)
|
|
29
|
-
else
|
|
30
|
-
form.errors.add(:hero_image, @participatory_process.errors[:hero_image]) if @participatory_process.errors.include? :hero_image
|
|
31
|
-
form.errors.add(:banner_image, @participatory_process.errors[:banner_image]) if @participatory_process.errors.include? :banner_image
|
|
32
|
-
broadcast(:invalid)
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
attr_reader :form, :participatory_process
|
|
39
|
-
|
|
40
|
-
def update_participatory_process
|
|
41
|
-
@participatory_process.assign_attributes(attributes)
|
|
42
|
-
@participatory_process.save! if @participatory_process.valid?
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def attributes
|
|
46
|
-
{
|
|
47
|
-
title: form.title,
|
|
48
|
-
subtitle: form.subtitle,
|
|
49
|
-
slug: form.slug,
|
|
50
|
-
hashtag: form.hashtag,
|
|
51
|
-
hero_image: form.hero_image,
|
|
52
|
-
remove_hero_image: form.remove_hero_image,
|
|
53
|
-
banner_image: form.banner_image,
|
|
54
|
-
remove_banner_image: form.remove_banner_image,
|
|
55
|
-
promoted: form.promoted,
|
|
56
|
-
description: form.description,
|
|
57
|
-
short_description: form.short_description,
|
|
58
|
-
scopes_enabled: form.scopes_enabled,
|
|
59
|
-
scope: form.scope,
|
|
60
|
-
developer_group: form.developer_group,
|
|
61
|
-
local_area: form.local_area,
|
|
62
|
-
target: form.target,
|
|
63
|
-
participatory_scope: form.participatory_scope,
|
|
64
|
-
participatory_structure: form.participatory_structure,
|
|
65
|
-
meta_scope: form.meta_scope,
|
|
66
|
-
end_date: form.end_date,
|
|
67
|
-
participatory_process_group: form.participatory_process_group,
|
|
68
|
-
show_statistics: form.show_statistics,
|
|
69
|
-
announcement: form.announcement
|
|
70
|
-
}
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Admin
|
|
5
|
-
# A command with all the business logic when updated a participatory
|
|
6
|
-
# process admin in the system.
|
|
7
|
-
class UpdateParticipatoryProcessAdmin < Rectify::Command
|
|
8
|
-
# Public: Initializes the command.
|
|
9
|
-
#
|
|
10
|
-
# form - A form object with the params.
|
|
11
|
-
# participatory_process - The ParticipatoryProcess that will hold the
|
|
12
|
-
# user role
|
|
13
|
-
def initialize(form, user_role)
|
|
14
|
-
@form = form
|
|
15
|
-
@user_role = user_role
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Executes the command. Broadcasts these events:
|
|
19
|
-
#
|
|
20
|
-
# - :ok when everything is valid.
|
|
21
|
-
# - :invalid if the form wasn't valid and we couldn't proceed.
|
|
22
|
-
#
|
|
23
|
-
# Returns nothing.
|
|
24
|
-
def call
|
|
25
|
-
return broadcast(:invalid) if form.invalid?
|
|
26
|
-
return broadcast(:invalid) unless user_role
|
|
27
|
-
|
|
28
|
-
update_role!
|
|
29
|
-
broadcast(:ok)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
private
|
|
33
|
-
|
|
34
|
-
attr_reader :form, :user_role
|
|
35
|
-
|
|
36
|
-
def update_role!
|
|
37
|
-
user_role.update_attributes!(role: form.role)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Admin
|
|
5
|
-
# A command with all the business logic when creating a new participatory
|
|
6
|
-
# process group in the system.
|
|
7
|
-
class UpdateParticipatoryProcessGroup < Rectify::Command
|
|
8
|
-
# Public: Initializes the command.
|
|
9
|
-
#
|
|
10
|
-
# participatory_process_group - the ParticipatoryProcessGroup to update
|
|
11
|
-
# form - A form object with the params.
|
|
12
|
-
def initialize(participatory_process_group, form)
|
|
13
|
-
@participatory_process_group = participatory_process_group
|
|
14
|
-
@form = form
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
# Executes the command. Broadcasts these events:
|
|
18
|
-
#
|
|
19
|
-
# - :ok when everything is valid.
|
|
20
|
-
# - :invalid if the form wasn't valid and we couldn't proceed.
|
|
21
|
-
#
|
|
22
|
-
# Returns nothing.
|
|
23
|
-
def call
|
|
24
|
-
return broadcast(:invalid) if form.invalid?
|
|
25
|
-
update_participatory_process_group
|
|
26
|
-
|
|
27
|
-
if @participatory_process_group.valid?
|
|
28
|
-
broadcast(:ok, @participatory_process_group)
|
|
29
|
-
else
|
|
30
|
-
form.errors.add(:hero_image, @participatory_process_group.errors[:hero_image]) if @participatory_process_group.errors.include? :hero_image
|
|
31
|
-
broadcast(:invalid)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
private
|
|
36
|
-
|
|
37
|
-
attr_reader :form
|
|
38
|
-
|
|
39
|
-
def update_participatory_process_group
|
|
40
|
-
@participatory_process_group.assign_attributes(attributes)
|
|
41
|
-
@participatory_process_group.save! if @participatory_process_group.valid?
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
def attributes
|
|
45
|
-
{
|
|
46
|
-
name: form.name,
|
|
47
|
-
hero_image: form.hero_image,
|
|
48
|
-
description: form.description,
|
|
49
|
-
participatory_processes: participatory_processes
|
|
50
|
-
}
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def participatory_processes
|
|
54
|
-
Decidim::ParticipatoryProcess.where(id: form.participatory_process_ids)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Admin
|
|
5
|
-
# A command with all the business logic when creating a new participatory
|
|
6
|
-
# process in the system.
|
|
7
|
-
class UpdateParticipatoryProcessStep < Rectify::Command
|
|
8
|
-
attr_reader :participatory_process_step
|
|
9
|
-
# Public: Initializes the command.
|
|
10
|
-
#
|
|
11
|
-
# participatory_process_step - the ParticipatoryProcessStep to update
|
|
12
|
-
# form - A form object with the params.
|
|
13
|
-
def initialize(participatory_process_step, form)
|
|
14
|
-
@participatory_process_step = participatory_process_step
|
|
15
|
-
@form = form
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Executes the command. Broadcasts these events:
|
|
19
|
-
#
|
|
20
|
-
# - :ok when everything is valid.
|
|
21
|
-
# - :invalid if the form wasn't valid and we couldn't proceed.
|
|
22
|
-
#
|
|
23
|
-
# Returns nothing.
|
|
24
|
-
def call
|
|
25
|
-
return broadcast(:invalid) if form.invalid?
|
|
26
|
-
|
|
27
|
-
update_participatory_process_step
|
|
28
|
-
broadcast(:ok)
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
private
|
|
32
|
-
|
|
33
|
-
attr_reader :form
|
|
34
|
-
|
|
35
|
-
def update_participatory_process_step
|
|
36
|
-
participatory_process_step.update_attributes!(attributes)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def attributes
|
|
40
|
-
{
|
|
41
|
-
title: form.title,
|
|
42
|
-
start_date: form.start_date,
|
|
43
|
-
end_date: form.end_date,
|
|
44
|
-
description: form.description
|
|
45
|
-
}
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
end
|
|
49
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Admin
|
|
5
|
-
module Concerns
|
|
6
|
-
# This concern is meant to be included in all controllers that are scoped
|
|
7
|
-
# into a participatory process' admin panel. It will override the layout
|
|
8
|
-
# so it shows the sidebar, preload the participatory process, etc.
|
|
9
|
-
module ParticipatoryProcessAdmin
|
|
10
|
-
extend ActiveSupport::Concern
|
|
11
|
-
|
|
12
|
-
included do
|
|
13
|
-
include Decidim::NeedsParticipatoryProcess
|
|
14
|
-
|
|
15
|
-
layout "decidim/admin/participatory_process"
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|