decidim-participatory_processes 0.24.0 → 0.25.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_blocks/highlighted_participatory_processes/filters.erb +0 -1
- data/app/cells/decidim/participatory_process_groups/content_blocks/statistics_cell.rb +16 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/title/show.erb +1 -1
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/single_process.erb +1 -1
- data/app/cells/decidim/participatory_processes/process_group_m_cell.rb +1 -1
- data/app/cells/decidim/participatory_processes/process_group_s_cell.rb +2 -2
- data/app/cells/decidim/participatory_processes/process_m_cell.rb +1 -1
- data/app/cells/decidim/participatory_processes/process_s_cell.rb +2 -2
- data/app/commands/decidim/participatory_processes/admin/copy_participatory_process.rb +9 -2
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process.rb +5 -10
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process_group.rb +3 -3
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb +3 -3
- data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb +1 -5
- data/app/forms/decidim/participatory_processes/admin/participatory_process_form.rb +2 -2
- data/app/forms/decidim/participatory_processes/admin/participatory_process_group_form.rb +1 -1
- data/app/forms/decidim/participatory_processes/admin/participatory_process_import_form.rb +1 -0
- data/app/helpers/decidim/participatory_processes/participatory_process_helper.rb +1 -1
- data/app/models/decidim/participatory_process.rb +9 -5
- data/app/models/decidim/participatory_process_group.rb +2 -2
- data/app/packs/entrypoints/decidim_participatory_processes.js +4 -0
- data/app/packs/entrypoints/decidim_participatory_processes_admin.js +1 -0
- data/app/{assets/images/decidim/participatory_processes/process.svg → packs/images/decidim/participatory_processes/decidim_participatory_processes.svg} +0 -0
- data/app/packs/src/decidim/participatory_processes/admin/participatory_processes.js +18 -0
- data/app/packs/src/decidim/participatory_processes/filters.js +28 -0
- data/app/presenters/decidim/participatory_processes/participatory_process_group_presenter.rb +1 -6
- data/app/presenters/decidim/participatory_processes/participatory_process_group_stats_presenter.rb +3 -13
- data/app/presenters/decidim/participatory_processes/participatory_process_presenter.rb +2 -9
- data/app/presenters/decidim/participatory_processes/participatory_process_stats_presenter.rb +3 -13
- data/app/queries/decidim/participatory_processes/admin/admin_users.rb +23 -10
- data/app/queries/decidim/participatory_processes/admin/moderators.rb +24 -11
- data/app/queries/decidim/participatory_processes/stats_participants_count.rb +9 -0
- data/app/serializers/decidim/participatory_processes/participatory_process_serializer.rb +2 -1
- data/app/views/decidim/participatory_processes/admin/participatory_process_copies/_form.html.erb +0 -2
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/index.html.erb +6 -4
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/show.html.erb +2 -2
- data/app/views/decidim/participatory_processes/admin/participatory_process_imports/_form.html.erb +0 -2
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/_form.html.erb +0 -2
- data/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb +1 -3
- data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +4 -2
- data/app/views/decidim/participatory_processes/participatory_process_groups/show.html.erb +2 -2
- data/app/views/decidim/participatory_processes/participatory_processes/_promoted_process.html.erb +1 -1
- data/app/views/decidim/participatory_processes/participatory_processes/_promoted_process_group.html.erb +1 -1
- data/app/views/decidim/participatory_processes/participatory_processes/index.html.erb +2 -2
- data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +2 -2
- data/app/views/layouts/decidim/_process_header.html.erb +1 -1
- data/app/views/layouts/decidim/_process_header_steps.html.erb +1 -1
- data/app/views/layouts/decidim/admin/participatory_process.html.erb +2 -76
- data/app/views/layouts/decidim/admin/participatory_process_group.html.erb +1 -1
- data/app/views/layouts/decidim/participatory_process.html.erb +2 -2
- data/config/assets.rb +9 -0
- data/config/locales/ar.yml +0 -19
- data/config/locales/ca.yml +4 -20
- data/config/locales/cs.yml +15 -31
- data/config/locales/de.yml +5 -21
- data/config/locales/el.yml +0 -19
- data/config/locales/en.yml +4 -20
- data/config/locales/es-MX.yml +4 -20
- data/config/locales/es-PY.yml +4 -20
- data/config/locales/es.yml +4 -20
- data/config/locales/eu.yml +0 -17
- data/config/locales/fi-plain.yml +4 -20
- data/config/locales/fi.yml +4 -20
- data/config/locales/fr-CA.yml +2 -21
- data/config/locales/fr-LU.yml +484 -0
- data/config/locales/fr.yml +2 -21
- data/config/locales/gl.yml +17 -20
- data/config/locales/hu.yml +0 -19
- data/config/locales/id-ID.yml +0 -17
- data/config/locales/is-IS.yml +0 -15
- data/config/locales/it.yml +52 -20
- data/config/locales/ja.yml +55 -19
- data/config/locales/lb-LU.yml +1 -0
- data/config/locales/lv.yml +0 -18
- data/config/locales/nl.yml +4 -19
- data/config/locales/no.yml +0 -19
- data/config/locales/pl.yml +6 -24
- data/config/locales/pt-BR.yml +103 -17
- data/config/locales/pt.yml +0 -19
- data/config/locales/ro-RO.yml +8 -23
- data/config/locales/ru.yml +0 -17
- data/config/locales/sk.yml +0 -19
- data/config/locales/sr-CS.yml +0 -4
- data/config/locales/sv.yml +39 -19
- data/config/locales/tr-TR.yml +1 -20
- data/config/locales/uk.yml +0 -17
- data/config/locales/zh-CN.yml +0 -19
- data/db/migrate/20201006072346_fix_attachments_titles.rb +5 -8
- data/db/migrate/20210415163339_allow_null_file_column_in_decidim_attachments_table.rb +7 -0
- data/lib/decidim/api/participatory_process_group_type.rb +4 -0
- data/lib/decidim/api/participatory_process_type.rb +9 -1
- data/lib/decidim/participatory_processes/admin_engine.rb +119 -37
- data/lib/decidim/participatory_processes/engine.rb +7 -10
- data/lib/decidim/participatory_processes/participatory_space.rb +40 -7
- data/lib/decidim/participatory_processes/version.rb +1 -1
- metadata +35 -25
- data/app/assets/config/admin/decidim_participatory_processes_manifest.js +0 -1
- data/app/assets/config/decidim_participatory_processes_manifest.js +0 -2
- data/app/assets/javascripts/decidim/participatory_processes/admin/participatory_processes.js.es6 +0 -20
- data/app/assets/javascripts/decidim/participatory_processes/filters.js.es6 +0 -31
- data/app/cells/decidim/participatory_process_groups/content_blocks/stats/show.erb +0 -13
- data/app/cells/decidim/participatory_process_groups/content_blocks/stats_cell.rb +0 -17
- data/app/cells/decidim/participatory_processes/statistic/show.erb +0 -9
- data/app/cells/decidim/participatory_processes/statistic_cell.rb +0 -20
- data/app/cells/decidim/participatory_processes/statistics/show.erb +0 -17
- data/app/cells/decidim/participatory_processes/statistics_cell.rb +0 -18
- data/app/helpers/decidim/participatory_processes/admin/participatory_processes_menu_helper.rb +0 -23
- data/app/views/decidim/participatory_processes/admin/shared/_secondary_nav.html.erb +0 -3
- data/config/locales/ja-JP.yml +0 -445
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32a235fc3b9a09586d67a35be3873650559f90c93909805b4b7e647519301a64
|
4
|
+
data.tar.gz: '096b8db9366702022964db30a212d3171a174ae00ffd941f2a5ffdafa798128f'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fec3daeb712921a3f5a295ad10ae0bb9ba28015bf10c60a6772ab64aefc945ae72956a08c6d89fcb38144cbd51b7b275f1113162fd92b5a976a7baafb12d08e6
|
7
|
+
data.tar.gz: 8a006bf54e63d8ab2f6a7ca4dfc84ee440518d2ab11db4a19a7577add53d7b104bb4036d6d956f236da3c91dd2bf8e261d8badfea216c3952407550ccf52374d
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcessGroups
|
5
|
+
module ContentBlocks
|
6
|
+
class StatisticsCell < Decidim::StatisticsCell
|
7
|
+
def stats
|
8
|
+
@stats ||= begin
|
9
|
+
participatory_process_group = Decidim::ParticipatoryProcessGroup.find(model.scoped_resource_id)
|
10
|
+
Decidim::ParticipatoryProcesses::ParticipatoryProcessGroupStatsPresenter.new(participatory_process_group: participatory_process_group).collection
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<%= decidim_sanitize translated_attribute(participatory_process_group.description) %>
|
6
6
|
<div class="row">
|
7
7
|
<div class="column medium-2 text-muted">
|
8
|
-
<%= icon "grid-three-up", role: "img", class: "mr-xs" %>
|
8
|
+
<%= icon "grid-three-up", role: "img", "aria-hidden": true, class: "mr-xs" %>
|
9
9
|
<%= t("decidim.participatory_process_groups.content_blocks.title.participatory_processes", count: participatory_processes_count) %>
|
10
10
|
</div>
|
11
11
|
<% if has_meta_scope? %>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
</div>
|
23
23
|
</div>
|
24
24
|
<div class="column large-6 card--process__column">
|
25
|
-
<div class="card--full__image" style="background-image:url(<%= process.hero_image.
|
25
|
+
<div class="card--full__image" style="background-image:url(<%= process.attached_uploader(:hero_image).path %>)">
|
26
26
|
<div class="card__content row collapse">
|
27
27
|
<div class="large-6 large-offset-6 columns">
|
28
28
|
<%= link_to decidim_participatory_processes.participatory_process_path(process), class: "button expanded button--sc" do %>
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
private
|
9
9
|
|
10
10
|
def has_image?
|
11
|
-
model.hero_image.
|
11
|
+
model.hero_image.attached?
|
12
12
|
end
|
13
13
|
|
14
14
|
def resource_path
|
@@ -16,7 +16,7 @@ module Decidim
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def resource_image_path
|
19
|
-
model.hero_image.
|
19
|
+
model.attached_uploader(:hero_image).path
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -8,7 +8,7 @@ module Decidim
|
|
8
8
|
private
|
9
9
|
|
10
10
|
def has_image?
|
11
|
-
model.hero_image.
|
11
|
+
model.hero_image.attached?
|
12
12
|
end
|
13
13
|
|
14
14
|
def has_step?
|
@@ -20,7 +20,7 @@ module Decidim
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def resource_image_path
|
23
|
-
model.hero_image.
|
23
|
+
model.attached_uploader(:hero_image).path
|
24
24
|
end
|
25
25
|
|
26
26
|
def step_title
|
@@ -26,6 +26,7 @@ module Decidim
|
|
26
26
|
|
27
27
|
ParticipatoryProcess.transaction do
|
28
28
|
copy_participatory_process
|
29
|
+
copy_participatory_process_attachments
|
29
30
|
copy_participatory_process_steps if @form.copy_steps?
|
30
31
|
copy_participatory_process_categories if @form.copy_categories?
|
31
32
|
copy_participatory_process_components if @form.copy_components?
|
@@ -47,8 +48,6 @@ module Decidim
|
|
47
48
|
hashtag: @participatory_process.hashtag,
|
48
49
|
description: @participatory_process.description,
|
49
50
|
short_description: @participatory_process.short_description,
|
50
|
-
hero_image: @participatory_process.hero_image,
|
51
|
-
banner_image: @participatory_process.banner_image,
|
52
51
|
promoted: @participatory_process.promoted,
|
53
52
|
scope: @participatory_process.scope,
|
54
53
|
developer_group: @participatory_process.developer_group,
|
@@ -65,6 +64,14 @@ module Decidim
|
|
65
64
|
)
|
66
65
|
end
|
67
66
|
|
67
|
+
def copy_participatory_process_attachments
|
68
|
+
[:hero_image, :banner_image].each do |attribute|
|
69
|
+
next unless @participatory_process.attached_uploader(attribute).attached?
|
70
|
+
|
71
|
+
@copied_process.send(attribute).attach(@participatory_process.send(attribute).blob)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
68
75
|
def copy_participatory_process_steps
|
69
76
|
@steps_relationship = {}
|
70
77
|
|
@@ -6,6 +6,8 @@ module Decidim
|
|
6
6
|
# A command with all the business logic when creating a new participatory
|
7
7
|
# process in the system.
|
8
8
|
class UpdateParticipatoryProcess < Rectify::Command
|
9
|
+
include ::Decidim::AttachmentAttributesMethods
|
10
|
+
|
9
11
|
# Public: Initializes the command.
|
10
12
|
#
|
11
13
|
# participatory_process - the ParticipatoryProcess to update
|
@@ -78,16 +80,9 @@ module Decidim
|
|
78
80
|
show_metrics: form.show_metrics,
|
79
81
|
show_statistics: form.show_statistics,
|
80
82
|
announcement: form.announcement
|
81
|
-
}.merge(
|
82
|
-
|
83
|
-
|
84
|
-
def uploader_attributes
|
85
|
-
{
|
86
|
-
hero_image: form.hero_image,
|
87
|
-
remove_hero_image: form.remove_hero_image,
|
88
|
-
banner_image: form.banner_image,
|
89
|
-
remove_banner_image: form.remove_banner_image
|
90
|
-
}.delete_if { |_k, val| val.is_a?(Decidim::ApplicationUploader) }
|
83
|
+
}.merge(
|
84
|
+
attachment_attributes(:hero_image, :banner_image)
|
85
|
+
)
|
91
86
|
end
|
92
87
|
|
93
88
|
def related_processes
|
data/app/commands/decidim/participatory_processes/admin/update_participatory_process_group.rb
CHANGED
@@ -6,6 +6,8 @@ module Decidim
|
|
6
6
|
# A command with all the business logic when creating a new participatory
|
7
7
|
# process group in the system.
|
8
8
|
class UpdateParticipatoryProcessGroup < Rectify::Command
|
9
|
+
include ::Decidim::AttachmentAttributesMethods
|
10
|
+
|
9
11
|
# Public: Initializes the command.
|
10
12
|
#
|
11
13
|
# participatory_process_group - the ParticipatoryProcessGroup to update
|
@@ -52,8 +54,6 @@ module Decidim
|
|
52
54
|
def attributes
|
53
55
|
{
|
54
56
|
title: form.title,
|
55
|
-
hero_image: form.hero_image,
|
56
|
-
remove_hero_image: form.remove_hero_image,
|
57
57
|
description: form.description,
|
58
58
|
hashtag: form.hashtag,
|
59
59
|
group_url: form.group_url,
|
@@ -65,7 +65,7 @@ module Decidim
|
|
65
65
|
participatory_structure: form.participatory_structure,
|
66
66
|
target: form.target,
|
67
67
|
promoted: form.promoted
|
68
|
-
}
|
68
|
+
}.merge(attachment_attributes(:hero_image))
|
69
69
|
end
|
70
70
|
|
71
71
|
def participatory_processes
|
@@ -42,9 +42,9 @@ module Decidim
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def edit
|
45
|
-
@
|
46
|
-
enforce_permission_to :update, :process_group, process_group: @
|
47
|
-
@form = form(ParticipatoryProcessGroupForm).from_model(@
|
45
|
+
@item = collection.find(params[:id])
|
46
|
+
enforce_permission_to :update, :process_group, process_group: @item
|
47
|
+
@form = form(ParticipatoryProcessGroupForm).from_model(@item)
|
48
48
|
render layout: "decidim/admin/participatory_process_group"
|
49
49
|
end
|
50
50
|
|
data/app/controllers/decidim/participatory_processes/admin/participatory_processes_controller.rb
CHANGED
@@ -93,11 +93,7 @@ module Decidim
|
|
93
93
|
alias current_participatory_space current_participatory_process
|
94
94
|
|
95
95
|
def participatory_process_params
|
96
|
-
{
|
97
|
-
id: params[:slug],
|
98
|
-
hero_image: current_participatory_process.hero_image,
|
99
|
-
banner_image: current_participatory_process.banner_image
|
100
|
-
}.merge(params[:participatory_process].to_unsafe_h)
|
96
|
+
{ id: params[:slug] }.merge(params[:participatory_process].to_unsafe_h)
|
101
97
|
end
|
102
98
|
end
|
103
99
|
end
|
@@ -45,8 +45,8 @@ module Decidim
|
|
45
45
|
|
46
46
|
attribute :banner_image
|
47
47
|
attribute :hero_image
|
48
|
-
attribute :remove_banner_image
|
49
|
-
attribute :remove_hero_image
|
48
|
+
attribute :remove_banner_image, Boolean, default: false
|
49
|
+
attribute :remove_hero_image, Boolean, default: false
|
50
50
|
|
51
51
|
validates :area, presence: true, if: proc { |object| object.area_id.present? }
|
52
52
|
validates :scope, presence: true, if: proc { |object| object.scope_id.present? }
|
@@ -53,7 +53,7 @@ module Decidim
|
|
53
53
|
OpenStruct.new(
|
54
54
|
text: translated_attribute(cta_settings.button_text),
|
55
55
|
path: cta_settings.button_url,
|
56
|
-
image_url: block.images_container.background_image.big
|
56
|
+
image_url: block.images_container.attached_uploader(:background_image).path(variant: :big)
|
57
57
|
)
|
58
58
|
end
|
59
59
|
|
@@ -66,11 +66,11 @@ module Decidim
|
|
66
66
|
validates :slug, uniqueness: { scope: :organization }
|
67
67
|
validates :slug, presence: true, format: { with: Decidim::ParticipatoryProcess.slug_format }
|
68
68
|
|
69
|
-
|
70
|
-
|
69
|
+
has_one_attached :hero_image
|
70
|
+
validates_upload :hero_image, uploader: Decidim::HeroImageUploader
|
71
71
|
|
72
|
-
|
73
|
-
|
72
|
+
has_one_attached :banner_image
|
73
|
+
validates_upload :banner_image, uploader: Decidim::BannerImageUploader
|
74
74
|
|
75
75
|
scope :past, -> { where(arel_table[:end_date].lt(Date.current)) }
|
76
76
|
scope :upcoming, -> { where(arel_table[:start_date].gt(Date.current)) }
|
@@ -156,11 +156,15 @@ module Decidim
|
|
156
156
|
slug
|
157
157
|
end
|
158
158
|
|
159
|
-
# Overrides the
|
159
|
+
# Overrides the moderators methods from `Participable`.
|
160
160
|
def moderators
|
161
161
|
"#{admin_module_name}::Moderators".constantize.for(self)
|
162
162
|
end
|
163
163
|
|
164
|
+
def self.moderators(organization)
|
165
|
+
"#{admin_module_name}::Moderators".constantize.for_organization(organization)
|
166
|
+
end
|
167
|
+
|
164
168
|
def user_roles(role_name = nil)
|
165
169
|
roles = Decidim::ParticipatoryProcessUserRole.where(participatory_process: self)
|
166
170
|
return roles if role_name.blank?
|
@@ -20,8 +20,8 @@ module Decidim
|
|
20
20
|
foreign_key: "decidim_organization_id",
|
21
21
|
class_name: "Decidim::Organization"
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
has_one_attached :hero_image
|
24
|
+
validates_upload :hero_image, uploader: Decidim::HeroImageUploader
|
25
25
|
|
26
26
|
# Scope to return only the promoted groups.
|
27
27
|
#
|
@@ -0,0 +1 @@
|
|
1
|
+
import "src/decidim/participatory_processes/admin/participatory_processes"
|
File without changes
|
@@ -0,0 +1,18 @@
|
|
1
|
+
$(() => {
|
2
|
+
const $participatoryProcessScopeEnabled = $("#participatory_process_scopes_enabled");
|
3
|
+
const $participatoryProcessScopeId = $("#participatory_process_scope_id");
|
4
|
+
const $participatoryProcessScopeTypeId = $("#participatory_process_scope_type_max_depth_id");
|
5
|
+
|
6
|
+
if ($(".edit_participatory_process, .new_participatory_process").length > 0) {
|
7
|
+
$participatoryProcessScopeEnabled.on("change", (event) => {
|
8
|
+
const checked = event.target.checked;
|
9
|
+
window.theDataPicker.enabled($participatoryProcessScopeId, checked);
|
10
|
+
if (checked === true) {
|
11
|
+
$participatoryProcessScopeTypeId.removeAttr("disabled");
|
12
|
+
} else {
|
13
|
+
$participatoryProcessScopeTypeId.attr("disabled", true)
|
14
|
+
}
|
15
|
+
})
|
16
|
+
window.theDataPicker.enabled($participatoryProcessScopeId, $participatoryProcessScopeEnabled.prop("checked"));
|
17
|
+
}
|
18
|
+
});
|
@@ -0,0 +1,28 @@
|
|
1
|
+
$(() => {
|
2
|
+
const $processesGrid = $("#processes-grid");
|
3
|
+
const $loading = $processesGrid.find(".loading");
|
4
|
+
const filterLinksSelector = ".order-by__tabs a"
|
5
|
+
|
6
|
+
$loading.hide();
|
7
|
+
|
8
|
+
$processesGrid.on("click", filterLinksSelector, (event) => {
|
9
|
+
const $processesGridCards = $processesGrid.find(".card-grid .column");
|
10
|
+
let $target = $(event.target);
|
11
|
+
|
12
|
+
// IE11 matches the <strong> element inside the filtering anchor element
|
13
|
+
// as the `event.target` breaking the functionality below.
|
14
|
+
if (!$target.is("a")) {
|
15
|
+
$target = $target.parents("a");
|
16
|
+
}
|
17
|
+
|
18
|
+
$(filterLinksSelector).removeClass("is-active");
|
19
|
+
$target.addClass("is-active");
|
20
|
+
|
21
|
+
$processesGridCards.hide();
|
22
|
+
$loading.show();
|
23
|
+
|
24
|
+
if (window.history) {
|
25
|
+
window.history.pushState(null, null, $target.attr("href"));
|
26
|
+
}
|
27
|
+
});
|
28
|
+
});
|
data/app/presenters/decidim/participatory_processes/participatory_process_group_presenter.rb
CHANGED
@@ -3,15 +3,10 @@
|
|
3
3
|
module Decidim
|
4
4
|
module ParticipatoryProcesses
|
5
5
|
class ParticipatoryProcessGroupPresenter < SimpleDelegator
|
6
|
-
include Rails.application.routes.mounted_helpers
|
7
|
-
include ActionView::Helpers::UrlHelper
|
8
|
-
|
9
|
-
delegate :url, to: :hero_image, prefix: true
|
10
|
-
|
11
6
|
def hero_image_url
|
12
7
|
return if process_group.blank?
|
13
8
|
|
14
|
-
|
9
|
+
process_group.attached_uploader(:hero_image).url(host: process_group.organization.host)
|
15
10
|
end
|
16
11
|
|
17
12
|
def process_group
|
data/app/presenters/decidim/participatory_processes/participatory_process_group_stats_presenter.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module ParticipatoryProcesses
|
5
5
|
# A presenter to render statistics in the homepage.
|
6
|
-
class ParticipatoryProcessGroupStatsPresenter <
|
6
|
+
class ParticipatoryProcessGroupStatsPresenter < Decidim::StatsPresenter
|
7
7
|
attribute :participatory_process_group, Decidim::ParticipatoryProcessGroup
|
8
8
|
include Decidim::IconHelper
|
9
9
|
|
@@ -14,22 +14,12 @@ module Decidim
|
|
14
14
|
highlighted_stats.concat(process_followers_stats(priority: StatsRegistry::HIGH_PRIORITY))
|
15
15
|
highlighted_stats.concat(component_stats(priority: StatsRegistry::HIGH_PRIORITY))
|
16
16
|
highlighted_stats.concat(component_stats(priority: StatsRegistry::MEDIUM_PRIORITY))
|
17
|
+
highlighted_stats.concat(comments_stats(:participatory_processes))
|
17
18
|
highlighted_stats = highlighted_stats.reject(&:empty?)
|
18
19
|
highlighted_stats = highlighted_stats.reject { |_stat_manifest, _stat_title, stat_number| stat_number.zero? }
|
19
20
|
grouped_highlighted_stats = highlighted_stats.group_by(&:first)
|
20
21
|
|
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
|
22
|
+
statistics(grouped_highlighted_stats)
|
33
23
|
end
|
34
24
|
|
35
25
|
private
|
@@ -3,19 +3,12 @@
|
|
3
3
|
module Decidim
|
4
4
|
module ParticipatoryProcesses
|
5
5
|
class ParticipatoryProcessPresenter < SimpleDelegator
|
6
|
-
include Rails.application.routes.mounted_helpers
|
7
|
-
include ActionView::Helpers::UrlHelper
|
8
|
-
|
9
6
|
def hero_image_url
|
10
|
-
|
11
|
-
|
12
|
-
URI.join(decidim.root_url(host: process.organization.host), process.hero_image_url).to_s
|
7
|
+
process.attached_uploader(:hero_image).url(host: process.organization.host)
|
13
8
|
end
|
14
9
|
|
15
10
|
def banner_image_url
|
16
|
-
|
17
|
-
|
18
|
-
URI.join(decidim.root_url(host: process.organization.host), process.banner_image_url).to_s
|
11
|
+
process.attached_uploader(:banner_image).url(host: process.organization.host)
|
19
12
|
end
|
20
13
|
|
21
14
|
def process
|