decidim-participatory_processes 0.23.6 → 0.24.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/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_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/forms/decidim/participatory_processes/admin/participatory_process_form.rb +1 -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_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 +3 -4
- 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 +14 -5
- 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 +15 -4
- 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 +0 -10
- data/config/locales/ca.yml +6 -9
- data/config/locales/cs.yml +63 -16
- data/config/locales/de.yml +52 -5
- data/config/locales/el.yml +0 -6
- data/config/locales/en.yml +52 -5
- data/config/locales/es-MX.yml +0 -9
- data/config/locales/es-PY.yml +0 -9
- data/config/locales/es.yml +0 -9
- data/config/locales/eu.yml +0 -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 +0 -41
- data/config/locales/hu.yml +0 -6
- data/config/locales/id-ID.yml +0 -5
- data/config/locales/is-IS.yml +0 -3
- data/config/locales/it.yml +5 -6
- data/config/locales/ja.yml +0 -5
- data/config/locales/lv.yml +0 -7
- data/config/locales/nl.yml +48 -6
- data/config/locales/no.yml +0 -6
- data/config/locales/pl.yml +37 -20
- data/config/locales/pt-BR.yml +0 -6
- data/config/locales/pt.yml +0 -6
- data/config/locales/ro-RO.yml +19 -29
- data/config/locales/ru.yml +1 -9
- data/config/locales/sk.yml +0 -8
- data/config/locales/sv.yml +7 -6
- data/config/locales/tr-TR.yml +51 -5
- data/config/locales/uk.yml +1 -9
- data/config/locales/zh-CN.yml +0 -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/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/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
- data/lib/decidim/participatory_processes.rb +2 -6
- metadata +60 -19
- 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
@@ -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
|
@@ -7,7 +7,8 @@ module Decidim
|
|
7
7
|
include Decidim::HasUploadValidations
|
8
8
|
include Decidim::TranslatableResource
|
9
9
|
|
10
|
-
translatable_fields :
|
10
|
+
translatable_fields :title, :description, :developer_group, :local_area, :meta_scope, :participatory_scope,
|
11
|
+
:participatory_structure, :target
|
11
12
|
|
12
13
|
has_many :participatory_processes,
|
13
14
|
foreign_key: "decidim_participatory_process_group_id",
|
@@ -22,6 +23,13 @@ module Decidim
|
|
22
23
|
validates_upload :hero_image
|
23
24
|
mount_uploader :hero_image, Decidim::HeroImageUploader
|
24
25
|
|
26
|
+
# Scope to return only the promoted groups.
|
27
|
+
#
|
28
|
+
# Returns an ActiveRecord::Relation.
|
29
|
+
def self.promoted
|
30
|
+
where(promoted: true)
|
31
|
+
end
|
32
|
+
|
25
33
|
def self.log_presenter_class_for(_log)
|
26
34
|
Decidim::ParticipatoryProcesses::AdminLog::ParticipatoryProcessGroupPresenter
|
27
35
|
end
|
@@ -17,8 +17,16 @@ module Decidim
|
|
17
17
|
|
18
18
|
def diff_fields_mapping
|
19
19
|
{
|
20
|
-
|
21
|
-
|
20
|
+
description: :i18n,
|
21
|
+
developer_group: :i18n,
|
22
|
+
hashtag: :string,
|
23
|
+
group_url: :string,
|
24
|
+
local_area: :i18n,
|
25
|
+
meta_scope: :i18n,
|
26
|
+
title: :i18n,
|
27
|
+
participatory_scope: :i18n,
|
28
|
+
participatory_structure: :i18n,
|
29
|
+
target: :i18n
|
22
30
|
}
|
23
31
|
end
|
24
32
|
|
data/app/presenters/decidim/participatory_processes/participatory_process_group_stats_presenter.rb
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
# A presenter to render statistics in the homepage.
|
6
|
+
class ParticipatoryProcessGroupStatsPresenter < Rectify::Presenter
|
7
|
+
attribute :participatory_process_group, Decidim::ParticipatoryProcessGroup
|
8
|
+
include Decidim::IconHelper
|
9
|
+
|
10
|
+
# Public: returns a collection of stats (Hash) for the participatory
|
11
|
+
# process group landing page.
|
12
|
+
def collection
|
13
|
+
highlighted_stats = process_participants_stats
|
14
|
+
highlighted_stats.concat(process_followers_stats(priority: StatsRegistry::HIGH_PRIORITY))
|
15
|
+
highlighted_stats.concat(component_stats(priority: StatsRegistry::HIGH_PRIORITY))
|
16
|
+
highlighted_stats.concat(component_stats(priority: StatsRegistry::MEDIUM_PRIORITY))
|
17
|
+
highlighted_stats = highlighted_stats.reject(&:empty?)
|
18
|
+
highlighted_stats = highlighted_stats.reject { |_stat_manifest, _stat_title, stat_number| stat_number.zero? }
|
19
|
+
grouped_highlighted_stats = highlighted_stats.group_by(&:first)
|
20
|
+
|
21
|
+
statistics = []
|
22
|
+
grouped_highlighted_stats.each do |_manifest_name, stats|
|
23
|
+
stats.each_with_index.each do |stat, _index|
|
24
|
+
stat.each_with_index.map do |_item, subindex|
|
25
|
+
next unless (subindex % 3).zero?
|
26
|
+
next if stat[subindex + 2].zero?
|
27
|
+
|
28
|
+
statistics << { stat_title: stat[subindex + 1], stat_number: stat[subindex + 2] }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
statistics
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def process_participants_stats
|
38
|
+
Decidim.stats.only([:participants_count]).with_context(participatory_process_group)
|
39
|
+
.map { |stat_title, stat_number| [:participatory_process_group, stat_title, stat_number] }
|
40
|
+
end
|
41
|
+
|
42
|
+
def component_stats(conditions)
|
43
|
+
Decidim.component_manifests.map do |component_manifest|
|
44
|
+
component_manifest.stats.except([:proposals_accepted])
|
45
|
+
.filter(conditions)
|
46
|
+
.with_context(published_components)
|
47
|
+
.map { |stat_title, stat_number| [component_manifest.name, stat_title, stat_number] }.flatten
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def process_followers_stats(conditions)
|
52
|
+
Decidim.stats.only([:followers_count])
|
53
|
+
.filter(conditions)
|
54
|
+
.with_context(participatory_process_group)
|
55
|
+
.map { |stat_title, stat_number| [:participatory_process_group, stat_title, stat_number] }
|
56
|
+
end
|
57
|
+
|
58
|
+
def participatory_processes
|
59
|
+
@participatory_processes ||= participatory_process_group.participatory_processes
|
60
|
+
end
|
61
|
+
|
62
|
+
def published_components
|
63
|
+
@published_components ||= Component.where(participatory_space: participatory_processes).published
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -6,15 +6,14 @@ module Decidim
|
|
6
6
|
include Rails.application.routes.mounted_helpers
|
7
7
|
include ActionView::Helpers::UrlHelper
|
8
8
|
|
9
|
-
|
10
|
-
|
9
|
+
delegate :url, to: :hero_image, prefix: true
|
10
|
+
delegate :url, to: :banner_image, prefix: true
|
11
11
|
|
12
|
+
def hero_image_url
|
12
13
|
URI.join(decidim.root_url(host: process.organization.host), process.hero_image_url).to_s
|
13
14
|
end
|
14
15
|
|
15
16
|
def banner_image_url
|
16
|
-
return unless process.banner_image_url
|
17
|
-
|
18
17
|
URI.join(decidim.root_url(host: process.organization.host), process.banner_image_url).to_s
|
19
18
|
end
|
20
19
|
|
data/app/presenters/decidim/participatory_processes/participatory_process_stats_presenter.rb
CHANGED
@@ -10,9 +10,9 @@ module Decidim
|
|
10
10
|
# Public: returns a collection of stats (Hash) for the Process Home.
|
11
11
|
def collection
|
12
12
|
highlighted_stats = process_participants_stats
|
13
|
-
highlighted_stats
|
14
|
-
highlighted_stats
|
15
|
-
highlighted_stats
|
13
|
+
highlighted_stats.concat(process_followers_stats(priority: StatsRegistry::HIGH_PRIORITY))
|
14
|
+
highlighted_stats.concat(component_stats(priority: StatsRegistry::HIGH_PRIORITY))
|
15
|
+
highlighted_stats.concat(component_stats(priority: StatsRegistry::MEDIUM_PRIORITY))
|
16
16
|
highlighted_stats = highlighted_stats.reject(&:empty?)
|
17
17
|
highlighted_stats = highlighted_stats.reject { |_stat_manifest, _stat_title, stat_number| stat_number.zero? }
|
18
18
|
grouped_highlighted_stats = highlighted_stats.group_by(&:first)
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
# This query class filters all processes of a participatory process group
|
6
|
+
class GroupParticipatoryProcesses < Rectify::Query
|
7
|
+
def initialize(group)
|
8
|
+
@group = group
|
9
|
+
end
|
10
|
+
|
11
|
+
def query
|
12
|
+
Decidim::ParticipatoryProcess.where(participatory_process_group: @group)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
# This query class filters published processes of a participatory process group
|
6
|
+
class GroupPublishedParticipatoryProcesses < Rectify::Query
|
7
|
+
def initialize(group, user = nil)
|
8
|
+
@group = group
|
9
|
+
@user = user
|
10
|
+
end
|
11
|
+
|
12
|
+
def query
|
13
|
+
Rectify::Query.merge(
|
14
|
+
GroupParticipatoryProcesses.new(@group),
|
15
|
+
VisibleParticipatoryProcesses.new(@user),
|
16
|
+
PublishedParticipatoryProcesses.new
|
17
|
+
).query
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
# This query filters participatory process groups so only promoted ones are returned.
|
6
|
+
class PromotedParticipatoryProcessGroups < Rectify::Query
|
7
|
+
def query
|
8
|
+
Decidim::ParticipatoryProcessGroup.promoted
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -2,10 +2,12 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module ParticipatoryProcesses
|
5
|
-
# This class counts all Followers of a participatory
|
5
|
+
# This class counts all Followers of a participatory process or
|
6
|
+
# participatory processes belonging to a participatory process group
|
6
7
|
class StatsFollowersCount < Rectify::Query
|
7
8
|
def self.for(participatory_space)
|
8
|
-
return 0 unless participatory_space.is_a?
|
9
|
+
return 0 unless participatory_space.is_a?(Decidim::ParticipatoryProcess) ||
|
10
|
+
participatory_space.is_a?(Decidim::ParticipatoryProcessGroup) && participatory_space.participatory_processes.exists?
|
9
11
|
|
10
12
|
new(participatory_space).query
|
11
13
|
end
|
@@ -26,7 +28,7 @@ module Decidim
|
|
26
28
|
Decidim.component_manifests.sum do |component|
|
27
29
|
component.stats
|
28
30
|
.filter(tag: :followers)
|
29
|
-
.with_context(
|
31
|
+
.with_context(space_components)
|
30
32
|
.map { |_name, value| value }
|
31
33
|
.sum
|
32
34
|
end
|
@@ -36,11 +38,23 @@ module Decidim
|
|
36
38
|
Decidim.participatory_space_manifests.sum do |space|
|
37
39
|
space.stats
|
38
40
|
.filter(tag: :followers)
|
39
|
-
.with_context(
|
41
|
+
.with_context(participatory_space_items)
|
40
42
|
.map { |_name, value| value }
|
41
43
|
.sum
|
42
44
|
end
|
43
45
|
end
|
46
|
+
|
47
|
+
def participatory_space_items
|
48
|
+
@participatory_space_items ||= if participatory_space.is_a?(Decidim::ParticipatoryProcess)
|
49
|
+
participatory_space
|
50
|
+
else
|
51
|
+
participatory_space.participatory_processes
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def space_components
|
56
|
+
@space_components ||= Decidim::Component.where(participatory_space: participatory_space_items).published
|
57
|
+
end
|
44
58
|
end
|
45
59
|
end
|
46
60
|
end
|
@@ -2,10 +2,12 @@
|
|
2
2
|
|
3
3
|
module Decidim
|
4
4
|
module ParticipatoryProcesses
|
5
|
-
# This class counts unique Participants on a participatory
|
5
|
+
# This class counts unique Participants on a participatory process or
|
6
|
+
# participatory processes belonging to a participatory process group
|
6
7
|
class StatsParticipantsCount < Rectify::Query
|
7
8
|
def self.for(participatory_space)
|
8
|
-
return 0 unless participatory_space.is_a?
|
9
|
+
return 0 unless participatory_space.is_a?(Decidim::ParticipatoryProcess) ||
|
10
|
+
participatory_space.is_a?(Decidim::ParticipatoryProcessGroup) && participatory_space.participatory_processes.exists?
|
9
11
|
|
10
12
|
new(participatory_space).query
|
11
13
|
end
|
@@ -30,9 +32,17 @@ module Decidim
|
|
30
32
|
|
31
33
|
attr_reader :participatory_space
|
32
34
|
|
35
|
+
def participatory_space_ids
|
36
|
+
@participatory_space_ids ||= if participatory_space.is_a?(Decidim::ParticipatoryProcess)
|
37
|
+
participatory_space.id
|
38
|
+
else
|
39
|
+
participatory_space.participatory_processes.pluck(:id)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
33
43
|
def comments_query
|
34
44
|
Decidim::Comments::Comment
|
35
|
-
.where(decidim_root_commentable_id:
|
45
|
+
.where(decidim_root_commentable_id: participatory_space_ids)
|
36
46
|
.pluck(:decidim_author_id)
|
37
47
|
.uniq
|
38
48
|
end
|
@@ -89,7 +99,11 @@ module Decidim
|
|
89
99
|
end
|
90
100
|
|
91
101
|
def space_components
|
92
|
-
@space_components ||= participatory_space.
|
102
|
+
@space_components ||= if participatory_space.is_a?(Decidim::ParticipatoryProcess)
|
103
|
+
participatory_space.components
|
104
|
+
else
|
105
|
+
Decidim::Component.where(participatory_space: participatory_space.participatory_processes)
|
106
|
+
end
|
93
107
|
end
|
94
108
|
|
95
109
|
def proposals_components
|
@@ -12,14 +12,18 @@ module Decidim
|
|
12
12
|
processes = Decidim::ParticipatoryProcess.all
|
13
13
|
|
14
14
|
if @current_user
|
15
|
-
return
|
15
|
+
return groups if @current_user.admin?
|
16
16
|
|
17
17
|
processes = processes.visible_for(@current_user.id)
|
18
18
|
else
|
19
19
|
processes = processes.public_spaces
|
20
20
|
end
|
21
21
|
|
22
|
-
|
22
|
+
groups.where(id: processes.pluck(:decidim_participatory_process_group_id))
|
23
|
+
end
|
24
|
+
|
25
|
+
def groups
|
26
|
+
@groups ||= Decidim::ParticipatoryProcessGroup.all
|
23
27
|
end
|
24
28
|
end
|
25
29
|
end
|
@@ -54,7 +54,7 @@ module Decidim
|
|
54
54
|
def import_process_group(attributes)
|
55
55
|
Decidim.traceability.perform_action!("create", ParticipatoryProcessGroup, @user) do
|
56
56
|
group = ParticipatoryProcessGroup.find_or_initialize_by(
|
57
|
-
|
57
|
+
title: attributes["title"],
|
58
58
|
description: attributes["description"],
|
59
59
|
organization: @organization
|
60
60
|
)
|
@@ -41,7 +41,7 @@ module Decidim
|
|
41
41
|
},
|
42
42
|
participatory_process_group: {
|
43
43
|
id: participatory_process.participatory_process_group.try(:id),
|
44
|
-
|
44
|
+
title: participatory_process.participatory_process_group.try(:title) || empty_translatable,
|
45
45
|
description: participatory_process.participatory_process_group.try(:description) || empty_translatable,
|
46
46
|
remote_hero_image_url: Decidim::ParticipatoryProcesses::ParticipatoryProcessGroupPresenter.new(participatory_process.participatory_process_group).hero_image_url
|
47
47
|
},
|
@@ -5,7 +5,8 @@ module Decidim
|
|
5
5
|
# Service that encapsulates all logic related to filtering participatory processes.
|
6
6
|
class ParticipatoryProcessSearch < ParticipatorySpaceSearch
|
7
7
|
def initialize(options = {})
|
8
|
-
|
8
|
+
base_relation = options.has_key?(:base_relation) ? options.delete(:base_relation) : ParticipatoryProcess.all
|
9
|
+
super(base_relation, options)
|
9
10
|
end
|
10
11
|
|
11
12
|
def search_date
|
data/app/views/decidim/participatory_processes/admin/participatory_process_copies/new.html.erb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
<% add_decidim_page_title(t("participatory_process_copies.new.select", scope: "decidim.admin")) %>
|
2
|
+
|
1
3
|
<%= decidim_form_for(@form, url: participatory_process_copies_path(current_participatory_process), method: :post, html: { class: "form copy_participatory_process" }) do |f| %>
|
2
4
|
<%= render partial: "form", object: f, locals: { title: t("participatory_process_copies.new.title", scope: "decidim.admin"), select: t("participatory_process_copies.new.select", scope: "decidim.admin") } %>
|
3
5
|
|
data/app/views/decidim/participatory_processes/admin/participatory_process_groups/_form.html.erb
CHANGED
@@ -1,17 +1,72 @@
|
|
1
|
-
<div class="
|
2
|
-
|
3
|
-
|
1
|
+
<div class="card">
|
2
|
+
<div class="card-divider">
|
3
|
+
<h2 class="card-title"><%= t(".title") %></h2>
|
4
|
+
</div>
|
5
|
+
<div class="card-section">
|
6
|
+
<div class="row column">
|
7
|
+
<%= form.translated :text_field, :title, autofocus: true %>
|
8
|
+
</div>
|
4
9
|
|
5
|
-
<div class="row column">
|
6
|
-
|
7
|
-
</div>
|
10
|
+
<div class="row column">
|
11
|
+
<%= form.translated :editor, :description, toolbar: :full, lines: 25 %>
|
12
|
+
</div>
|
8
13
|
|
9
|
-
<div class="row column">
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
</div>
|
14
|
+
<div class="row column">
|
15
|
+
<% if processes_for_select %>
|
16
|
+
<%= form.select :participatory_process_ids, processes_for_select, {}, { multiple: true, class: "chosen-select" } %>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="row column">
|
21
|
+
<%= form.upload :hero_image %>
|
22
|
+
</div>
|
23
|
+
</div>
|
24
|
+
|
25
|
+
<div class="card-divider">
|
26
|
+
<h2 class="card-title"><%= t(".metadata") %></h2>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div class="card-section">
|
30
|
+
<div class="row column">
|
31
|
+
<%= form.text_field :hashtag %>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div class="row column">
|
35
|
+
<%= form.text_field :group_url %>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<div class="row column">
|
39
|
+
<%= form.translated :text_field, :developer_group %>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<div class="row column">
|
43
|
+
<%= form.translated :text_field, :local_area %>
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div class="row column">
|
47
|
+
<%= form.translated :text_field, :meta_scope %>
|
48
|
+
</div>
|
49
|
+
|
50
|
+
<div class="row column">
|
51
|
+
<%= form.translated :text_field, :target %>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
<div class="row column">
|
55
|
+
<%= form.translated :text_field, :participatory_scope %>
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div class="row column">
|
59
|
+
<%= form.translated :text_field, :participatory_structure %>
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
|
63
|
+
<div class="card-divider">
|
64
|
+
<h2 class="card-title"><%= t(".visibility") %></h2>
|
65
|
+
</div>
|
14
66
|
|
15
|
-
<div class="
|
16
|
-
|
67
|
+
<div class="card-section">
|
68
|
+
<div class="row column">
|
69
|
+
<%= form.check_box :promoted %>
|
70
|
+
</div>
|
71
|
+
</div>
|
17
72
|
</div>
|
data/app/views/decidim/participatory_processes/admin/participatory_process_groups/edit.html.erb
CHANGED
@@ -1,18 +1,11 @@
|
|
1
|
-
|
2
1
|
<%= decidim_form_for(@form, html: { class: "form edit_participatory_process_group" }) do |f| %>
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
</h2>
|
11
|
-
</div>
|
12
|
-
<div class="card-section">
|
13
|
-
<%= render partial: "form", object: f %>
|
14
|
-
</div>
|
15
|
-
</div>
|
2
|
+
<h2 class="process-title-summary">
|
3
|
+
<%= t "participatory_process_groups.edit.title", scope: "decidim.admin" %>
|
4
|
+
<% if allowed_to? :destroy, :process_group, process_group: participatory_process_group %>
|
5
|
+
<%= link_to t("decidim.admin.actions.destroy"), participatory_process_group, method: :delete, class: "button alert tiny button--title destroy", data: { confirm: t("decidim.admin.actions.confirm_destroy") } %>
|
6
|
+
<% end %>
|
7
|
+
</h2>
|
8
|
+
<%= render partial: "form", object: f %>
|
16
9
|
<div class="button--double form-general-submit">
|
17
10
|
<%= f.submit t("participatory_process_groups.edit.update", scope: "decidim.admin") %>
|
18
11
|
</div>
|
data/app/views/decidim/participatory_processes/admin/participatory_process_groups/index.html.erb
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
<div class="card-divider">
|
11
11
|
<h2 class="card-title">
|
12
12
|
<%= t "decidim.admin.titles.participatory_process_groups" %>
|
13
|
-
<%= link_to t("actions.new_process_group", scope: "decidim.admin"), [
|
13
|
+
<%= link_to t("actions.new_process_group", scope: "decidim.admin"), ["new", "participatory_process_group"], class: "button tiny button--title new" if allowed_to? :create, :process_group %>
|
14
14
|
</h2>
|
15
15
|
</div>
|
16
16
|
<div class="card-section">
|
@@ -18,7 +18,7 @@
|
|
18
18
|
<table class="table-list">
|
19
19
|
<thead>
|
20
20
|
<tr>
|
21
|
-
<th><%= t("models.participatory_process_group.fields.
|
21
|
+
<th><%= t("models.participatory_process_group.fields.title", scope: "decidim.admin") %></th>
|
22
22
|
<th></th>
|
23
23
|
</tr>
|
24
24
|
</thead>
|
@@ -26,21 +26,30 @@
|
|
26
26
|
<% collection.each do |group| %>
|
27
27
|
<tr>
|
28
28
|
<td>
|
29
|
+
<% if group.promoted? %>
|
30
|
+
<span data-tooltip class="icon-state icon-highlight" aria-haspopup="true" data-disable-hover="false" title="<%= t("models.participatory_process.fields.promoted", scope: "decidim.admin") %>">
|
31
|
+
<%= icon "star" %>
|
32
|
+
</span>
|
33
|
+
<% end %>
|
29
34
|
<% if allowed_to? :update, :process_group, process_group: group %>
|
30
|
-
<%= link_to translated_attribute(group.
|
35
|
+
<%= link_to translated_attribute(group.title), ["edit", group] %><br>
|
31
36
|
<% else %>
|
32
|
-
<%= translated_attribute(group.
|
37
|
+
<%= translated_attribute(group.title) %>
|
33
38
|
<% end %>
|
34
39
|
</td>
|
35
40
|
<td class="table-list__actions">
|
36
41
|
<% if allowed_to? :update, :process_group, process_group: group %>
|
37
|
-
<%= icon_link_to "pencil", [
|
42
|
+
<%= icon_link_to "pencil", ["edit", group], t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
|
43
|
+
<% else %>
|
44
|
+
<span class="action-space icon"></span>
|
38
45
|
<% end %>
|
39
46
|
|
40
47
|
<%= icon_link_to "eye", decidim_participatory_processes.participatory_process_group_path(group), t("actions.preview", scope: "decidim.admin"), class: "action-icon--preview" %>
|
41
48
|
|
42
49
|
<% if allowed_to? :destroy, :process_group, process_group: group %>
|
43
50
|
<%= icon_link_to "circle-x", group, t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
|
51
|
+
<% else %>
|
52
|
+
<span class="action-space icon"></span>
|
44
53
|
<% end %>
|
45
54
|
</td>
|
46
55
|
</tr>
|
data/app/views/decidim/participatory_processes/admin/participatory_process_groups/new.html.erb
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
<%= decidim_form_for(@form, html: { class: "form new_participatory_process_group" }) do |f| %>
|
2
|
-
<
|
3
|
-
|
4
|
-
<h2 class="card-title"><%= t "participatory_process_groups.new.title", scope: "decidim.admin" %></h2>
|
5
|
-
</div>
|
6
|
-
<div class="card-section">
|
7
|
-
<%= render partial: "form", object: f %>
|
8
|
-
</div>
|
9
|
-
</div>
|
2
|
+
<h2 class="process-title-summary"><%= t "participatory_process_groups.new.title", scope: "decidim.admin" %></h2>
|
3
|
+
<%= render partial: "form", object: f %>
|
10
4
|
<div class="button--double form-general-submit">
|
11
5
|
<%= f.submit t("participatory_process_groups.new.create", scope: "decidim.admin") %>
|
12
6
|
</div>
|
data/app/views/decidim/participatory_processes/admin/participatory_process_groups/show.html.erb
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
<dl>
|
2
2
|
<%= display_for participatory_process_group,
|
3
|
-
:
|
4
|
-
:description
|
3
|
+
:title,
|
4
|
+
:description,
|
5
|
+
:hashtag,
|
6
|
+
:group_url,
|
7
|
+
:developer_group,
|
8
|
+
:local_area,
|
9
|
+
:meta_scope,
|
10
|
+
:target,
|
11
|
+
:participatory_scope,
|
12
|
+
:participatory_structure %>
|
5
13
|
|
6
14
|
<dt><%= display_label(participatory_process_group, :participatory_processes) %></dt>
|
7
15
|
<% if participatory_process_group.participatory_processes.any? %>
|
data/app/views/decidim/participatory_processes/admin/participatory_process_steps/edit.html.erb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
<% add_decidim_page_title(t("participatory_process_steps.edit.title", scope: "decidim.admin")) %>
|
1
2
|
|
2
3
|
<%= decidim_form_for(@form, url: participatory_process_step_path(@participatory_process_step.participatory_process, @participatory_process_step), html: { class: "form edit_participatory_process_step" }) do |f| %>
|
3
4
|
<%= render partial: "form", object: f, locals: { title: t("participatory_process_steps.edit.title", scope: "decidim.admin") } %>
|
data/app/views/decidim/participatory_processes/admin/participatory_process_steps/index.html.erb
CHANGED
@@ -43,14 +43,20 @@
|
|
43
43
|
<td class="table-list__actions">
|
44
44
|
<% if allowed_to?(:activate, :process_step, process_step: step) && !step.active? %>
|
45
45
|
<%= icon_link_to "circle-check", participatory_process_step_activate_path(current_participatory_process, step), t("actions.activate", scope: "decidim.admin"), class: "action-icon--activate", method: :post %>
|
46
|
+
<% else %>
|
47
|
+
<span class="action-space icon"></span>
|
46
48
|
<% end %>
|
47
49
|
|
48
50
|
<% if allowed_to? :update, :process_step, process_step: step %>
|
49
51
|
<%= icon_link_to "pencil", edit_participatory_process_step_path(current_participatory_process, step), t("actions.edit", scope: "decidim.admin"), class: "action-icon--edit" %>
|
52
|
+
<% else %>
|
53
|
+
<span class="action-space icon"></span>
|
50
54
|
<% end %>
|
51
55
|
|
52
56
|
<% if allowed_to? :destroy, :process_step, process_step: step %>
|
53
57
|
<%= icon_link_to "circle-x", participatory_process_step_path(current_participatory_process, step), t("actions.destroy", scope: "decidim.admin"), class: "action-icon--remove", method: :delete, data: { confirm: t("actions.confirm_destroy", scope: "decidim.admin") } %>
|
58
|
+
<% else %>
|
59
|
+
<span class="action-space icon"></span>
|
54
60
|
<% end %>
|
55
61
|
</td>
|
56
62
|
</tr>
|