decidim-participatory_processes 0.23.3 → 0.24.1
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/content_block_cell.rb +17 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/filters.erb +22 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/filters_small_view.erb +18 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/participatory_space_filters.erb +6 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/show.erb +7 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/title_filter_order.erb +8 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes_cell.rb +65 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/html/show.erb +3 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/html_cell.rb +13 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/metadata/show.erb +28 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/metadata_cell.rb +15 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/stats/show.erb +13 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/stats_cell.rb +17 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/title/show.erb +43 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/title_cell.rb +56 -0
- data/app/cells/decidim/participatory_process_groups/process_filters_cell.rb +78 -0
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/show.erb +2 -16
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/single_process.erb +32 -28
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_cell.rb +33 -10
- data/app/cells/decidim/participatory_processes/filtered_participatory_processes/show.erb +3 -0
- data/app/cells/decidim/participatory_processes/filtered_participatory_processes_cell.rb +56 -0
- data/app/cells/decidim/participatory_processes/process_cell.rb +6 -1
- data/app/cells/decidim/participatory_processes/process_filters_cell.rb +1 -1
- data/app/cells/decidim/participatory_processes/process_group_cell.rb +6 -1
- data/app/cells/decidim/participatory_processes/process_group_m_cell.rb +3 -1
- data/app/cells/decidim/participatory_processes/process_group_s/image.erb +1 -0
- data/app/cells/decidim/participatory_processes/process_group_s/show.erb +8 -0
- data/app/cells/decidim/participatory_processes/process_group_s_cell.rb +23 -0
- data/app/cells/decidim/participatory_processes/process_s/image.erb +1 -0
- data/app/cells/decidim/participatory_processes/process_s/show.erb +14 -0
- data/app/cells/decidim/participatory_processes/process_s_cell.rb +35 -0
- data/app/cells/decidim/participatory_processes/statistic/show.erb +3 -3
- data/app/cells/decidim/participatory_processes/statistics/show.erb +1 -1
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process.rb +1 -0
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process_admin.rb +7 -75
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb +11 -2
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process.rb +1 -0
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process_group.rb +11 -2
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process_step.rb +1 -0
- data/app/controllers/decidim/participatory_processes/admin/imports_controller.rb +14 -0
- data/app/controllers/decidim/participatory_processes/admin/moderations/reports_controller.rb +18 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_group_landing_page_content_blocks_controller.rb +48 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_group_landing_page_controller.rb +53 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb +3 -1
- data/app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb +1 -2
- data/app/controllers/decidim/participatory_processes/participatory_processes_controller.rb +14 -1
- data/app/events/decidim/participatory_process_role_assigned_event.rb +1 -1
- data/app/forms/decidim/participatory_processes/admin/participatory_process_form.rb +3 -0
- data/app/forms/decidim/participatory_processes/admin/participatory_process_group_form.rb +34 -2
- data/app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb +1 -1
- data/app/helpers/decidim/participatory_processes/admin/participatory_processes_menu_helper.rb +23 -0
- data/app/helpers/decidim/participatory_processes/admin/process_groups_for_select_helper.rb +1 -1
- data/app/helpers/decidim/participatory_processes/application_helper.rb +0 -12
- data/app/helpers/decidim/participatory_processes/participatory_process_helper.rb +35 -0
- data/app/models/decidim/participatory_process.rb +2 -2
- data/app/models/decidim/participatory_process_group.rb +9 -1
- data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_group_presenter.rb +10 -2
- data/app/presenters/decidim/participatory_processes/participatory_process_group_stats_presenter.rb +67 -0
- data/app/presenters/decidim/participatory_processes/participatory_process_presenter.rb +4 -3
- data/app/presenters/decidim/participatory_processes/participatory_process_stats_presenter.rb +3 -3
- data/app/queries/decidim/participatory_processes/group_participatory_processes.rb +16 -0
- data/app/queries/decidim/participatory_processes/group_published_participatory_processes.rb +21 -0
- data/app/queries/decidim/participatory_processes/organization_participatory_processes.rb +1 -1
- data/app/queries/decidim/participatory_processes/organization_published_participatory_processes.rb +1 -1
- data/app/queries/decidim/participatory_processes/promoted_participatory_process_groups.rb +12 -0
- data/app/queries/decidim/participatory_processes/stats_followers_count.rb +18 -4
- data/app/queries/decidim/participatory_processes/stats_participants_count.rb +18 -4
- data/app/queries/decidim/participatory_processes/visible_participatory_process_groups.rb +6 -2
- data/app/serializers/decidim/participatory_processes/participatory_process_importer.rb +1 -1
- data/app/serializers/decidim/participatory_processes/participatory_process_serializer.rb +1 -1
- data/app/services/decidim/participatory_processes/participatory_process_search.rb +2 -1
- data/app/views/decidim/participatory_processes/admin/participatory_process_copies/new.html.erb +2 -0
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/_form.html.erb +68 -13
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/edit.html.erb +7 -14
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/index.html.erb +12 -3
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/new.html.erb +2 -8
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/show.html.erb +10 -2
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/edit.html.erb +1 -0
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/index.html.erb +6 -0
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/edit.html.erb +2 -0
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/index.html.erb +8 -0
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/new.html.erb +2 -0
- data/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb +4 -0
- data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +14 -3
- data/app/views/decidim/participatory_processes/admin/participatory_processes/new.html.erb +2 -0
- data/app/views/decidim/participatory_processes/admin/shared/_secondary_nav.html.erb +2 -16
- data/app/views/decidim/participatory_processes/participatory_process_groups/show.html.erb +18 -8
- data/app/views/decidim/participatory_processes/participatory_process_groups/show.js.erb +12 -0
- data/app/views/decidim/participatory_processes/participatory_processes/_participatory_process_group.html.erb +4 -0
- data/app/views/decidim/participatory_processes/participatory_processes/_promoted_process_group.html.erb +31 -0
- data/app/views/decidim/participatory_processes/participatory_processes/index.html.erb +4 -2
- data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +4 -4
- data/app/views/layouts/decidim/admin/participatory_process.html.erb +8 -1
- data/app/views/layouts/decidim/admin/participatory_process_group.html.erb +17 -0
- data/config/locales/ar.yml +3 -10
- data/config/locales/ca.yml +52 -5
- data/config/locales/cs.yml +56 -9
- data/config/locales/de.yml +52 -5
- data/config/locales/el.yml +3 -6
- data/config/locales/en.yml +52 -5
- data/config/locales/es-MX.yml +52 -5
- data/config/locales/es-PY.yml +52 -5
- data/config/locales/es.yml +52 -5
- data/config/locales/eu.yml +3 -6
- data/config/locales/fi-plain.yml +53 -6
- data/config/locales/fi.yml +53 -6
- data/config/locales/fr-CA.yml +52 -5
- data/config/locales/fr.yml +52 -5
- data/config/locales/gl.yml +84 -5
- data/config/locales/hu.yml +3 -6
- data/config/locales/id-ID.yml +3 -5
- data/config/locales/is-IS.yml +3 -3
- data/config/locales/it.yml +8 -6
- data/config/locales/ja.yml +3 -5
- data/config/locales/lv.yml +3 -7
- data/config/locales/nl.yml +50 -6
- data/config/locales/no.yml +3 -6
- data/config/locales/pl.yml +63 -13
- data/config/locales/pt-BR.yml +3 -6
- data/config/locales/pt.yml +3 -6
- data/config/locales/ro-RO.yml +74 -25
- data/config/locales/ru.yml +4 -9
- data/config/locales/sk.yml +3 -8
- data/config/locales/sr-CS.yml +4 -0
- data/config/locales/sv.yml +33 -5
- data/config/locales/tr-TR.yml +51 -5
- data/config/locales/uk.yml +4 -9
- data/config/locales/zh-CN.yml +3 -5
- data/db/migrate/20170220110740_remove_steps_short_description.rb +1 -1
- data/db/migrate/20201007215105_add_hashtag_to_participatory_process_groups.rb +7 -0
- data/db/migrate/20201008154315_add_metadata_columns_to_participatory_process_groups.rb +13 -0
- data/db/migrate/20201013105520_rename_name_column_to_title_in_decidim_participatory_process_groups.rb +39 -0
- data/db/migrate/20201030133444_add_promoted_flag_to_decidim_participatory_process_groups.rb +7 -0
- data/db/migrate/20210204154593_add_weight_field_to_participatory_processes.rb +7 -0
- data/db/migrate/20210310120750_add_followable_counter_cache_to_participatory_processes.rb +16 -0
- data/lib/decidim/api/participatory_process_group_type.rb +17 -0
- data/{app/types/decidim/participatory_processes → lib/decidim/api}/participatory_process_input_filter.rb +0 -0
- data/{app/types/decidim/participatory_processes → lib/decidim/api}/participatory_process_input_sort.rb +2 -2
- data/lib/decidim/api/participatory_process_step_type.rb +23 -0
- data/lib/decidim/api/participatory_process_type.rb +50 -0
- data/lib/decidim/participatory_processes.rb +2 -6
- data/lib/decidim/participatory_processes/admin_engine.rb +49 -1
- data/lib/decidim/participatory_processes/api.rb +11 -0
- data/lib/decidim/participatory_processes/engine.rb +90 -8
- data/lib/decidim/participatory_processes/participatory_space.rb +47 -24
- data/lib/decidim/participatory_processes/query_extensions.rb +18 -20
- data/lib/decidim/participatory_processes/test/factories.rb +15 -2
- data/lib/decidim/participatory_processes/version.rb +1 -1
- metadata +59 -17
- data/app/functions/decidim/participatory_processes/participatory_process_finder.rb +0 -10
- data/app/functions/decidim/participatory_processes/participatory_process_list.rb +0 -11
- data/app/types/decidim/participatory_processes/participatory_process_group_type.rb +0 -20
- data/app/types/decidim/participatory_processes/participatory_process_step_type.rb +0 -28
- data/app/types/decidim/participatory_processes/participatory_process_type.rb +0 -54
data/app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb
CHANGED
@@ -46,10 +46,19 @@ module Decidim
|
|
46
46
|
) do
|
47
47
|
ParticipatoryProcessGroup.create(
|
48
48
|
organization: form.current_organization,
|
49
|
-
|
49
|
+
title: form.title,
|
50
50
|
description: form.description,
|
51
|
+
hashtag: form.hashtag,
|
52
|
+
group_url: form.group_url,
|
51
53
|
hero_image: form.hero_image, # Keep after organization
|
52
|
-
participatory_processes: participatory_processes
|
54
|
+
participatory_processes: participatory_processes,
|
55
|
+
developer_group: form.developer_group,
|
56
|
+
local_area: form.local_area,
|
57
|
+
meta_scope: form.meta_scope,
|
58
|
+
participatory_scope: form.participatory_scope,
|
59
|
+
participatory_structure: form.participatory_structure,
|
60
|
+
target: form.target,
|
61
|
+
promoted: form.promoted
|
53
62
|
)
|
54
63
|
end
|
55
64
|
end
|
data/app/commands/decidim/participatory_processes/admin/update_participatory_process_group.rb
CHANGED
@@ -51,11 +51,20 @@ module Decidim
|
|
51
51
|
|
52
52
|
def attributes
|
53
53
|
{
|
54
|
-
|
54
|
+
title: form.title,
|
55
55
|
hero_image: form.hero_image,
|
56
56
|
remove_hero_image: form.remove_hero_image,
|
57
57
|
description: form.description,
|
58
|
-
|
58
|
+
hashtag: form.hashtag,
|
59
|
+
group_url: form.group_url,
|
60
|
+
participatory_processes: participatory_processes,
|
61
|
+
developer_group: form.developer_group,
|
62
|
+
local_area: form.local_area,
|
63
|
+
meta_scope: form.meta_scope,
|
64
|
+
participatory_scope: form.participatory_scope,
|
65
|
+
participatory_structure: form.participatory_structure,
|
66
|
+
target: form.target,
|
67
|
+
promoted: form.promoted
|
59
68
|
}
|
60
69
|
end
|
61
70
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
module Admin
|
6
|
+
# This controller allows importing things.
|
7
|
+
# It is targeted for customizations for importing things that lives under
|
8
|
+
# a participatory process.
|
9
|
+
class ImportsController < Decidim::Admin::ImportsController
|
10
|
+
include Concerns::ParticipatoryProcessAdmin
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
module Admin
|
6
|
+
module Moderations
|
7
|
+
# This controller allows admins to manage moderation reports in a participatory process.
|
8
|
+
class ReportsController < Decidim::Admin::Moderations::ReportsController
|
9
|
+
include Concerns::ParticipatoryProcessAdmin
|
10
|
+
|
11
|
+
def permissions_context
|
12
|
+
super.merge(current_participatory_space: current_participatory_space)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
module Admin
|
6
|
+
# Controller that allows to manage the content from the participatory process landing page content blocks
|
7
|
+
class ParticipatoryProcessGroupLandingPageContentBlocksController < Decidim::ParticipatoryProcesses::Admin::ApplicationController
|
8
|
+
include Decidim::Admin::LandingPageContentBlocks
|
9
|
+
|
10
|
+
layout "decidim/admin/participatory_process_group"
|
11
|
+
|
12
|
+
helper_method :participatory_process_group
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def content_block_scope
|
17
|
+
:participatory_process_group_homepage
|
18
|
+
end
|
19
|
+
|
20
|
+
def scoped_resource
|
21
|
+
@scoped_resource ||= collection.find(params[:participatory_process_group_id])
|
22
|
+
end
|
23
|
+
|
24
|
+
def enforce_permission_to_update_resource
|
25
|
+
enforce_permission_to :update, :process_group, process_group: scoped_resource
|
26
|
+
end
|
27
|
+
|
28
|
+
def edit_resource_landing_page_path
|
29
|
+
edit_participatory_process_group_landing_page_path(scoped_resource)
|
30
|
+
end
|
31
|
+
|
32
|
+
def resource_landing_page_content_block_path
|
33
|
+
participatory_process_group_landing_page_content_block_path(scoped_resource, params[:id])
|
34
|
+
end
|
35
|
+
|
36
|
+
def submit_button_text
|
37
|
+
t("participatory_process_group_landing_page_content_blocks.edit.update", scope: "decidim.admin")
|
38
|
+
end
|
39
|
+
|
40
|
+
alias participatory_process_group scoped_resource
|
41
|
+
|
42
|
+
def collection
|
43
|
+
@collection ||= OrganizationParticipatoryProcessGroups.new(current_user.organization).query
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
module Admin
|
6
|
+
# Controller that allows managing the participatory process group landing
|
7
|
+
# page
|
8
|
+
class ParticipatoryProcessGroupLandingPageController < Decidim::ParticipatoryProcesses::Admin::ApplicationController
|
9
|
+
include Decidim::Admin::LandingPage
|
10
|
+
|
11
|
+
layout "decidim/admin/participatory_process_group"
|
12
|
+
|
13
|
+
helper_method :participatory_process_group
|
14
|
+
|
15
|
+
def content_block_scope
|
16
|
+
:participatory_process_group_homepage
|
17
|
+
end
|
18
|
+
|
19
|
+
def scoped_resource
|
20
|
+
@scoped_resource ||= collection.find(params[:participatory_process_group_id])
|
21
|
+
end
|
22
|
+
|
23
|
+
def enforce_permission_to_update_resource
|
24
|
+
enforce_permission_to :update, :process_group, process_group: scoped_resource
|
25
|
+
end
|
26
|
+
|
27
|
+
def resource_sort_url
|
28
|
+
participatory_process_group_landing_page_path(scoped_resource)
|
29
|
+
end
|
30
|
+
|
31
|
+
def active_content_blocks_title
|
32
|
+
t("participatory_process_group_landing_page.edit.active_content_blocks", scope: "decidim.admin")
|
33
|
+
end
|
34
|
+
|
35
|
+
def inactive_content_blocks_title
|
36
|
+
t("participatory_process_group_landing_page.edit.inactive_content_blocks", scope: "decidim.admin")
|
37
|
+
end
|
38
|
+
|
39
|
+
def resource_content_block_cell
|
40
|
+
"decidim/participatory_process_groups/content_block"
|
41
|
+
end
|
42
|
+
|
43
|
+
alias participatory_process_group scoped_resource
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def collection
|
48
|
+
@collection ||= OrganizationParticipatoryProcessGroups.new(current_user.organization).query
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -16,6 +16,7 @@ module Decidim
|
|
16
16
|
|
17
17
|
def show
|
18
18
|
enforce_permission_to :read, :process_group, process_group: participatory_process_group
|
19
|
+
render layout: "decidim/admin/participatory_process_group"
|
19
20
|
end
|
20
21
|
|
21
22
|
def new
|
@@ -44,6 +45,7 @@ module Decidim
|
|
44
45
|
@participatory_process_group = collection.find(params[:id])
|
45
46
|
enforce_permission_to :update, :process_group, process_group: @participatory_process_group
|
46
47
|
@form = form(ParticipatoryProcessGroupForm).from_model(@participatory_process_group)
|
48
|
+
render layout: "decidim/admin/participatory_process_group"
|
47
49
|
end
|
48
50
|
|
49
51
|
def update
|
@@ -59,7 +61,7 @@ module Decidim
|
|
59
61
|
|
60
62
|
on(:invalid) do
|
61
63
|
flash.now[:alert] = I18n.t("participatory_process_groups.update.error", scope: "decidim.admin")
|
62
|
-
render :edit
|
64
|
+
render :edit, layout: "decidim/admin/participatory_process_group"
|
63
65
|
end
|
64
66
|
end
|
65
67
|
end
|
data/app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
CHANGED
@@ -4,7 +4,7 @@ module Decidim
|
|
4
4
|
module ParticipatoryProcesses
|
5
5
|
class ParticipatoryProcessGroupsController < Decidim::ParticipatoryProcesses::ApplicationController
|
6
6
|
helper Decidim::SanitizeHelper
|
7
|
-
helper_method :participatory_processes, :group
|
7
|
+
helper_method :participatory_processes, :group
|
8
8
|
|
9
9
|
before_action :set_group
|
10
10
|
|
@@ -27,7 +27,6 @@ module Decidim
|
|
27
27
|
group.participatory_processes.published.public_spaces
|
28
28
|
end
|
29
29
|
end
|
30
|
-
alias collection participatory_processes
|
31
30
|
|
32
31
|
def set_group
|
33
32
|
@group = Decidim::ParticipatoryProcessGroup.find(params[:id])
|
@@ -10,10 +10,11 @@ module Decidim
|
|
10
10
|
include FilterResource
|
11
11
|
|
12
12
|
helper_method :collection,
|
13
|
-
:
|
13
|
+
:promoted_collection,
|
14
14
|
:participatory_processes,
|
15
15
|
:stats,
|
16
16
|
:metrics,
|
17
|
+
:participatory_process_group,
|
17
18
|
:default_date_filter,
|
18
19
|
:related_processes,
|
19
20
|
:linked_assemblies
|
@@ -71,6 +72,14 @@ module Decidim
|
|
71
72
|
@promoted_participatory_processes ||= published_processes | PromotedParticipatoryProcesses.new
|
72
73
|
end
|
73
74
|
|
75
|
+
def promoted_participatory_process_groups
|
76
|
+
@promoted_participatory_process_groups ||= PromotedParticipatoryProcessGroups.new
|
77
|
+
end
|
78
|
+
|
79
|
+
def promoted_collection
|
80
|
+
@promoted_collection ||= promoted_participatory_processes.query + promoted_participatory_process_groups.query
|
81
|
+
end
|
82
|
+
|
74
83
|
def collection
|
75
84
|
@collection ||= participatory_processes + participatory_process_groups
|
76
85
|
end
|
@@ -96,6 +105,10 @@ module Decidim
|
|
96
105
|
@metrics ||= ParticipatoryProcessMetricChartsPresenter.new(participatory_process: current_participatory_space)
|
97
106
|
end
|
98
107
|
|
108
|
+
def participatory_process_group
|
109
|
+
@participatory_process_group ||= current_participatory_space.participatory_process_group
|
110
|
+
end
|
111
|
+
|
99
112
|
def default_date_filter
|
100
113
|
return "active" if published_processes.any?(&:active?)
|
101
114
|
return "upcoming" if published_processes.any?(&:upcoming?)
|
@@ -10,7 +10,7 @@ module Decidim
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def i18n_role
|
13
|
-
I18n.t(extra["role"], "decidim.admin.models.participatory_process_user_role.roles", default: extra["role"])
|
13
|
+
I18n.t(extra["role"], scope: "decidim.admin.models.participatory_process_user_role.roles", default: extra["role"])
|
14
14
|
end
|
15
15
|
|
16
16
|
def i18n_options
|
@@ -32,6 +32,7 @@ module Decidim
|
|
32
32
|
attribute :scope_id, Integer
|
33
33
|
attribute :related_process_ids, Array[Integer]
|
34
34
|
attribute :scope_type_max_depth_id, Integer
|
35
|
+
attribute :weight, Integer, default: 0
|
35
36
|
|
36
37
|
attribute :private_space, Boolean
|
37
38
|
attribute :promoted, Boolean
|
@@ -58,6 +59,8 @@ module Decidim
|
|
58
59
|
validates :banner_image, passthru: { to: Decidim::ParticipatoryProcess }
|
59
60
|
validates :hero_image, passthru: { to: Decidim::ParticipatoryProcess }
|
60
61
|
|
62
|
+
validates :weight, presence: true
|
63
|
+
|
61
64
|
alias organization current_organization
|
62
65
|
|
63
66
|
def map_model(model)
|
@@ -10,20 +10,52 @@ module Decidim
|
|
10
10
|
include TranslatableAttributes
|
11
11
|
include Decidim::HasUploadValidations
|
12
12
|
|
13
|
-
translatable_attribute :name, String
|
14
13
|
translatable_attribute :description, String
|
14
|
+
translatable_attribute :developer_group, String
|
15
|
+
translatable_attribute :local_area, String
|
16
|
+
translatable_attribute :meta_scope, String
|
17
|
+
translatable_attribute :title, String
|
18
|
+
translatable_attribute :participatory_scope, String
|
19
|
+
translatable_attribute :participatory_structure, String
|
20
|
+
translatable_attribute :target, String
|
21
|
+
|
22
|
+
attribute :group_url, String
|
23
|
+
attribute :hashtag, String
|
15
24
|
attribute :participatory_process_ids, Array[Integer]
|
16
25
|
|
26
|
+
attribute :promoted, Boolean
|
27
|
+
|
17
28
|
mimic :participatory_process_group
|
18
29
|
|
19
30
|
attribute :hero_image
|
20
31
|
attribute :remove_hero_image
|
21
32
|
|
22
|
-
validates :
|
33
|
+
validates :title, :description, translatable_presence: true
|
23
34
|
|
24
35
|
validates :hero_image, passthru: { to: Decidim::ParticipatoryProcessGroup }
|
25
36
|
|
37
|
+
validate :group_url_format
|
38
|
+
|
26
39
|
alias organization current_organization
|
40
|
+
|
41
|
+
def group_url
|
42
|
+
return if super.blank?
|
43
|
+
|
44
|
+
return "http://#{super.strip}" unless super.match?(%r{\A(http|https)://}i)
|
45
|
+
|
46
|
+
super.strip
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def group_url_format
|
52
|
+
return if group_url.blank?
|
53
|
+
|
54
|
+
uri = URI.parse(group_url)
|
55
|
+
errors.add :group_url, :invalid if !uri.is_a?(URI::HTTP) || uri.host.nil?
|
56
|
+
rescue URI::InvalidURIError
|
57
|
+
errors.add :group_url, :invalid
|
58
|
+
end
|
27
59
|
end
|
28
60
|
end
|
29
61
|
end
|
@@ -20,7 +20,7 @@ module Decidim
|
|
20
20
|
attribute :cta_path, String
|
21
21
|
|
22
22
|
validates :title, translatable_presence: true
|
23
|
-
validates :cta_path, format: { with: %r{\A[a-zA-Z]+[a-zA-Z0-9
|
23
|
+
validates :cta_path, format: { with: %r{\A[a-zA-Z]+[a-zA-Z0-9\-_/]+\z} }, allow_blank: true
|
24
24
|
|
25
25
|
validates :start_date, date: { before: :end_date, allow_blank: true, if: proc { |obj| obj.end_date.present? } }
|
26
26
|
validates :end_date, date: { after: :start_date, allow_blank: true, if: proc { |obj| obj.start_date.present? } }
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
module Admin
|
6
|
+
module ParticipatoryProcessesMenuHelper
|
7
|
+
include Decidim::Admin::SidebarMenuHelper
|
8
|
+
|
9
|
+
def participatory_process_menu
|
10
|
+
@participatory_process_menu ||= sidebar_menu(:admin_participatory_process_menu)
|
11
|
+
end
|
12
|
+
|
13
|
+
def participatory_process_group_menu
|
14
|
+
@participatory_process_group_menu ||= sidebar_menu(:admin_participatory_process_group_menu)
|
15
|
+
end
|
16
|
+
|
17
|
+
def participatory_processes_menu
|
18
|
+
@participatory_processes_menu ||= sidebar_menu(:admin_participatory_processes_menu)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -14,7 +14,7 @@ module Decidim
|
|
14
14
|
def process_groups_for_select
|
15
15
|
@process_groups_for_select ||=
|
16
16
|
OrganizationParticipatoryProcessGroups.new(current_organization).map do |group|
|
17
|
-
[translated_attribute(group.
|
17
|
+
[translated_attribute(group.title), group.id]
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -6,18 +6,6 @@ module Decidim
|
|
6
6
|
#
|
7
7
|
module ApplicationHelper
|
8
8
|
include Decidim::ResourceHelper
|
9
|
-
|
10
|
-
# Public: Renders all hooks registered as `hook_name`.
|
11
|
-
#
|
12
|
-
# Note: We're passing a deep copy of the view context to allow
|
13
|
-
# us to extend it without polluting the original view context
|
14
|
-
#
|
15
|
-
# @param hook_name [Symbol] representing the name of the hook.
|
16
|
-
#
|
17
|
-
# @return [String] an HTML safe String
|
18
|
-
def render_participatory_processes_hook(hook_name)
|
19
|
-
Decidim::ParticipatoryProcesses.view_hooks.render(hook_name, deep_dup)
|
20
|
-
end
|
21
9
|
end
|
22
10
|
end
|
23
11
|
end
|
@@ -32,6 +32,41 @@ module Decidim
|
|
32
32
|
|
33
33
|
"#{path}/#{process.active_step.cta_path}" + (params.present? ? "?#{params}" : "")
|
34
34
|
end
|
35
|
+
|
36
|
+
# Public: Returns the settings of a cta content block associated if
|
37
|
+
# exists
|
38
|
+
#
|
39
|
+
# Returns a Hash with content block settings or nil
|
40
|
+
def participatory_process_group_cta_settings(process_group)
|
41
|
+
block = Decidim::ContentBlock.for_scope(
|
42
|
+
:participatory_process_group_homepage,
|
43
|
+
organization: current_organization
|
44
|
+
).find_by(
|
45
|
+
manifest_name: "cta",
|
46
|
+
scoped_resource_id: process_group.id
|
47
|
+
)
|
48
|
+
|
49
|
+
cta_settings = block&.settings
|
50
|
+
|
51
|
+
return if cta_settings.blank? || cta_settings.button_url.blank?
|
52
|
+
|
53
|
+
OpenStruct.new(
|
54
|
+
text: translated_attribute(cta_settings.button_text),
|
55
|
+
path: cta_settings.button_url,
|
56
|
+
image_url: block.images_container.background_image.big.url
|
57
|
+
)
|
58
|
+
end
|
59
|
+
|
60
|
+
# Public: Invokes the appropriate partial for a promoted
|
61
|
+
# participatory process or group based on the type name
|
62
|
+
#
|
63
|
+
# promoted_item - Can be a Decidim::ParticipatoryProcess or
|
64
|
+
# Decidim::ParticipatoryProcessGroup
|
65
|
+
def render_highlighted_partial_for(promoted_item)
|
66
|
+
name = promoted_item.class.name.demodulize.underscore.gsub("participatory_", "promoted_")
|
67
|
+
|
68
|
+
render partial: name, locals: { name => promoted_item }.symbolize_keys
|
69
|
+
end
|
35
70
|
end
|
36
71
|
end
|
37
72
|
end
|