decidim-participatory_processes 0.31.5 → 0.32.0.rc2
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 +3 -7
- data/app/cells/decidim/participatory_processes/content_blocks/democratic_quality_stats_cell.rb +1 -1
- data/app/cells/decidim/participatory_processes/content_blocks/main_data_cell.rb +1 -0
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process.rb +2 -2
- data/app/commands/decidim/participatory_processes/admin/duplicate_participatory_process.rb +1 -1
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process.rb +2 -3
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process_step.rb +1 -1
- data/app/controllers/concerns/decidim/participatory_processes/admin/filterable.rb +8 -2
- data/app/controllers/decidim/participatory_processes/admin/concerns/participatory_process_admin.rb +1 -0
- data/app/controllers/decidim/participatory_processes/admin/members_controller.rb +13 -0
- data/app/controllers/decidim/participatory_processes/admin/members_csv_imports_controller.rb +22 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_duplicates_controller.rb +1 -1
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb +3 -3
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_imports_controller.rb +1 -1
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_steps_controller.rb +2 -6
- data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb +3 -3
- data/app/controllers/decidim/participatory_processes/{participatory_space_private_users_controller.rb → members_controller.rb} +2 -2
- data/app/forms/decidim/participatory_processes/admin/participatory_process_form.rb +9 -2
- data/app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb +0 -3
- data/app/helpers/decidim/participatory_processes/participatory_process_helper.rb +5 -15
- data/app/models/decidim/participatory_process.rb +13 -8
- data/app/models/decidim/participatory_process_step.rb +1 -1
- data/app/permissions/decidim/participatory_processes/permissions.rb +9 -9
- data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb +2 -2
- data/app/presenters/decidim/participatory_processes/admin_log/step_presenter.rb +0 -2
- data/app/queries/decidim/participatory_processes/admin/admin_users.rb +1 -1
- data/app/queries/decidim/participatory_processes/admin/moderators.rb +1 -1
- data/app/serializers/decidim/participatory_processes/open_data_participatory_process_serializer.rb +2 -6
- data/app/serializers/decidim/participatory_processes/participatory_process_importer.rb +10 -2
- data/app/serializers/decidim/participatory_processes/participatory_process_serializer.rb +1 -3
- data/app/views/decidim/participatory_processes/admin/participatory_process_duplicates/new.html.erb +3 -2
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/edit.html.erb +3 -2
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/index.html.erb +2 -1
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/new.html.erb +3 -2
- data/app/views/decidim/participatory_processes/admin/participatory_process_imports/new.html.erb +2 -2
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/_form.html.erb +0 -9
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/edit.html.erb +3 -8
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/index.html.erb +5 -4
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/new.html.erb +4 -3
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/edit.html.erb +3 -3
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/index.html.erb +2 -2
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/new.html.erb +2 -2
- data/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb +33 -7
- data/app/views/decidim/participatory_processes/admin/participatory_processes/_process_row.html.erb +5 -6
- data/app/views/decidim/participatory_processes/admin/participatory_processes/_processes_thead.html.erb +1 -1
- data/app/views/decidim/participatory_processes/admin/participatory_processes/edit.html.erb +3 -2
- data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +2 -1
- data/app/views/decidim/participatory_processes/admin/participatory_processes/manage_trash.html.erb +2 -2
- data/app/views/decidim/participatory_processes/admin/participatory_processes/new.html.erb +3 -2
- data/app/views/decidim/participatory_processes/members/index.html.erb +24 -0
- data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +12 -7
- data/config/locales/ar.yml +0 -15
- data/config/locales/bg.yml +0 -34
- data/config/locales/ca-IT.yml +55 -52
- data/config/locales/ca.yml +55 -52
- data/config/locales/cs.yml +38 -47
- data/config/locales/de.yml +4 -41
- data/config/locales/el.yml +0 -26
- data/config/locales/en.yml +55 -53
- data/config/locales/es-MX.yml +55 -53
- data/config/locales/es-PY.yml +55 -53
- data/config/locales/es.yml +54 -52
- data/config/locales/eu.yml +55 -53
- data/config/locales/fi-plain.yml +55 -52
- data/config/locales/fi.yml +54 -51
- data/config/locales/fr-CA.yml +55 -52
- data/config/locales/fr.yml +55 -52
- data/config/locales/ga-IE.yml +0 -7
- data/config/locales/gl.yml +0 -16
- data/config/locales/hu.yml +0 -26
- data/config/locales/id-ID.yml +0 -15
- data/config/locales/is-IS.yml +0 -8
- data/config/locales/it.yml +0 -24
- data/config/locales/ja.yml +36 -52
- data/config/locales/lb.yml +0 -9
- data/config/locales/lt.yml +0 -26
- data/config/locales/lv.yml +0 -15
- data/config/locales/nl.yml +0 -15
- data/config/locales/no.yml +0 -25
- data/config/locales/pl.yml +0 -34
- data/config/locales/pt-BR.yml +33 -43
- data/config/locales/pt.yml +0 -16
- data/config/locales/ro-RO.yml +2 -26
- data/config/locales/ru.yml +0 -12
- data/config/locales/sk.yml +55 -53
- data/config/locales/sv.yml +22 -39
- data/config/locales/tr-TR.yml +0 -15
- data/config/locales/uk.yml +0 -12
- data/config/locales/zh-CN.yml +0 -15
- data/config/locales/zh-TW.yml +0 -26
- data/db/data/20260104094929_remove_process_types_references.rb +25 -0
- data/db/data/20260111190000_replace_legacy_fields_to_access_mode_for_participatory_processes.rb +18 -0
- data/db/data/20260210195709_move_announcement_to_content_block_on_participatory_processes.rb +40 -0
- data/db/migrate/20210310120750_add_followable_counter_cache_to_participatory_processes.rb +6 -2
- data/db/migrate/20251007094913_remove_cta_path_and_text_from_steps.rb +8 -0
- data/db/migrate/20251112113613_remove_legacy_images_from_participatory_processes_module.rb +9 -0
- data/db/migrate/20251203071213_remove_legacy_file_column_from_attachments_table.rb +11 -0
- data/db/migrate/20251205120001_add_has_members_to_decidim_participatory_processes.rb +7 -0
- data/db/migrate/20260104093600_remove_participatory_process_types.rb +13 -0
- data/db/migrate/20260111120010_add_access_mode_to_participatory_processes.rb +11 -0
- data/decidim-participatory_processes.gemspec +10 -11
- data/lib/decidim/api/participatory_process_step_type.rb +0 -2
- data/lib/decidim/api/participatory_process_type.rb +1 -2
- data/lib/decidim/participatory_processes/admin_engine.rb +11 -5
- data/lib/decidim/participatory_processes/api.rb +0 -1
- data/lib/decidim/participatory_processes/content_blocks/registry_manager.rb +5 -0
- data/lib/decidim/participatory_processes/engine.rb +29 -19
- data/lib/decidim/participatory_processes/menu.rb +11 -11
- data/lib/decidim/participatory_processes/participatory_space.rb +0 -2
- data/lib/decidim/participatory_processes/query_extensions.rb +2 -29
- data/lib/decidim/participatory_processes/test/factories.rb +13 -26
- data/lib/decidim/participatory_processes/version.rb +1 -1
- metadata +31 -33
- data/app/cells/decidim/participatory_processes/process_dropdown_metadata/metadata.erb +0 -15
- data/app/cells/decidim/participatory_processes/process_dropdown_metadata_cell.rb +0 -46
- data/app/controllers/decidim/participatory_processes/admin/participatory_space_private_users_controller.rb +0 -21
- data/app/controllers/decidim/participatory_processes/admin/participatory_space_private_users_csv_imports_controller.rb +0 -22
- data/app/models/decidim/participatory_process_type.rb +0 -27
- data/app/presenters/decidim/log/value_types/participatory_process_type_presenter.rb +0 -27
- data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_type_presenter.rb +0 -38
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/show.html.erb +0 -17
- data/app/views/decidim/participatory_processes/participatory_space_private_users/index.html.erb +0 -22
- data/app/views/layouts/decidim/admin/participatory_process_type.html.erb +0 -17
- data/lib/decidim/api/participatory_process_type_type.rb +0 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 20636c1192c84a7499d6b9f3284186f0448d406453cb3776ea24f79a3014d50b
|
|
4
|
+
data.tar.gz: 6cc60c31320a3d0e9c248c7e54304d3e81cc3abd7b7d331aded0273d8bfe0152
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0e5a6d1452ab19bcb7297dc023e5514308cc116412a14db568c8cc6485fa84729d6de7cdac6bc9ae81079804bdac7826753ebb220a871985d5a8f426ac5519af
|
|
7
|
+
data.tar.gz: 215f0e2b9b4b21f3eb8b69f60dbbfe4297761362e60d642044cf73b42468944ad9c229249395479361bb563509b4e2b854aa6e3b2cbb501ce8469bcc4130bf08
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# decidim-participatory_processes
|
|
2
2
|
|
|
3
3
|
Participatory processes are the standard Decidim's participatory space.
|
|
4
4
|
|
|
@@ -23,16 +23,12 @@ This module provides:
|
|
|
23
23
|
|
|
24
24
|
* Public views for participatory process via a high level section in the main menu.
|
|
25
25
|
|
|
26
|
+
You can see the documentation of this feature at the [Decidim Documentation](https://docs.decidim.org/en/develop/admin/spaces/processes).
|
|
27
|
+
|
|
26
28
|
## Installation
|
|
27
29
|
|
|
28
30
|
This is on the default Decidim installation so you should not change anything to use this participatory space.
|
|
29
31
|
|
|
30
|
-
## Screenshots
|
|
31
|
-
|
|
32
|
-

|
|
33
|
-
|
|
34
|
-

|
|
35
|
-
|
|
36
32
|
## Contributing
|
|
37
33
|
|
|
38
34
|
See [Decidim](https://github.com/decidim/decidim).
|
|
@@ -9,8 +9,8 @@ module Decidim
|
|
|
9
9
|
fetch_file_attributes :hero_image
|
|
10
10
|
|
|
11
11
|
fetch_form_attributes :organization, :title, :subtitle, :weight, :slug, :description,
|
|
12
|
-
:short_description, :promoted, :taxonomizations,
|
|
13
|
-
:
|
|
12
|
+
:short_description, :promoted, :taxonomizations,
|
|
13
|
+
:has_members, :access_mode, :developer_group, :local_area, :target,
|
|
14
14
|
:participatory_scope, :participatory_structure, :meta_scope, :start_date, :end_date,
|
|
15
15
|
:participatory_process_group
|
|
16
16
|
|
|
@@ -60,7 +60,7 @@ module Decidim
|
|
|
60
60
|
start_date: @participatory_process.start_date,
|
|
61
61
|
end_date: @participatory_process.end_date,
|
|
62
62
|
participatory_process_group: @participatory_process.participatory_process_group,
|
|
63
|
-
|
|
63
|
+
access_mode: @participatory_process.access_mode,
|
|
64
64
|
taxonomies: @participatory_process.taxonomies
|
|
65
65
|
)
|
|
66
66
|
end
|
|
@@ -9,10 +9,9 @@ module Decidim
|
|
|
9
9
|
fetch_file_attributes :hero_image
|
|
10
10
|
|
|
11
11
|
fetch_form_attributes :title, :subtitle, :weight, :slug, :promoted,
|
|
12
|
-
:taxonomizations, :
|
|
12
|
+
:taxonomizations, :has_members, :access_mode, :developer_group, :local_area,
|
|
13
13
|
:target, :participatory_scope, :participatory_structure,
|
|
14
|
-
:meta_scope, :start_date, :end_date, :participatory_process_group
|
|
15
|
-
:announcement
|
|
14
|
+
:meta_scope, :start_date, :end_date, :participatory_process_group
|
|
16
15
|
|
|
17
16
|
protected
|
|
18
17
|
|
data/app/commands/decidim/participatory_processes/admin/update_participatory_process_step.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Decidim
|
|
|
6
6
|
# A command with all the business logic when updating a participatory
|
|
7
7
|
# process step in the system.
|
|
8
8
|
class UpdateParticipatoryProcessStep < Decidim::Commands::UpdateResource
|
|
9
|
-
fetch_form_attributes :
|
|
9
|
+
fetch_form_attributes :title, :start_date, :end_date, :description
|
|
10
10
|
|
|
11
11
|
private
|
|
12
12
|
|
|
@@ -19,7 +19,7 @@ module Decidim
|
|
|
19
19
|
|
|
20
20
|
def filters
|
|
21
21
|
[
|
|
22
|
-
:
|
|
22
|
+
:with_any_access_mode,
|
|
23
23
|
:published_at_null,
|
|
24
24
|
:decidim_participatory_process_group_id_eq
|
|
25
25
|
]
|
|
@@ -27,7 +27,7 @@ module Decidim
|
|
|
27
27
|
|
|
28
28
|
def filters_with_values
|
|
29
29
|
{
|
|
30
|
-
|
|
30
|
+
with_any_access_mode: access_modes,
|
|
31
31
|
published_at_null: [true, false],
|
|
32
32
|
decidim_participatory_process_group_id_eq: OrganizationParticipatoryProcessGroups.new(current_organization).pluck(:id)
|
|
33
33
|
}
|
|
@@ -40,6 +40,12 @@ module Decidim
|
|
|
40
40
|
def translated_decidim_participatory_process_group_id_eq(id)
|
|
41
41
|
translated_attribute(Decidim::ParticipatoryProcessGroup.find(id).title)
|
|
42
42
|
end
|
|
43
|
+
|
|
44
|
+
private
|
|
45
|
+
|
|
46
|
+
def access_modes
|
|
47
|
+
ParticipatoryProcess::ACCESS_MODES
|
|
48
|
+
end
|
|
43
49
|
end
|
|
44
50
|
end
|
|
45
51
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module ParticipatoryProcesses
|
|
5
|
+
module Admin
|
|
6
|
+
# Controller that allows managing participatory process members
|
|
7
|
+
class MembersController < Decidim::Admin::ApplicationController
|
|
8
|
+
include Concerns::ParticipatoryProcessAdmin
|
|
9
|
+
include Decidim::Admin::ParticipatorySpace::Concerns::HasMembers
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module ParticipatoryProcesses
|
|
5
|
+
module Admin
|
|
6
|
+
# Controller that allows importing participatory process members
|
|
7
|
+
# on participatory processes
|
|
8
|
+
class MembersCsvImportsController < Decidim::Admin::ApplicationController
|
|
9
|
+
include Concerns::ParticipatoryProcessAdmin
|
|
10
|
+
include Decidim::Admin::ParticipatorySpace::Concerns::HasMembersCsvImport
|
|
11
|
+
|
|
12
|
+
def after_import_path
|
|
13
|
+
members_path(current_participatory_process)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def participatory_space
|
|
17
|
+
current_participatory_process
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -36,7 +36,7 @@ module Decidim
|
|
|
36
36
|
|
|
37
37
|
on(:invalid) do
|
|
38
38
|
flash.now[:alert] = I18n.t("participatory_processes_group.create.error", scope: "decidim.admin")
|
|
39
|
-
render :new, status: :
|
|
39
|
+
render :new, status: :unprocessable_content
|
|
40
40
|
end
|
|
41
41
|
end
|
|
42
42
|
end
|
|
@@ -61,7 +61,7 @@ module Decidim
|
|
|
61
61
|
|
|
62
62
|
on(:invalid) do
|
|
63
63
|
flash.now[:alert] = I18n.t("participatory_process_groups.update.error", scope: "decidim.admin")
|
|
64
|
-
render :edit, layout: "decidim/admin/participatory_process_group", status: :
|
|
64
|
+
render :edit, layout: "decidim/admin/participatory_process_group", status: :unprocessable_content
|
|
65
65
|
end
|
|
66
66
|
end
|
|
67
67
|
end
|
|
@@ -78,7 +78,7 @@ module Decidim
|
|
|
78
78
|
|
|
79
79
|
on(:invalid) do
|
|
80
80
|
flash.now[:alert] = I18n.t("participatory_process_groups.destroy.error", scope: "decidim.admin")
|
|
81
|
-
render :index, status: :
|
|
81
|
+
render :index, status: :unprocessable_content
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
end
|
data/app/controllers/decidim/participatory_processes/admin/participatory_process_steps_controller.rb
CHANGED
|
@@ -32,7 +32,7 @@ module Decidim
|
|
|
32
32
|
|
|
33
33
|
on(:invalid) do
|
|
34
34
|
flash.now[:alert] = I18n.t("participatory_process_steps.create.error", scope: "decidim.admin")
|
|
35
|
-
render :new, status: :
|
|
35
|
+
render :new, status: :unprocessable_content
|
|
36
36
|
end
|
|
37
37
|
end
|
|
38
38
|
end
|
|
@@ -54,15 +54,11 @@ module Decidim
|
|
|
54
54
|
|
|
55
55
|
on(:invalid) do
|
|
56
56
|
flash.now[:alert] = I18n.t("participatory_process_steps.update.error", scope: "decidim.admin")
|
|
57
|
-
render :edit, status: :
|
|
57
|
+
render :edit, status: :unprocessable_content
|
|
58
58
|
end
|
|
59
59
|
end
|
|
60
60
|
end
|
|
61
61
|
|
|
62
|
-
def show
|
|
63
|
-
enforce_permission_to :read, :process_step, process_step: @participatory_process_step
|
|
64
|
-
end
|
|
65
|
-
|
|
66
62
|
def destroy
|
|
67
63
|
enforce_permission_to :destroy, :process_step, process_step: @participatory_process_step
|
|
68
64
|
|
data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb
CHANGED
|
@@ -10,7 +10,7 @@ module Decidim
|
|
|
10
10
|
include Decidim::ParticipatoryProcesses::Admin::Filterable
|
|
11
11
|
include Decidim::Admin::HasTrashableResources
|
|
12
12
|
|
|
13
|
-
add_breadcrumb_item_from_menu :admin_participatory_process_menu, only: :
|
|
13
|
+
add_breadcrumb_item_from_menu :admin_participatory_process_menu, only: :edit
|
|
14
14
|
|
|
15
15
|
participatory_space_admin_layout only: [:edit]
|
|
16
16
|
|
|
@@ -42,7 +42,7 @@ module Decidim
|
|
|
42
42
|
|
|
43
43
|
on(:invalid) do
|
|
44
44
|
flash.now[:alert] = I18n.t("participatory_processes.create.error", scope: "decidim.admin")
|
|
45
|
-
render :new, status: :
|
|
45
|
+
render :new, status: :unprocessable_content
|
|
46
46
|
end
|
|
47
47
|
end
|
|
48
48
|
end
|
|
@@ -68,7 +68,7 @@ module Decidim
|
|
|
68
68
|
|
|
69
69
|
on(:invalid) do
|
|
70
70
|
flash.now[:alert] = I18n.t("participatory_processes.update.error", scope: "decidim.admin")
|
|
71
|
-
render :edit, layout: "decidim/admin/participatory_process", status: :
|
|
71
|
+
render :edit, layout: "decidim/admin/participatory_process", status: :unprocessable_content
|
|
72
72
|
end
|
|
73
73
|
end
|
|
74
74
|
end
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
module Decidim
|
|
4
4
|
module ParticipatoryProcesses
|
|
5
|
-
class
|
|
5
|
+
class MembersController < Decidim::ParticipatoryProcesses::ApplicationController
|
|
6
6
|
include ParticipatorySpaceContext
|
|
7
|
-
include Decidim::HasMembersPage
|
|
7
|
+
include Decidim::ParticipatorySpace::HasMembersPage
|
|
8
8
|
|
|
9
9
|
def index
|
|
10
10
|
raise ActionController::RoutingError, "No members for this participatory process" if members.none?
|
|
@@ -13,7 +13,6 @@ module Decidim
|
|
|
13
13
|
|
|
14
14
|
mimic :participatory_process
|
|
15
15
|
|
|
16
|
-
translatable_attribute :announcement, Decidim::Attributes::RichText
|
|
17
16
|
translatable_attribute :description, Decidim::Attributes::RichText
|
|
18
17
|
translatable_attribute :developer_group, String
|
|
19
18
|
translatable_attribute :local_area, String
|
|
@@ -31,7 +30,8 @@ module Decidim
|
|
|
31
30
|
attribute :related_process_ids, Array[Integer]
|
|
32
31
|
attribute :weight, Integer, default: 0
|
|
33
32
|
|
|
34
|
-
attribute :
|
|
33
|
+
attribute :access_mode, String, default: :open
|
|
34
|
+
attribute :has_members, Boolean
|
|
35
35
|
attribute :promoted, Boolean
|
|
36
36
|
|
|
37
37
|
attribute :end_date, Decidim::Attributes::LocalizedDate
|
|
@@ -50,6 +50,9 @@ module Decidim
|
|
|
50
50
|
|
|
51
51
|
validates :weight, presence: true
|
|
52
52
|
|
|
53
|
+
validates :access_mode, presence: true, inclusion: { in: Decidim::ParticipatoryProcess.access_modes.keys }
|
|
54
|
+
validate :ensure_access_mode_for_has_members
|
|
55
|
+
|
|
53
56
|
validates :start_date, date: { before: :end_date, allow_blank: true, if: proc { |obj| obj.end_date.present? } }
|
|
54
57
|
validates :end_date, date: { after: :start_date, allow_blank: true, if: proc { |obj| obj.start_date.present? } }
|
|
55
58
|
|
|
@@ -89,6 +92,10 @@ module Decidim
|
|
|
89
92
|
|
|
90
93
|
errors.add(:slug, :taken)
|
|
91
94
|
end
|
|
95
|
+
|
|
96
|
+
def ensure_access_mode_for_has_members
|
|
97
|
+
self.access_mode = :open if has_members == false
|
|
98
|
+
end
|
|
92
99
|
end
|
|
93
100
|
end
|
|
94
101
|
end
|
|
@@ -11,16 +11,13 @@ module Decidim
|
|
|
11
11
|
|
|
12
12
|
translatable_attribute :title, String
|
|
13
13
|
translatable_attribute :description, String
|
|
14
|
-
translatable_attribute :cta_text, String
|
|
15
14
|
|
|
16
15
|
mimic :participatory_process_step
|
|
17
16
|
|
|
18
17
|
attribute :start_date, Decidim::Attributes::TimeWithZone
|
|
19
18
|
attribute :end_date, Decidim::Attributes::TimeWithZone
|
|
20
|
-
attribute :cta_path, String
|
|
21
19
|
|
|
22
20
|
validates :title, translatable_presence: true
|
|
23
|
-
validates :cta_path, format: { with: %r{\A[a-zA-Z]+[a-zA-Z0-9\-_/]+\z} }, allow_blank: true
|
|
24
21
|
|
|
25
22
|
validates :start_date, date: { before: :end_date, allow_blank: true, if: proc { |obj| obj.end_date.present? } }
|
|
26
23
|
validates :end_date, date: { after: :start_date, allow_blank: true, if: proc { |obj| obj.start_date.present? } }
|
|
@@ -22,17 +22,6 @@ module Decidim
|
|
|
22
22
|
dates.map { |date| date ? l(date.to_date, format: :decidim_short) : "?" }.join(" - ")
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
-
# Public: Returns the path for the participatory process cta button
|
|
26
|
-
#
|
|
27
|
-
# Returns a String with path.
|
|
28
|
-
def participatory_process_cta_path(process)
|
|
29
|
-
return participatory_process_path(process) if process.active_step&.cta_path.blank?
|
|
30
|
-
|
|
31
|
-
path, params = participatory_process_path(process).split("?")
|
|
32
|
-
|
|
33
|
-
"#{path}/#{process.active_step.cta_path}" + (params.present? ? "?#{params}" : "")
|
|
34
|
-
end
|
|
35
|
-
|
|
36
25
|
# Public: Returns the settings of a cta content block associated if
|
|
37
26
|
# exists
|
|
38
27
|
#
|
|
@@ -68,8 +57,8 @@ module Decidim
|
|
|
68
57
|
*(if participatory_space.members_public_page?
|
|
69
58
|
[{
|
|
70
59
|
name: t("member_menu_item", scope: "layouts.decidim.participatory_process_navigation"),
|
|
71
|
-
url: decidim_participatory_processes.
|
|
72
|
-
active: is_active_link?(decidim_participatory_processes.
|
|
60
|
+
url: decidim_participatory_processes.participatory_process_members_path(participatory_space),
|
|
61
|
+
active: is_active_link?(decidim_participatory_processes.participatory_process_members_path(participatory_space), :inclusive)
|
|
73
62
|
}]
|
|
74
63
|
end
|
|
75
64
|
)
|
|
@@ -85,10 +74,11 @@ module Decidim
|
|
|
85
74
|
|
|
86
75
|
def filter_sections
|
|
87
76
|
items = [
|
|
88
|
-
{ method: :with_date, collection: filter_dates_values, label: t("decidim.participatory_processes.participatory_processes.filters.date"), id: "date" }
|
|
77
|
+
{ method: :with_date, name: "[with_date]", collection: filter_dates_values, label: t("decidim.participatory_processes.participatory_processes.filters.date"), id: "date" }
|
|
89
78
|
]
|
|
90
79
|
available_taxonomy_filters.find_each do |taxonomy_filter|
|
|
91
|
-
items.append(method:
|
|
80
|
+
items.append(method: :with_any_taxonomies,
|
|
81
|
+
name: "[with_any_taxonomies][#{taxonomy_filter.root_taxonomy_id}]",
|
|
92
82
|
collection: filter_taxonomy_values_for(taxonomy_filter),
|
|
93
83
|
label: decidim_sanitize_translated(taxonomy_filter.name),
|
|
94
84
|
id: "taxonomy-#{taxonomy_filter.root_taxonomy_id}")
|
|
@@ -16,7 +16,7 @@ module Decidim
|
|
|
16
16
|
include Decidim::Followable
|
|
17
17
|
include Decidim::HasReference
|
|
18
18
|
include Decidim::Traceable
|
|
19
|
-
include Decidim::
|
|
19
|
+
include Decidim::ParticipatorySpace::HasMembers
|
|
20
20
|
include Decidim::Loggable
|
|
21
21
|
include Decidim::ParticipatorySpaceResourceable
|
|
22
22
|
include Decidim::Searchable
|
|
@@ -59,10 +59,6 @@ module Decidim
|
|
|
59
59
|
foreign_key: "decidim_scope_type_id",
|
|
60
60
|
class_name: "Decidim::ScopeType",
|
|
61
61
|
optional: true
|
|
62
|
-
belongs_to :participatory_process_type,
|
|
63
|
-
foreign_key: "decidim_participatory_process_type_id",
|
|
64
|
-
class_name: "Decidim::ParticipatoryProcessType",
|
|
65
|
-
optional: true
|
|
66
62
|
|
|
67
63
|
has_many :components, as: :participatory_space, dependent: :destroy
|
|
68
64
|
|
|
@@ -71,6 +67,13 @@ module Decidim
|
|
|
71
67
|
validates :slug, uniqueness: { scope: :organization }
|
|
72
68
|
validates :slug, presence: true, format: { with: Decidim::ParticipatoryProcess.slug_format }
|
|
73
69
|
|
|
70
|
+
# Access modes are consistent across participatory spaces (assemblies and processes)
|
|
71
|
+
# open: visible and accessible for all
|
|
72
|
+
# transparent: visible for all but the actions require to be a member of the space
|
|
73
|
+
# restricted: visible and accessible only for members fo the space
|
|
74
|
+
ACCESS_MODES = { open: 0, transparent: 1, restricted: 2 }.freeze
|
|
75
|
+
enum :access_mode, ACCESS_MODES
|
|
76
|
+
|
|
74
77
|
has_one_attached :hero_image
|
|
75
78
|
validates_upload :hero_image, uploader: Decidim::HeroImageUploader
|
|
76
79
|
|
|
@@ -78,6 +81,8 @@ module Decidim
|
|
|
78
81
|
scope :upcoming, -> { where(arel_table[:start_date].gt(Date.current)) }
|
|
79
82
|
scope :active, -> { where(arel_table[:start_date].lteq(Date.current).and(arel_table[:end_date].gteq(Date.current).or(arel_table[:end_date].eq(nil)))) }
|
|
80
83
|
|
|
84
|
+
scope_search_multi :with_any_access_mode, ACCESS_MODES.keys
|
|
85
|
+
|
|
81
86
|
scope :with_date, lambda { |date_key|
|
|
82
87
|
case date_key
|
|
83
88
|
when "active"
|
|
@@ -209,18 +214,18 @@ module Decidim
|
|
|
209
214
|
ransacker_i18n :title
|
|
210
215
|
|
|
211
216
|
def self.ransackable_scopes(_auth_object = nil)
|
|
212
|
-
[:with_date, :with_any_taxonomies]
|
|
217
|
+
[:with_date, :with_any_taxonomies, :with_any_access_mode]
|
|
213
218
|
end
|
|
214
219
|
|
|
215
220
|
def self.ransackable_attributes(auth_object = nil)
|
|
216
221
|
base = %w(title short_description description id)
|
|
217
222
|
return base unless auth_object&.admin?
|
|
218
223
|
|
|
219
|
-
base + %w(
|
|
224
|
+
base + %w(published_at created_at decidim_participatory_process_group_id access_mode)
|
|
220
225
|
end
|
|
221
226
|
|
|
222
227
|
def self.ransackable_associations(_auth_object = nil)
|
|
223
|
-
%w(
|
|
228
|
+
%w(participatory_process_group taxonomies)
|
|
224
229
|
end
|
|
225
230
|
end
|
|
226
231
|
end
|
|
@@ -11,7 +11,7 @@ module Decidim
|
|
|
11
11
|
|
|
12
12
|
delegate :can_participate?, to: :participatory_process
|
|
13
13
|
|
|
14
|
-
translatable_fields :title, :description
|
|
14
|
+
translatable_fields :title, :description
|
|
15
15
|
|
|
16
16
|
belongs_to :participatory_process, foreign_key: "decidim_participatory_process_id", class_name: "Decidim::ParticipatoryProcess", touch: true
|
|
17
17
|
has_one :organization, through: :participatory_process
|
|
@@ -43,7 +43,7 @@ module Decidim
|
|
|
43
43
|
|
|
44
44
|
return permission_action unless process
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
user_can_read_members?
|
|
47
47
|
|
|
48
48
|
moderator_action?
|
|
49
49
|
collaborator_action?
|
|
@@ -54,9 +54,9 @@ module Decidim
|
|
|
54
54
|
|
|
55
55
|
private
|
|
56
56
|
|
|
57
|
-
def
|
|
58
|
-
return unless permission_action.subject == :
|
|
59
|
-
return unless process.
|
|
57
|
+
def user_can_read_members?
|
|
58
|
+
return unless permission_action.subject == :space_member
|
|
59
|
+
return unless process.has_members?
|
|
60
60
|
|
|
61
61
|
toggle_allow(user.admin? || can_manage_process?(role: :admin) || can_manage_process?(role: :collaborator))
|
|
62
62
|
end
|
|
@@ -121,7 +121,7 @@ module Decidim
|
|
|
121
121
|
[:process, :participatory_space].include?(permission_action.subject) &&
|
|
122
122
|
process
|
|
123
123
|
|
|
124
|
-
return disallow! unless
|
|
124
|
+
return disallow! unless can_view_restricted_space?
|
|
125
125
|
return allow! if user&.admin?
|
|
126
126
|
return allow! if process.published?
|
|
127
127
|
return allow! if user_can_preview_space?
|
|
@@ -129,11 +129,11 @@ module Decidim
|
|
|
129
129
|
toggle_allow(can_manage_process?)
|
|
130
130
|
end
|
|
131
131
|
|
|
132
|
-
def
|
|
133
|
-
return true unless process.
|
|
132
|
+
def can_view_restricted_space?
|
|
133
|
+
return true unless process.restricted?
|
|
134
134
|
return false unless user
|
|
135
135
|
|
|
136
|
-
user.admin || user_has_any_role?(user, process, broad_check: true) || process.users.include?(user)
|
|
136
|
+
user.admin? || user_has_any_role?(user, process, broad_check: true) || process.users.include?(user)
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
# Only organization admins can enter the process groups space area.
|
|
@@ -212,7 +212,7 @@ module Decidim
|
|
|
212
212
|
# Collaborators can only preview their own processes.
|
|
213
213
|
def collaborator_action?
|
|
214
214
|
return unless can_manage_process?(role: :collaborator)
|
|
215
|
-
return if permission_action.subject == :
|
|
215
|
+
return if permission_action.subject == :space_member
|
|
216
216
|
|
|
217
217
|
allow! if permission_action.action == :preview
|
|
218
218
|
end
|
data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_presenter.rb
CHANGED
|
@@ -17,6 +17,7 @@ module Decidim
|
|
|
17
17
|
|
|
18
18
|
def diff_fields_mapping
|
|
19
19
|
{
|
|
20
|
+
access_mode: :access_mode,
|
|
20
21
|
description: :i18n,
|
|
21
22
|
developer_group: :i18n,
|
|
22
23
|
decidim_area_id: :area,
|
|
@@ -30,8 +31,7 @@ module Decidim
|
|
|
30
31
|
slug: :string,
|
|
31
32
|
subtitle: :i18n,
|
|
32
33
|
target: :i18n,
|
|
33
|
-
title: :i18n
|
|
34
|
-
decidim_participatory_process_type_id: :participatory_process_type
|
|
34
|
+
title: :i18n
|
|
35
35
|
}
|
|
36
36
|
end
|
|
37
37
|
|
|
@@ -44,7 +44,7 @@ module Decidim
|
|
|
44
44
|
def processes_user_admins
|
|
45
45
|
Decidim::User.where(
|
|
46
46
|
id: Decidim::ParticipatoryProcessUserRole.where(participatory_process: processes)
|
|
47
|
-
|
|
47
|
+
.where.not(role: :collaborator)
|
|
48
48
|
.select(:decidim_user_id)
|
|
49
49
|
)
|
|
50
50
|
end
|
data/app/serializers/decidim/participatory_processes/open_data_participatory_process_serializer.rb
CHANGED
|
@@ -11,7 +11,6 @@ module Decidim
|
|
|
11
11
|
url: EngineRouter.main_proxy(resource).participatory_process_url(resource),
|
|
12
12
|
subtitle: resource.subtitle,
|
|
13
13
|
remote_hero_image_url: Decidim::ParticipatoryProcesses::ParticipatoryProcessPresenter.new(resource).hero_image_url,
|
|
14
|
-
announcement: resource.announcement,
|
|
15
14
|
start_date: resource.start_date,
|
|
16
15
|
end_date: resource.end_date,
|
|
17
16
|
developer_group: resource.developer_group,
|
|
@@ -19,6 +18,7 @@ module Decidim
|
|
|
19
18
|
meta_scope: resource.meta_scope,
|
|
20
19
|
participatory_scope: resource.participatory_scope,
|
|
21
20
|
participatory_structure: resource.participatory_structure,
|
|
21
|
+
access_mode: resource.access_mode,
|
|
22
22
|
target: resource.target,
|
|
23
23
|
area: {
|
|
24
24
|
id: resource.area.try(:id),
|
|
@@ -34,11 +34,7 @@ module Decidim
|
|
|
34
34
|
id: resource.scope.try(:id),
|
|
35
35
|
name: resource.scope.try(:name) || empty_translatable
|
|
36
36
|
},
|
|
37
|
-
scopes_enabled: resource.scopes_enabled
|
|
38
|
-
participatory_process_type: {
|
|
39
|
-
id: resource.participatory_process_type.try(:id),
|
|
40
|
-
title: resource.participatory_process_type.try(:title) || empty_translatable
|
|
41
|
-
}
|
|
37
|
+
scopes_enabled: resource.scopes_enabled
|
|
42
38
|
}
|
|
43
39
|
)
|
|
44
40
|
end
|
|
@@ -42,8 +42,7 @@ module Decidim
|
|
|
42
42
|
meta_scope: attributes["meta_scope"],
|
|
43
43
|
start_date: attributes["start_date"],
|
|
44
44
|
end_date: attributes["end_date"],
|
|
45
|
-
|
|
46
|
-
private_space: attributes["private_space"],
|
|
45
|
+
access_mode: resolve_access_mode(attributes),
|
|
47
46
|
participatory_process_group: process_group
|
|
48
47
|
)
|
|
49
48
|
import_hero_image(attributes["remote_hero_image_url"])
|
|
@@ -224,6 +223,15 @@ module Decidim
|
|
|
224
223
|
message = message.presence || error.message
|
|
225
224
|
"#{code} #{message}"
|
|
226
225
|
end
|
|
226
|
+
|
|
227
|
+
def resolve_access_mode(attributes)
|
|
228
|
+
return attributes["access_mode"] if attributes["access_mode"].present?
|
|
229
|
+
|
|
230
|
+
return "transparent" if attributes["is_transparent"] == true
|
|
231
|
+
return "restricted" if attributes["private_space"] == true
|
|
232
|
+
|
|
233
|
+
"open"
|
|
234
|
+
end
|
|
227
235
|
end
|
|
228
236
|
end
|
|
229
237
|
end
|
|
@@ -15,7 +15,7 @@ module Decidim
|
|
|
15
15
|
attachment_collections: serialize_attachment_collections,
|
|
16
16
|
files: serialize_attachments
|
|
17
17
|
},
|
|
18
|
-
|
|
18
|
+
access_mode: resource.access_mode,
|
|
19
19
|
weight: resource.weight,
|
|
20
20
|
components: serialize_components,
|
|
21
21
|
participatory_process_steps: serialize_participatory_process_steps
|
|
@@ -35,8 +35,6 @@ module Decidim
|
|
|
35
35
|
description: step.try(:description),
|
|
36
36
|
start_date: step.try(:start_date),
|
|
37
37
|
end_date: step.try(:end_date),
|
|
38
|
-
cta_path: step.try(:cta_path),
|
|
39
|
-
cta_text: step.try(:cta_text),
|
|
40
38
|
active: step.active,
|
|
41
39
|
position: step.position
|
|
42
40
|
}
|