decidim-admin 0.5.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of decidim-admin might be problematic. Click here for more details.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c04a5698dcc71c7bda864b3e2e1ad1dc71882b6
|
4
|
+
data.tar.gz: 806b372b8d5c035db984dcde250d9124eb5aa959
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4e78726fdbeffba1faec39969af27b2be307b23d429106493a79ee324b7c57cc24a279ae715b4f47f0b7477ce898499d4ffdb53323e6a9391ed6615a12dd805
|
7
|
+
data.tar.gz: 56b59193bec6a7c7a189cbce4a465fa202653edc9320c85194d555deebbedac1452e3e0a62a8987666e3f0bbb5c6a1c156c21df5beb1ea4f3aa99348562c7739
|
data/README.md
CHANGED
@@ -8,11 +8,11 @@ module Decidim
|
|
8
8
|
# Public: Initializes the command.
|
9
9
|
#
|
10
10
|
# form - A form object with the params.
|
11
|
-
#
|
11
|
+
# participatory_space - The participatory space that will hold the
|
12
12
|
# category
|
13
|
-
def initialize(form,
|
13
|
+
def initialize(form, participatory_space)
|
14
14
|
@form = form
|
15
|
-
@
|
15
|
+
@participatory_space = participatory_space
|
16
16
|
end
|
17
17
|
|
18
18
|
# Executes the command. Broadcasts these events:
|
@@ -37,7 +37,7 @@ module Decidim
|
|
37
37
|
name: form.name,
|
38
38
|
description: form.description,
|
39
39
|
parent_id: form.parent_id,
|
40
|
-
|
40
|
+
participatory_space: @participatory_space
|
41
41
|
)
|
42
42
|
end
|
43
43
|
end
|
@@ -4,17 +4,17 @@ module Decidim
|
|
4
4
|
module Admin
|
5
5
|
# This command gets called when a feature is created from the admin panel.
|
6
6
|
class CreateFeature < Rectify::Command
|
7
|
-
attr_reader :form, :manifest, :
|
7
|
+
attr_reader :form, :manifest, :participatory_space
|
8
8
|
|
9
9
|
# Public: Initializes the command.
|
10
10
|
#
|
11
|
-
# manifest
|
12
|
-
# form
|
13
|
-
#
|
14
|
-
def initialize(manifest, form,
|
11
|
+
# manifest - The feature's manifest to create a feature from.
|
12
|
+
# form - The form from which the data in this feature comes from.
|
13
|
+
# participatory_space - The participatory space that will hold this feature.
|
14
|
+
def initialize(manifest, form, participatory_space)
|
15
15
|
@manifest = manifest
|
16
16
|
@form = form
|
17
|
-
@
|
17
|
+
@participatory_space = participatory_space
|
18
18
|
end
|
19
19
|
|
20
20
|
# Public: Creates the Feature.
|
@@ -37,7 +37,7 @@ module Decidim
|
|
37
37
|
@feature = Feature.create!(
|
38
38
|
manifest_name: manifest.name,
|
39
39
|
name: form.name,
|
40
|
-
|
40
|
+
participatory_space: participatory_space,
|
41
41
|
settings: form.settings,
|
42
42
|
default_step_settings: form.default_step_settings,
|
43
43
|
step_settings: form.step_settings
|
@@ -13,8 +13,6 @@ module Decidim
|
|
13
13
|
helper Decidim::Admin::ApplicationHelper
|
14
14
|
helper Decidim::Admin::AttributesDisplayHelper
|
15
15
|
helper Decidim::Admin::SettingsHelper
|
16
|
-
helper Decidim::Admin::ProcessGroupsForSelectHelper
|
17
|
-
helper Decidim::Admin::ProcessesForSelectHelper
|
18
16
|
helper Decidim::Admin::IconLinkHelper
|
19
17
|
helper Decidim::Admin::MenuHelper
|
20
18
|
helper Decidim::Admin::ScopesHelper
|
@@ -5,7 +5,7 @@ module Decidim
|
|
5
5
|
# Controller that allows managing categories.
|
6
6
|
#
|
7
7
|
class CategoriesController < Decidim::Admin::ApplicationController
|
8
|
-
|
8
|
+
helper_method :current_participatory_space
|
9
9
|
|
10
10
|
def index
|
11
11
|
authorize! :read, Decidim::Category
|
@@ -13,17 +13,17 @@ module Decidim
|
|
13
13
|
|
14
14
|
def new
|
15
15
|
authorize! :create, Decidim::Category
|
16
|
-
@form = form(CategoryForm).from_params({},
|
16
|
+
@form = form(CategoryForm).from_params({}, current_participatory_space: current_participatory_space)
|
17
17
|
end
|
18
18
|
|
19
19
|
def create
|
20
20
|
authorize! :create, Decidim::Category
|
21
|
-
@form = form(CategoryForm).from_params(params,
|
21
|
+
@form = form(CategoryForm).from_params(params, current_participatory_space: current_participatory_space)
|
22
22
|
|
23
|
-
CreateCategory.call(@form,
|
23
|
+
CreateCategory.call(@form, current_participatory_space) do
|
24
24
|
on(:ok) do
|
25
25
|
flash[:notice] = I18n.t("categories.create.success", scope: "decidim.admin")
|
26
|
-
redirect_to categories_path(
|
26
|
+
redirect_to categories_path(current_participatory_space)
|
27
27
|
end
|
28
28
|
|
29
29
|
on(:invalid) do
|
@@ -36,18 +36,18 @@ module Decidim
|
|
36
36
|
def edit
|
37
37
|
@category = collection.find(params[:id])
|
38
38
|
authorize! :update, @category
|
39
|
-
@form = form(CategoryForm).from_model(@category,
|
39
|
+
@form = form(CategoryForm).from_model(@category, current_participatory_space: current_participatory_space)
|
40
40
|
end
|
41
41
|
|
42
42
|
def update
|
43
43
|
@category = collection.find(params[:id])
|
44
44
|
authorize! :update, @category
|
45
|
-
@form = form(CategoryForm).from_params(params,
|
45
|
+
@form = form(CategoryForm).from_params(params, current_participatory_space: current_participatory_space)
|
46
46
|
|
47
47
|
UpdateCategory.call(@category, @form) do
|
48
48
|
on(:ok) do
|
49
49
|
flash[:notice] = I18n.t("categories.update.success", scope: "decidim.admin")
|
50
|
-
redirect_to categories_path(
|
50
|
+
redirect_to categories_path(current_participatory_space)
|
51
51
|
end
|
52
52
|
|
53
53
|
on(:invalid) do
|
@@ -75,14 +75,14 @@ module Decidim
|
|
75
75
|
flash[:alert] = I18n.t("categories.destroy.error", scope: "decidim.admin")
|
76
76
|
end
|
77
77
|
|
78
|
-
redirect_back(fallback_location: categories_path(
|
78
|
+
redirect_back(fallback_location: categories_path(current_participatory_space))
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
82
|
private
|
83
83
|
|
84
84
|
def collection
|
85
|
-
@collection ||=
|
85
|
+
@collection ||= current_participatory_space.categories.includes(:subcategories)
|
86
86
|
end
|
87
87
|
end
|
88
88
|
end
|
@@ -4,7 +4,6 @@ module Decidim
|
|
4
4
|
module Admin
|
5
5
|
# This controller allows admins to manage proposals in a participatory process.
|
6
6
|
class ExportsController < Decidim::Admin::ApplicationController
|
7
|
-
include Concerns::ParticipatoryProcessAdmin
|
8
7
|
include Decidim::FeaturePathHelper
|
9
8
|
|
10
9
|
def create
|
@@ -25,7 +24,7 @@ module Decidim
|
|
25
24
|
end
|
26
25
|
|
27
26
|
def feature
|
28
|
-
@feature ||=
|
27
|
+
@feature ||= current_participatory_space.features.find(params[:feature_id])
|
29
28
|
end
|
30
29
|
end
|
31
30
|
end
|
@@ -5,7 +5,6 @@ module Decidim
|
|
5
5
|
# Controller that allows managing feature permissions.
|
6
6
|
#
|
7
7
|
class FeaturePermissionsController < Decidim::Admin::ApplicationController
|
8
|
-
include Concerns::ParticipatoryProcessAdmin
|
9
8
|
helper_method :authorizations, :feature
|
10
9
|
|
11
10
|
def edit
|
@@ -22,7 +21,7 @@ module Decidim
|
|
22
21
|
UpdateFeaturePermissions.call(@permissions_form, feature) do
|
23
22
|
on(:ok) do
|
24
23
|
flash[:notice] = t("feature_permissions.update.success", scope: "decidim.admin")
|
25
|
-
redirect_to features_path(
|
24
|
+
redirect_to features_path(current_participatory_space)
|
26
25
|
end
|
27
26
|
|
28
27
|
on(:invalid) do
|
@@ -51,7 +50,7 @@ module Decidim
|
|
51
50
|
end
|
52
51
|
|
53
52
|
def feature
|
54
|
-
@feature ||=
|
53
|
+
@feature ||= current_participatory_space.features.find(params[:feature_id])
|
55
54
|
end
|
56
55
|
end
|
57
56
|
end
|
@@ -7,16 +7,18 @@ module Decidim
|
|
7
7
|
# controllers in their admin engines should inherit from.
|
8
8
|
class BaseController < Admin::ApplicationController
|
9
9
|
skip_authorize_resource
|
10
|
-
include Concerns::ParticipatoryProcessAdmin
|
11
10
|
include Settings
|
12
11
|
|
13
12
|
helper Decidim::ResourceHelper
|
14
13
|
helper Decidim::Admin::ExportsHelper
|
15
14
|
|
16
15
|
helper_method :current_feature,
|
16
|
+
:current_participatory_space,
|
17
17
|
:parent_path
|
18
18
|
|
19
|
-
|
19
|
+
before_action do
|
20
|
+
extend current_participatory_space.admin_extension_module
|
21
|
+
end
|
20
22
|
|
21
23
|
before_action except: [:index, :show] do
|
22
24
|
authorize! :manage, current_feature
|
@@ -30,8 +32,12 @@ module Decidim
|
|
30
32
|
request.env["decidim.current_feature"]
|
31
33
|
end
|
32
34
|
|
35
|
+
def current_participatory_space
|
36
|
+
current_feature.participatory_space
|
37
|
+
end
|
38
|
+
|
33
39
|
def parent_path
|
34
|
-
|
40
|
+
@parent_path ||= EngineRouter.admin_proxy(current_participatory_space).features_path
|
35
41
|
end
|
36
42
|
end
|
37
43
|
end
|
@@ -6,14 +6,12 @@ module Decidim
|
|
6
6
|
# admin panel.
|
7
7
|
#
|
8
8
|
class FeaturesController < Decidim::Admin::ApplicationController
|
9
|
-
|
10
|
-
|
11
|
-
helper_method :manifest
|
9
|
+
helper_method :manifest, :current_participatory_space
|
12
10
|
|
13
11
|
def index
|
14
12
|
authorize! :read, Feature
|
15
13
|
@manifests = Decidim.feature_manifests
|
16
|
-
@features =
|
14
|
+
@features = current_participatory_space.features
|
17
15
|
end
|
18
16
|
|
19
17
|
def new
|
@@ -22,7 +20,7 @@ module Decidim
|
|
22
20
|
@feature = Feature.new(
|
23
21
|
name: default_name(manifest),
|
24
22
|
manifest_name: params[:type],
|
25
|
-
|
23
|
+
participatory_space: current_participatory_space
|
26
24
|
)
|
27
25
|
|
28
26
|
@form = form(FeatureForm).from_model(@feature)
|
@@ -32,7 +30,7 @@ module Decidim
|
|
32
30
|
@form = form(FeatureForm).from_params(params)
|
33
31
|
authorize! :create, Feature
|
34
32
|
|
35
|
-
CreateFeature.call(manifest, @form,
|
33
|
+
CreateFeature.call(manifest, @form, current_participatory_space) do
|
36
34
|
on(:ok) do
|
37
35
|
flash[:notice] = I18n.t("features.create.success", scope: "decidim.admin")
|
38
36
|
redirect_to action: :index
|
@@ -110,7 +108,7 @@ module Decidim
|
|
110
108
|
private
|
111
109
|
|
112
110
|
def query_scope
|
113
|
-
|
111
|
+
current_participatory_space.features
|
114
112
|
end
|
115
113
|
|
116
114
|
def manifest
|
@@ -4,8 +4,6 @@ module Decidim
|
|
4
4
|
module Admin
|
5
5
|
# This controller allows admins to manage moderations in a participatory process.
|
6
6
|
class ModerationsController < Decidim::Admin::ApplicationController
|
7
|
-
include Concerns::ParticipatoryProcessAdmin
|
8
|
-
|
9
7
|
helper_method :moderations
|
10
8
|
|
11
9
|
def index
|
@@ -49,19 +47,19 @@ module Decidim
|
|
49
47
|
def moderations
|
50
48
|
@moderations ||= begin
|
51
49
|
if params[:hidden]
|
52
|
-
|
50
|
+
participatory_space_moderations.where.not(hidden_at: nil)
|
53
51
|
else
|
54
|
-
|
52
|
+
participatory_space_moderations.where(hidden_at: nil)
|
55
53
|
end
|
56
54
|
end
|
57
55
|
end
|
58
56
|
|
59
57
|
def reportable
|
60
|
-
@reportable ||=
|
58
|
+
@reportable ||= participatory_space_moderations.find(params[:id]).reportable
|
61
59
|
end
|
62
60
|
|
63
|
-
def
|
64
|
-
@
|
61
|
+
def participatory_space_moderations
|
62
|
+
@participatory_space_moderations ||= Decidim::Moderation.where(participatory_space: current_participatory_space)
|
65
63
|
end
|
66
64
|
end
|
67
65
|
end
|
@@ -10,11 +10,7 @@ module Decidim
|
|
10
10
|
|
11
11
|
def index
|
12
12
|
authorize! :index, Scope
|
13
|
-
@scopes =
|
14
|
-
parent_scope.children
|
15
|
-
else
|
16
|
-
collection.top_level
|
17
|
-
end
|
13
|
+
@scopes = children_scopes.order("name->'#{I18n.locale}' ASC")
|
18
14
|
end
|
19
15
|
|
20
16
|
def new
|
@@ -71,16 +67,22 @@ module Decidim
|
|
71
67
|
|
72
68
|
private
|
73
69
|
|
74
|
-
def
|
75
|
-
|
70
|
+
def organization_scopes
|
71
|
+
current_organization.scopes
|
76
72
|
end
|
77
73
|
|
78
74
|
def parent_scope
|
79
|
-
@parent_scope
|
75
|
+
return @parent_scope if defined?(@parent_scope)
|
76
|
+
@parent_scope = scope ? scope.parent : organization_scopes.find_by_id(params[:scope_id])
|
80
77
|
end
|
81
78
|
|
82
|
-
def
|
83
|
-
|
79
|
+
def scope
|
80
|
+
return @scope if defined?(@scope)
|
81
|
+
@scope = organization_scopes.find_by_id(params[:id])
|
82
|
+
end
|
83
|
+
|
84
|
+
def children_scopes
|
85
|
+
@subscopes ||= parent_scope ? parent_scope.children : organization_scopes.top_level
|
84
86
|
end
|
85
87
|
|
86
88
|
def current_scopes_path
|
@@ -21,9 +21,7 @@ module Decidim
|
|
21
21
|
default_params = {
|
22
22
|
organization: current_organization,
|
23
23
|
invitation_instructions: "invite_admin",
|
24
|
-
invited_by: current_user
|
25
|
-
comments_notifications: true,
|
26
|
-
replies_notifications: true
|
24
|
+
invited_by: current_user
|
27
25
|
}
|
28
26
|
|
29
27
|
@form = form(InviteUserForm).from_params(params.merge(default_params))
|
@@ -16,10 +16,10 @@ module Decidim
|
|
16
16
|
validates :name, :description, translatable_presence: true
|
17
17
|
validates :parent_id, inclusion: { in: :parent_categories_ids }, allow_blank: true
|
18
18
|
|
19
|
-
delegate :
|
19
|
+
delegate :current_participatory_space, to: :context, prefix: false
|
20
20
|
|
21
21
|
def parent_categories
|
22
|
-
@parent_categories ||=
|
22
|
+
@parent_categories ||= current_participatory_space.categories.first_class.where.not(id: id)
|
23
23
|
end
|
24
24
|
|
25
25
|
private
|
@@ -19,13 +19,7 @@ module Decidim
|
|
19
19
|
attribute :weight, Integer, default: 0
|
20
20
|
|
21
21
|
attribute :step_settings, Hash[String => Object]
|
22
|
-
attribute :
|
23
|
-
|
24
|
-
def map_model(model)
|
25
|
-
self.attributes = model.attributes
|
26
|
-
self.settings = model.settings
|
27
|
-
self.default_step_settings = model.default_step_settings
|
28
|
-
end
|
22
|
+
attribute :participatory_space
|
29
23
|
|
30
24
|
def settings?
|
31
25
|
settings.manifest.attributes.any?
|
@@ -34,17 +28,6 @@ module Decidim
|
|
34
28
|
def default_step_settings?
|
35
29
|
default_step_settings.manifest.attributes.any?
|
36
30
|
end
|
37
|
-
|
38
|
-
def step_settings?
|
39
|
-
return false unless participatory_process.steps.any?
|
40
|
-
|
41
|
-
step_settings
|
42
|
-
.values
|
43
|
-
.map(&:manifest)
|
44
|
-
.flat_map(&:attributes)
|
45
|
-
.flat_map(&:keys)
|
46
|
-
.any?
|
47
|
-
end
|
48
31
|
end
|
49
32
|
end
|
50
33
|
end
|