decidim-participatory_processes 0.29.1 → 0.30.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/participatory_process_groups/process_filters_cell.rb +4 -5
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_settings_form/show.erb +1 -1
- data/app/cells/decidim/participatory_processes/process_dropdown_metadata_cell.rb +7 -0
- data/app/cells/decidim/participatory_processes/process_filters/show.erb +0 -1
- data/app/cells/decidim/participatory_processes/process_filters_cell.rb +6 -32
- data/app/commands/decidim/participatory_processes/admin/copy_participatory_process.rb +2 -23
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process.rb +3 -3
- data/app/commands/decidim/participatory_processes/admin/import_participatory_process.rb +0 -1
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process.rb +3 -3
- data/app/controllers/decidim/participatory_processes/admin/component_share_tokens_controller.rb +18 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_share_tokens_controller.rb +16 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb +15 -3
- data/app/controllers/decidim/participatory_processes/participatory_processes_controller.rb +2 -4
- data/app/controllers/decidim/participatory_processes/participatory_space_private_users_controller.rb +27 -0
- data/app/forms/decidim/participatory_processes/admin/participatory_process_copy_form.rb +0 -1
- data/app/forms/decidim/participatory_processes/admin/participatory_process_form.rb +6 -36
- data/app/forms/decidim/participatory_processes/admin/participatory_process_import_form.rb +0 -1
- data/app/helpers/decidim/participatory_processes/participatory_process_helper.rb +28 -20
- data/app/jobs/decidim/participatory_processes/change_active_step_job.rb +1 -1
- data/app/models/decidim/participatory_process.rb +19 -3
- data/app/permissions/decidim/participatory_processes/permissions.rb +15 -14
- data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb +1 -1
- data/app/presenters/decidim/participatory_processes/participatory_process_group_presenter.rb +1 -1
- data/app/presenters/decidim/participatory_processes/participatory_process_presenter.rb +1 -1
- data/app/queries/decidim/participatory_processes/metrics/participatory_process_followers_metric_measure.rb +2 -2
- data/app/queries/decidim/participatory_processes/metrics/participatory_processes_metric_manage.rb +2 -2
- data/app/serializers/decidim/participatory_processes/open_data_participatory_process_serializer.rb +47 -0
- data/app/serializers/decidim/participatory_processes/participatory_process_importer.rb +1 -43
- data/app/serializers/decidim/participatory_processes/participatory_process_serializer.rb +17 -126
- data/app/views/decidim/participatory_processes/admin/participatory_process_copies/_form.html.erb +0 -4
- data/app/views/decidim/participatory_processes/admin/participatory_process_imports/_form.html.erb +0 -3
- data/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb +25 -60
- data/app/views/decidim/participatory_processes/admin/participatory_processes/_process_row.html.erb +83 -0
- data/app/views/decidim/participatory_processes/admin/participatory_processes/_processes_thead.html.erb +19 -0
- data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +16 -84
- data/app/views/decidim/participatory_processes/admin/participatory_processes/manage_trash.html.erb +20 -0
- data/app/views/decidim/participatory_processes/participatory_process_groups/show.html.erb +3 -1
- data/app/views/decidim/participatory_processes/participatory_processes/index.html.erb +3 -1
- data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +6 -6
- data/app/views/decidim/participatory_processes/participatory_space_private_users/index.html.erb +22 -0
- data/config/assets.rb +1 -2
- data/config/locales/ar.yml +3 -7
- data/config/locales/bg.yml +0 -36
- data/config/locales/bn-BD.yml +1 -0
- data/config/locales/bs-BA.yml +23 -0
- data/config/locales/ca.yml +61 -36
- data/config/locales/cs.yml +61 -36
- data/config/locales/de.yml +60 -35
- data/config/locales/el.yml +0 -36
- data/config/locales/en.yml +61 -36
- data/config/locales/es-MX.yml +60 -35
- data/config/locales/es-PY.yml +60 -35
- data/config/locales/es.yml +60 -35
- data/config/locales/eu.yml +103 -78
- data/config/locales/fi-plain.yml +61 -36
- data/config/locales/fi.yml +67 -42
- data/config/locales/fr-CA.yml +24 -35
- data/config/locales/fr.yml +24 -35
- data/config/locales/ga-IE.yml +0 -4
- data/config/locales/gl.yml +0 -7
- data/config/locales/hu.yml +0 -36
- data/config/locales/id-ID.yml +0 -7
- data/config/locales/is-IS.yml +0 -3
- data/config/locales/it.yml +0 -10
- data/config/locales/ja.yml +61 -36
- data/config/locales/lb.yml +0 -9
- data/config/locales/lt.yml +0 -36
- data/config/locales/lv.yml +0 -10
- data/config/locales/nl.yml +0 -10
- data/config/locales/no.yml +0 -36
- data/config/locales/pl.yml +0 -36
- data/config/locales/pt-BR.yml +0 -25
- data/config/locales/pt.yml +6 -10
- data/config/locales/ro-RO.yml +6 -36
- data/config/locales/ru.yml +0 -4
- data/config/locales/sk.yml +0 -10
- data/config/locales/sr-CS.yml +0 -9
- data/config/locales/sv.yml +62 -43
- data/config/locales/tr-TR.yml +0 -10
- data/config/locales/uk.yml +0 -4
- data/config/locales/zh-CN.yml +0 -10
- data/config/locales/zh-TW.yml +0 -36
- data/db/migrate/20210310120750_add_followable_counter_cache_to_participatory_processes.rb +1 -1
- data/db/migrate/20240822161355_add_deleted_at_to_decidim_participatory_processes.rb +8 -0
- data/db/migrate/20241108141423_remove_column_show_metrics_from_participatory_processes.rb +7 -0
- data/db/migrate/20241108141514_remove_column_banner_image_from_participatory_processes.rb +7 -0
- data/db/migrate/20241108141605_remove_column_show_statistics_from_participatory_processes.rb +7 -0
- data/decidim-participatory_processes.gemspec +2 -2
- data/lib/decidim/api/participatory_process_group_type.rb +3 -3
- data/lib/decidim/api/participatory_process_step_type.rb +7 -9
- data/lib/decidim/api/participatory_process_type.rb +18 -23
- data/lib/decidim/api/participatory_process_type_type.rb +3 -3
- data/lib/decidim/participatory_processes/admin_engine.rb +85 -59
- data/lib/decidim/participatory_processes/content_blocks/registry_manager.rb +11 -0
- data/lib/decidim/participatory_processes/engine.rb +7 -0
- data/lib/decidim/participatory_processes/menu.rb +9 -17
- data/lib/decidim/participatory_processes/participatory_space.rb +5 -2
- data/lib/decidim/participatory_processes/query_extensions.rb +26 -0
- data/lib/decidim/participatory_processes/seeds.rb +8 -16
- data/lib/decidim/participatory_processes/test/factories.rb +14 -14
- data/lib/decidim/participatory_processes/version.rb +1 -1
- metadata +27 -26
- data/app/cells/decidim/participatory_processes/process_filters/type_filter.erb +0 -17
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process_type.rb +0 -17
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process_type.rb +0 -13
- data/app/controllers/decidim/participatory_processes/admin/categories_controller.rb +0 -13
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_types_controller.rb +0 -117
- data/app/forms/decidim/participatory_processes/admin/participatory_process_type_form.rb +0 -20
- data/app/helpers/decidim/participatory_processes/admin/participatory_process_helper.rb +0 -24
- data/app/packs/entrypoints/decidim_participatory_processes_admin.js +0 -1
- data/app/packs/src/decidim/participatory_processes/admin/participatory_processes.js +0 -18
- data/app/views/decidim/participatory_processes/admin/participatory_process_types/_form.html.erb +0 -9
- data/app/views/decidim/participatory_processes/admin/participatory_process_types/edit.html.erb +0 -18
- data/app/views/decidim/participatory_processes/admin/participatory_process_types/index.html.erb +0 -58
- data/app/views/decidim/participatory_processes/admin/participatory_process_types/new.html.erb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbfb295a849ce25e210c1a15ab82ddbb956bca9f5162059bc198996f8ff49bfc
|
4
|
+
data.tar.gz: 753b670abee7c70c2eab25a172714f205cd712f07242a6fe5ee8a888457cbf82
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ad3ae1d2c5f1964e78ebd2d83a4b424c3f7799110623b22d75d71f3cf184daea23d93ab81e69d0c40f13b0d4b834e4945f32ade829b537d49f4d036ef59cf59
|
7
|
+
data.tar.gz: 4fcb241071f32cfc906018a189c9a19fc4c28588386bc9b9b5e4edb1e5d7e5ce4ade3d7ea0374d51e14886962a26f9090de7ce60bd7fee4840d0054a040b723d
|
@@ -25,11 +25,11 @@ module Decidim
|
|
25
25
|
# date_filter: "active"
|
26
26
|
# )
|
27
27
|
class ProcessFiltersCell < Decidim::ParticipatoryProcesses::ProcessFiltersCell
|
28
|
-
def filter_link(date_filter
|
28
|
+
def filter_link(date_filter)
|
29
29
|
Decidim::ParticipatoryProcesses::Engine
|
30
30
|
.routes
|
31
31
|
.url_helpers
|
32
|
-
.participatory_process_group_path(model, **filter_params(date_filter
|
32
|
+
.participatory_process_group_path(model, **filter_params(date_filter))
|
33
33
|
end
|
34
34
|
|
35
35
|
def current_filter
|
@@ -52,13 +52,12 @@ module Decidim
|
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
|
-
def filtered_processes(date_filter
|
55
|
+
def filtered_processes(date_filter)
|
56
56
|
query = base_relation.ransack(
|
57
57
|
{
|
58
58
|
with_date: date_filter,
|
59
59
|
with_any_scope: get_filter(:with_any_scope),
|
60
|
-
with_any_area: get_filter(:with_any_area)
|
61
|
-
with_any_type: filter_with_type ? get_filter(:with_any_type) : nil
|
60
|
+
with_any_area: get_filter(:with_any_area)
|
62
61
|
},
|
63
62
|
current_user:,
|
64
63
|
organization: current_organization
|
@@ -20,11 +20,18 @@ module Decidim
|
|
20
20
|
hash << "decidim/process_dropdown_metadata"
|
21
21
|
hash << id
|
22
22
|
hash << current_user.try(:id).to_s
|
23
|
+
hash << nav_items_hashes.join("-")
|
23
24
|
hash << I18n.locale.to_s
|
24
25
|
|
25
26
|
hash.join(Decidim.cache_key_separator)
|
26
27
|
end
|
27
28
|
|
29
|
+
def nav_items_hashes
|
30
|
+
nav_items.map do |item|
|
31
|
+
item[:id]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
28
35
|
def step_title
|
29
36
|
decidim_html_escape translated_attribute(process.active_step&.title)
|
30
37
|
end
|
@@ -5,22 +5,17 @@ module Decidim
|
|
5
5
|
class ProcessFiltersCell < Decidim::ViewModel
|
6
6
|
ALL_FILTERS = %w(active upcoming past all).freeze
|
7
7
|
|
8
|
-
def filter_link(date_filter
|
8
|
+
def filter_link(date_filter)
|
9
9
|
Decidim::ParticipatoryProcesses::Engine
|
10
10
|
.routes
|
11
11
|
.url_helpers
|
12
|
-
.participatory_processes_path(**filter_params(date_filter
|
12
|
+
.participatory_processes_path(**filter_params(date_filter))
|
13
13
|
end
|
14
14
|
|
15
15
|
def current_filter
|
16
16
|
get_filter_in(:with_date, ALL_FILTERS, model[:default_filter])
|
17
17
|
end
|
18
18
|
|
19
|
-
def current_type_filter_name
|
20
|
-
participatory_process_types_for_select.find { |_, id| id == get_filter(:with_any_type) }&.first ||
|
21
|
-
I18n.t("all_types", scope: "decidim.participatory_processes.participatory_processes.filters")
|
22
|
-
end
|
23
|
-
|
24
19
|
def get_filter(filter_name, default = nil)
|
25
20
|
params&.dig(:filter, filter_name) || default
|
26
21
|
end
|
@@ -30,24 +25,22 @@ module Decidim
|
|
30
25
|
options.include?(value) ? value : default
|
31
26
|
end
|
32
27
|
|
33
|
-
def filter_params(date_filter
|
28
|
+
def filter_params(date_filter)
|
34
29
|
{
|
35
30
|
filter: {
|
36
31
|
with_date: date_filter,
|
37
32
|
with_any_scope: get_filter(:with_any_scope),
|
38
|
-
with_any_area: get_filter(:with_any_area)
|
39
|
-
with_any_type: type_filter || get_filter(:with_any_type)
|
33
|
+
with_any_area: get_filter(:with_any_area)
|
40
34
|
}
|
41
35
|
}
|
42
36
|
end
|
43
37
|
|
44
|
-
def filtered_processes(date_filter
|
38
|
+
def filtered_processes(date_filter)
|
45
39
|
query = ParticipatoryProcess.where(organization: current_organization).ransack(
|
46
40
|
{
|
47
41
|
with_date: date_filter,
|
48
42
|
with_any_scope: get_filter(:with_any_scope),
|
49
|
-
with_any_area: get_filter(:with_any_area)
|
50
|
-
with_any_type: filter_with_type ? get_filter(:with_any_type) : nil
|
43
|
+
with_any_area: get_filter(:with_any_area)
|
51
44
|
},
|
52
45
|
current_user:
|
53
46
|
).result
|
@@ -86,10 +79,6 @@ module Decidim
|
|
86
79
|
I18n.t(current_filter, scope: "decidim.participatory_processes.participatory_processes.filters.counters", count: process_count_by_filter[current_filter])
|
87
80
|
end
|
88
81
|
|
89
|
-
def filter_type_label
|
90
|
-
I18n.t("filter_by", scope: "decidim.participatory_processes.participatory_processes.filters")
|
91
|
-
end
|
92
|
-
|
93
82
|
def filter_name(filter)
|
94
83
|
I18n.t(filter, scope: "decidim.participatory_processes.participatory_processes.filters.names")
|
95
84
|
end
|
@@ -108,21 +97,6 @@ module Decidim
|
|
108
97
|
|
109
98
|
"no_active_nor_upcoming"
|
110
99
|
end
|
111
|
-
|
112
|
-
def participatory_process_types
|
113
|
-
@participatory_process_types ||= Decidim::ParticipatoryProcessType.joins(:processes).where(
|
114
|
-
decidim_participatory_processes: { id: filtered_processes(current_filter, filter_with_type: false) }
|
115
|
-
).distinct
|
116
|
-
end
|
117
|
-
|
118
|
-
def participatory_process_types_for_select
|
119
|
-
return if participatory_process_types.blank?
|
120
|
-
|
121
|
-
[[I18n.t("all_types", scope: "decidim.participatory_processes.participatory_processes.filters"), ""]] +
|
122
|
-
participatory_process_types.map do |type|
|
123
|
-
[translated_attribute(type.title), type.id.to_s]
|
124
|
-
end
|
125
|
-
end
|
126
100
|
end
|
127
101
|
end
|
128
102
|
end
|
@@ -30,7 +30,6 @@ module Decidim
|
|
30
30
|
copy_participatory_process
|
31
31
|
copy_participatory_process_attachments
|
32
32
|
copy_participatory_process_steps if @form.copy_steps?
|
33
|
-
copy_participatory_process_categories if @form.copy_categories?
|
34
33
|
copy_participatory_process_components if @form.copy_components?
|
35
34
|
end
|
36
35
|
end
|
@@ -52,10 +51,8 @@ module Decidim
|
|
52
51
|
description: @participatory_process.description,
|
53
52
|
short_description: @participatory_process.short_description,
|
54
53
|
promoted: @participatory_process.promoted,
|
55
|
-
scope: @participatory_process.scope,
|
56
54
|
developer_group: @participatory_process.developer_group,
|
57
55
|
local_area: @participatory_process.local_area,
|
58
|
-
area: @participatory_process.area,
|
59
56
|
target: @participatory_process.target,
|
60
57
|
participatory_scope: @participatory_process.participatory_scope,
|
61
58
|
participatory_structure: @participatory_process.participatory_structure,
|
@@ -63,7 +60,8 @@ module Decidim
|
|
63
60
|
start_date: @participatory_process.start_date,
|
64
61
|
end_date: @participatory_process.end_date,
|
65
62
|
participatory_process_group: @participatory_process.participatory_process_group,
|
66
|
-
private_space: @participatory_process.private_space
|
63
|
+
private_space: @participatory_process.private_space,
|
64
|
+
taxonomies: @participatory_process.taxonomies
|
67
65
|
)
|
68
66
|
end
|
69
67
|
|
@@ -90,25 +88,6 @@ module Decidim
|
|
90
88
|
end
|
91
89
|
end
|
92
90
|
|
93
|
-
def copy_participatory_process_categories
|
94
|
-
@participatory_process.categories.first_class.each do |category|
|
95
|
-
new_category = Category.create!(
|
96
|
-
name: category.name,
|
97
|
-
description: category.description,
|
98
|
-
participatory_space: @copied_process
|
99
|
-
)
|
100
|
-
|
101
|
-
category.descendants.each do |child|
|
102
|
-
Category.create!(
|
103
|
-
name: child.name,
|
104
|
-
description: child.description,
|
105
|
-
participatory_space: @copied_process,
|
106
|
-
parent: new_category
|
107
|
-
)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
91
|
def copy_participatory_process_components
|
113
92
|
@participatory_process.components.each do |component|
|
114
93
|
copied_step_settings = @form.copy_steps? ? map_step_settings(component.step_settings) : {}
|
@@ -9,10 +9,10 @@ module Decidim
|
|
9
9
|
fetch_file_attributes :hero_image
|
10
10
|
|
11
11
|
fetch_form_attributes :organization, :title, :subtitle, :weight, :slug, :hashtag, :description,
|
12
|
-
:short_description, :promoted, :
|
13
|
-
:
|
12
|
+
:short_description, :promoted, :taxonomizations, :announcement,
|
13
|
+
:private_space, :developer_group, :local_area, :target,
|
14
14
|
:participatory_scope, :participatory_structure, :meta_scope, :start_date, :end_date,
|
15
|
-
:participatory_process_group
|
15
|
+
:participatory_process_group
|
16
16
|
|
17
17
|
protected
|
18
18
|
|
@@ -42,7 +42,6 @@ module Decidim
|
|
42
42
|
Decidim.traceability.perform_action!("import", Decidim::ParticipatoryProcess, current_user) do
|
43
43
|
@imported_process = importer.import(original_process, current_user, title: form.title, slug: form.slug)
|
44
44
|
importer.import_participatory_process_steps(original_process["participatory_process_steps"]) if form.import_steps?
|
45
|
-
importer.import_categories(original_process["participatory_process_categories"]) if form.import_categories?
|
46
45
|
importer.import_folders_and_attachments(original_process["attachments"]) if form.import_attachments?
|
47
46
|
importer.import_components(original_process["components"]) if form.import_components?
|
48
47
|
@imported_process
|
@@ -9,10 +9,10 @@ module Decidim
|
|
9
9
|
fetch_file_attributes :hero_image
|
10
10
|
|
11
11
|
fetch_form_attributes :title, :subtitle, :weight, :slug, :hashtag, :promoted, :description,
|
12
|
-
:short_description, :
|
13
|
-
:private_space, :developer_group, :local_area, :
|
12
|
+
:short_description, :taxonomizations,
|
13
|
+
:private_space, :developer_group, :local_area, :target, :participatory_scope,
|
14
14
|
:participatory_structure, :meta_scope, :start_date, :end_date, :participatory_process_group,
|
15
|
-
:
|
15
|
+
:announcement
|
16
16
|
|
17
17
|
private
|
18
18
|
|
data/app/controllers/decidim/participatory_processes/admin/component_share_tokens_controller.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
module Admin
|
6
|
+
# This controller allows sharing unpublished things.
|
7
|
+
# It is targeted for customizations for sharing unpublished things that lives under
|
8
|
+
# an process.
|
9
|
+
class ComponentShareTokensController < Decidim::Admin::ShareTokensController
|
10
|
+
include Concerns::ParticipatoryProcessAdmin
|
11
|
+
|
12
|
+
def resource
|
13
|
+
@resource ||= current_participatory_space.components.find(params[:component_id])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
module Admin
|
6
|
+
# This controller allows admins to manage moderations in a participatory process.
|
7
|
+
class ParticipatoryProcessShareTokensController < Decidim::Admin::ShareTokensController
|
8
|
+
include Concerns::ParticipatoryProcessAdmin
|
9
|
+
|
10
|
+
def resource
|
11
|
+
current_participatory_process
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb
CHANGED
@@ -8,13 +8,13 @@ module Decidim
|
|
8
8
|
class ParticipatoryProcessesController < Decidim::ParticipatoryProcesses::Admin::ApplicationController
|
9
9
|
include Decidim::Admin::ParticipatorySpaceAdminContext
|
10
10
|
include Decidim::ParticipatoryProcesses::Admin::Filterable
|
11
|
+
include Decidim::Admin::HasTrashableResources
|
11
12
|
|
12
13
|
add_breadcrumb_item_from_menu :admin_participatory_process_menu, only: :show
|
13
14
|
|
14
15
|
participatory_space_admin_layout only: [:edit]
|
15
16
|
|
16
17
|
helper ProcessGroupsForSelectHelper
|
17
|
-
helper Decidim::ParticipatoryProcesses::Admin::ParticipatoryProcessHelper
|
18
18
|
|
19
19
|
helper_method :current_participatory_process, :current_participatory_space, :process_group
|
20
20
|
|
@@ -79,6 +79,18 @@ module Decidim
|
|
79
79
|
|
80
80
|
private
|
81
81
|
|
82
|
+
def trashable_deleted_resource_type
|
83
|
+
:participatory_process
|
84
|
+
end
|
85
|
+
|
86
|
+
def trashable_deleted_resource
|
87
|
+
@trashable_deleted_resource ||= current_participatory_process
|
88
|
+
end
|
89
|
+
|
90
|
+
def trashable_deleted_collection
|
91
|
+
@trashable_deleted_collection = filtered_collection.only_deleted.deleted_at_desc
|
92
|
+
end
|
93
|
+
|
82
94
|
def process_group
|
83
95
|
@process_group ||= ParticipatoryProcessGroup.find_by(id: ransack_params[:decidim_participatory_process_group_id_eq], organization: current_organization)
|
84
96
|
end
|
@@ -88,8 +100,8 @@ module Decidim
|
|
88
100
|
end
|
89
101
|
|
90
102
|
def current_participatory_process
|
91
|
-
@current_participatory_process ||= collection.where(slug: params[:slug]).or(
|
92
|
-
collection.where(id: params[:slug])
|
103
|
+
@current_participatory_process ||= collection.with_deleted.where(slug: params[:slug]).or(
|
104
|
+
collection.with_deleted.where(id: params[:slug])
|
93
105
|
).first
|
94
106
|
end
|
95
107
|
|
@@ -38,14 +38,12 @@ module Decidim
|
|
38
38
|
private
|
39
39
|
|
40
40
|
def search_collection
|
41
|
-
ParticipatoryProcess.where(organization: current_organization).published.visible_for(current_user)
|
41
|
+
ParticipatoryProcess.where(organization: current_organization).published.visible_for(current_user)
|
42
42
|
end
|
43
43
|
|
44
44
|
def default_filter_params
|
45
45
|
{
|
46
|
-
|
47
|
-
with_any_area: nil,
|
48
|
-
with_any_type: nil,
|
46
|
+
with_any_taxonomies: nil,
|
49
47
|
with_date: default_date_filter
|
50
48
|
}
|
51
49
|
end
|
data/app/controllers/decidim/participatory_processes/participatory_space_private_users_controller.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
class ParticipatorySpacePrivateUsersController < Decidim::ParticipatoryProcesses::ApplicationController
|
6
|
+
include ParticipatorySpaceContext
|
7
|
+
include Decidim::HasMembersPage
|
8
|
+
|
9
|
+
def index
|
10
|
+
raise ActionController::RoutingError, "No members for this participatory process" if members.none?
|
11
|
+
|
12
|
+
enforce_permission_to :list, :members
|
13
|
+
redirect_to decidim_participatory_processes.participatory_process_path(current_participatory_space) unless can_visit_index?
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def current_participatory_space
|
19
|
+
return unless params[:participatory_process_slug]
|
20
|
+
|
21
|
+
@current_participatory_space ||= OrganizationParticipatoryProcesses.new(current_organization).query.where(slug: params[:participatory_process_slug]).or(
|
22
|
+
OrganizationParticipatoryProcesses.new(current_organization).query.where(id: params[:participatory_process_slug])
|
23
|
+
).first!
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -9,35 +9,31 @@ module Decidim
|
|
9
9
|
class ParticipatoryProcessForm < Form
|
10
10
|
include TranslatableAttributes
|
11
11
|
include Decidim::HasUploadValidations
|
12
|
+
include Decidim::HasTaxonomyFormAttributes
|
12
13
|
|
13
14
|
mimic :participatory_process
|
14
15
|
|
15
|
-
translatable_attribute :announcement,
|
16
|
-
translatable_attribute :description,
|
16
|
+
translatable_attribute :announcement, Decidim::Attributes::RichText
|
17
|
+
translatable_attribute :description, Decidim::Attributes::RichText
|
17
18
|
translatable_attribute :developer_group, String
|
18
19
|
translatable_attribute :local_area, String
|
19
20
|
translatable_attribute :meta_scope, String
|
20
21
|
translatable_attribute :participatory_scope, String
|
21
22
|
translatable_attribute :participatory_structure, String
|
22
23
|
translatable_attribute :subtitle, String
|
23
|
-
translatable_attribute :short_description,
|
24
|
+
translatable_attribute :short_description, Decidim::Attributes::RichText
|
24
25
|
translatable_attribute :title, String
|
25
26
|
translatable_attribute :target, String
|
26
27
|
|
27
28
|
attribute :hashtag, String
|
28
29
|
attribute :slug, String
|
29
30
|
|
30
|
-
attribute :area_id, Integer
|
31
31
|
attribute :participatory_process_group_id, Integer
|
32
|
-
attribute :scope_id, Integer
|
33
32
|
attribute :related_process_ids, Array[Integer]
|
34
|
-
attribute :scope_type_max_depth_id, Integer
|
35
33
|
attribute :weight, Integer, default: 0
|
36
34
|
|
37
35
|
attribute :private_space, Boolean
|
38
36
|
attribute :promoted, Boolean
|
39
|
-
attribute :scopes_enabled, Boolean
|
40
|
-
attribute :participatory_process_type_id, Integer
|
41
37
|
|
42
38
|
attribute :end_date, Decidim::Attributes::LocalizedDate
|
43
39
|
attribute :start_date, Decidim::Attributes::LocalizedDate
|
@@ -45,8 +41,6 @@ module Decidim
|
|
45
41
|
attribute :hero_image
|
46
42
|
attribute :remove_hero_image, Boolean, default: false
|
47
43
|
|
48
|
-
validates :area, presence: true, if: proc { |object| object.area_id.present? }
|
49
|
-
validates :scope, presence: true, if: proc { |object| object.scope_id.present? }
|
50
44
|
validates :slug, presence: true, format: { with: Decidim::ParticipatoryProcess.slug_format }
|
51
45
|
|
52
46
|
validate :slug_uniqueness
|
@@ -60,49 +54,25 @@ module Decidim
|
|
60
54
|
alias organization current_organization
|
61
55
|
|
62
56
|
def map_model(model)
|
63
|
-
self.scope_id = model.decidim_scope_id
|
64
57
|
self.participatory_process_group_id = model.decidim_participatory_process_group_id
|
65
|
-
self.participatory_process_type_id = model.decidim_participatory_process_type_id
|
66
58
|
self.related_process_ids = model.linked_participatory_space_resources(:participatory_process, "related_processes").pluck(:id)
|
67
59
|
@processes = Decidim::ParticipatoryProcess.where(organization: model.organization).where.not(id: model.id)
|
68
60
|
end
|
69
61
|
|
70
|
-
def
|
71
|
-
|
72
|
-
end
|
73
|
-
|
74
|
-
def scope_type_max_depth
|
75
|
-
@scope_type_max_depth ||= current_organization.scope_types.find_by(id: scope_type_max_depth_id)
|
76
|
-
end
|
77
|
-
|
78
|
-
def area
|
79
|
-
@area ||= current_organization.areas.find_by(id: area_id)
|
62
|
+
def participatory_space_manifest
|
63
|
+
:participatory_processes
|
80
64
|
end
|
81
65
|
|
82
66
|
def participatory_process_group
|
83
67
|
Decidim::ParticipatoryProcessGroup.find_by(id: participatory_process_group_id)
|
84
68
|
end
|
85
69
|
|
86
|
-
def participatory_process_type
|
87
|
-
Decidim::ParticipatoryProcessType.find_by(id: participatory_process_type_id)
|
88
|
-
end
|
89
|
-
|
90
70
|
def processes
|
91
71
|
@processes ||= Decidim::ParticipatoryProcess.where(organization: current_organization)
|
92
72
|
end
|
93
73
|
|
94
|
-
def participatory_process_types_for_select
|
95
|
-
@participatory_process_types_for_select ||= participatory_process_types.map do |type|
|
96
|
-
[translated_attribute(type.title), type.id]
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
74
|
private
|
101
75
|
|
102
|
-
def participatory_process_types
|
103
|
-
Decidim::ParticipatoryProcessType.where(organization: current_organization)
|
104
|
-
end
|
105
|
-
|
106
76
|
def organization_participatory_processes
|
107
77
|
OrganizationParticipatoryProcesses.new(current_organization).query
|
108
78
|
end
|
@@ -26,7 +26,6 @@ module Decidim
|
|
26
26
|
|
27
27
|
attribute :slug, String
|
28
28
|
attribute :import_steps, Boolean, default: true
|
29
|
-
attribute :import_categories, Boolean, default: true
|
30
29
|
attribute :import_attachments, Boolean, default: true
|
31
30
|
attribute :import_components, Boolean, default: true
|
32
31
|
attribute :document, Decidim::Attributes::Blob
|
@@ -59,37 +59,45 @@ module Decidim
|
|
59
59
|
|
60
60
|
# Items to display in the navigation of a process
|
61
61
|
def process_nav_items(participatory_space)
|
62
|
-
components = participatory_space
|
62
|
+
components = participatory_space
|
63
|
+
.components
|
64
|
+
.published.or(Decidim::Component.where(id: try(:current_component)))
|
65
|
+
.where(visible: true)
|
63
66
|
|
64
|
-
|
67
|
+
[
|
68
|
+
*(if participatory_space.members_public_page?
|
69
|
+
[{
|
70
|
+
name: t("member_menu_item", scope: "layouts.decidim.participatory_process_navigation"),
|
71
|
+
url: decidim_participatory_processes.participatory_process_participatory_space_private_users_path(participatory_space),
|
72
|
+
active: is_active_link?(decidim_participatory_processes.participatory_process_participatory_space_private_users_path(participatory_space), :inclusive)
|
73
|
+
}]
|
74
|
+
end
|
75
|
+
)
|
76
|
+
] + components.map do |component|
|
65
77
|
{
|
78
|
+
id: component.id,
|
66
79
|
name: decidim_escape_translated(component.name),
|
67
80
|
url: main_component_path(component),
|
68
81
|
active: is_active_link?(main_component_path(component), :inclusive)
|
69
82
|
}
|
70
|
-
end
|
83
|
+
end.compact
|
71
84
|
end
|
72
85
|
|
73
86
|
def filter_sections
|
74
|
-
[
|
75
|
-
{ method: :with_date, collection: filter_dates_values,
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
87
|
+
items = [
|
88
|
+
{ method: :with_date, collection: filter_dates_values, label: t("decidim.participatory_processes.participatory_processes.filters.date"), id: "date" }
|
89
|
+
]
|
90
|
+
available_taxonomy_filters.find_each do |taxonomy_filter|
|
91
|
+
items.append(method: "with_any_taxonomies[#{taxonomy_filter.root_taxonomy_id}]",
|
92
|
+
collection: filter_taxonomy_values_for(taxonomy_filter),
|
93
|
+
label: decidim_sanitize_translated(taxonomy_filter.name),
|
94
|
+
id: "taxonomy")
|
95
|
+
end
|
96
|
+
items.reject { |item| item[:collection].blank? }
|
84
97
|
end
|
85
98
|
|
86
|
-
def
|
87
|
-
|
88
|
-
|
89
|
-
type_values = process_types.map { |type| [type.id.to_s, translated_attribute(type.title)] }
|
90
|
-
type_values.prepend(["", t("decidim.participatory_processes.participatory_processes.filters.names.all")])
|
91
|
-
|
92
|
-
filter_tree_from_array(type_values)
|
99
|
+
def available_taxonomy_filters
|
100
|
+
Decidim::TaxonomyFilter.for(current_organization).for_manifest(:participatory_processes)
|
93
101
|
end
|
94
102
|
|
95
103
|
def filter_dates_values
|
@@ -16,7 +16,7 @@ module Decidim
|
|
16
16
|
active_step = process.steps.find_by(active: true)
|
17
17
|
if steps.empty? && active_step
|
18
18
|
next_position = active_step.position + 1
|
19
|
-
next_step = process.steps.where(
|
19
|
+
next_step = process.steps.where(start_date: ..Time.zone.now.to_date).find_by(position: next_position)
|
20
20
|
if next_step.present?
|
21
21
|
active_step.update(active: false)
|
22
22
|
next_step.update(active: true)
|
@@ -12,6 +12,7 @@ module Decidim
|
|
12
12
|
include Decidim::Participable
|
13
13
|
include Decidim::Publicable
|
14
14
|
include Decidim::ScopableParticipatorySpace
|
15
|
+
include Decidim::Taxonomizable
|
15
16
|
include Decidim::Followable
|
16
17
|
include Decidim::HasReference
|
17
18
|
include Decidim::Traceable
|
@@ -23,6 +24,8 @@ module Decidim
|
|
23
24
|
include Decidim::TranslatableResource
|
24
25
|
include Decidim::HasArea
|
25
26
|
include Decidim::FilterableResource
|
27
|
+
include Decidim::SoftDeletable
|
28
|
+
include Decidim::ShareableWithToken
|
26
29
|
|
27
30
|
translatable_fields :title, :subtitle, :short_description, :description, :developer_group, :meta_scope, :local_area,
|
28
31
|
:target, :participatory_scope, :participatory_structure, :announcement
|
@@ -98,8 +101,6 @@ module Decidim
|
|
98
101
|
end
|
99
102
|
}
|
100
103
|
|
101
|
-
scope :with_any_type, ->(*type_ids) { where(decidim_participatory_process_type_id: type_ids) }
|
102
|
-
|
103
104
|
searchable_fields({
|
104
105
|
scope_id: :decidim_scope_id,
|
105
106
|
participatory_space: :itself,
|
@@ -200,11 +201,26 @@ module Decidim
|
|
200
201
|
:admin
|
201
202
|
end
|
202
203
|
|
204
|
+
def shareable_url(share_token)
|
205
|
+
EngineRouter.main_proxy(self).participatory_process_url(self, share_token: share_token.token)
|
206
|
+
end
|
207
|
+
|
203
208
|
# Allow ransacker to search for a key in a hstore column (`title`.`en`)
|
204
209
|
ransacker_i18n :title
|
205
210
|
|
206
211
|
def self.ransackable_scopes(_auth_object = nil)
|
207
|
-
[:with_date, :
|
212
|
+
[:with_date, :with_any_taxonomies]
|
213
|
+
end
|
214
|
+
|
215
|
+
def self.ransackable_attributes(auth_object = nil)
|
216
|
+
base = %w(title short_description description id)
|
217
|
+
return base unless auth_object&.admin?
|
218
|
+
|
219
|
+
base + %w(private_space published_at decidim_participatory_process_group_id)
|
220
|
+
end
|
221
|
+
|
222
|
+
def self.ransackable_associations(_auth_object = nil)
|
223
|
+
%w(participatory_process_type participatory_process_group taxonomies)
|
208
224
|
end
|
209
225
|
end
|
210
226
|
end
|