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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbf77a1caaccd751d1f54e333d78409c1f438de0493448730f405470cbaac153
|
4
|
+
data.tar.gz: 973d0baa2d8fe202937886c99e864b75b391564dbd26bff40701cb8eabc2136a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14ca8425093b10480d523add139cd1901ed656f3a3d0f153849179f8877eb70b3df47c137333ad4cd89263de9ca58d39900219bd0d02a85dd8d388239abb5fa9
|
7
|
+
data.tar.gz: 712cbd844bfc6d302056816e2e079c9a782d765ccc70d73474be0be611d0d484ac5eb66d73d4566b9250b870b4ed1d9975d286c51c4618fa15b88f1b660fb7f6
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcessGroups
|
5
|
+
class ContentBlockCell < Decidim::Admin::ContentBlockCell
|
6
|
+
delegate :scoped_resource, to: :controller
|
7
|
+
|
8
|
+
def edit_content_block_path
|
9
|
+
decidim_participatory_processes.edit_participatory_process_group_landing_page_content_block_path(scoped_resource, manifest_name)
|
10
|
+
end
|
11
|
+
|
12
|
+
def decidim_participatory_processes
|
13
|
+
Decidim::ParticipatoryProcesses::AdminEngine.routes.url_helpers
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<%= filter_form_for filter, decidim_participatory_processes.participatory_process_group_path(participatory_process_group) do |form| %>
|
2
|
+
<div class="columns mediumlarge-6 large-5">
|
3
|
+
<%= cell(
|
4
|
+
"decidim/scopes_picker",
|
5
|
+
form,
|
6
|
+
attribute: :scope_id,
|
7
|
+
multiple: true,
|
8
|
+
legend_title: I18n.t("decidim.scopes.scopes"),
|
9
|
+
label: false,
|
10
|
+
checkboxes_on_top: false
|
11
|
+
) %>
|
12
|
+
</div>
|
13
|
+
<div class="columns mediumlarge-6 large-5">
|
14
|
+
<%= form.areas_select :area_id,
|
15
|
+
areas_for_select(current_organization),
|
16
|
+
legend_title: t("decidim.shared.participatory_space_filters.filters.areas"),
|
17
|
+
label: "",
|
18
|
+
selected: filter.area_id,
|
19
|
+
include_blank: t("decidim.shared.participatory_space_filters.filters.select_an_area") %>
|
20
|
+
</div>
|
21
|
+
<% end %>
|
22
|
+
<%= javascript_include_tag "decidim/filters" %>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<div class="filters-controls hide-for-mediumlarge">
|
2
|
+
<button data-open="filter-box" class="filters-controls__trigger">
|
3
|
+
<%= t("filter", scope: "decidim.searches.filters_small_view") %>
|
4
|
+
<%= icon "caret-bottom", class: "icon--small float-right", aria_label: t("unfold", scope: "decidim.searches.filters_small_view"), role: "img" %>
|
5
|
+
</button>
|
6
|
+
</div>
|
7
|
+
|
8
|
+
<div class="reveal" id="filter-box" data-reveal>
|
9
|
+
<div class="reveal__header">
|
10
|
+
<h3 class="reveal__title"><%= t("filter_by", scope: "decidim.searches.filters_small_view") %>:</h3>
|
11
|
+
<button class="close-button" data-close aria-label="<%= 't("close_modal", scope: "decidim.searches.filters_small_view")' %>" type="button">
|
12
|
+
<span aria-hidden="true">×</span>
|
13
|
+
</button>
|
14
|
+
</div>
|
15
|
+
<div class="filters">
|
16
|
+
<%= render :filters %>
|
17
|
+
</div>
|
18
|
+
</div>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<section class="section" id="<%= block_id %>">
|
2
|
+
<%= render :title_filter_order %>
|
3
|
+
<%= render :participatory_space_filters %>
|
4
|
+
<div class="row small-up-1 medium-up-2 large-up-3 card-grid">
|
5
|
+
<%= cell "decidim/participatory_processes/filtered_participatory_processes", filtered_relation, default_filter: default_date_filter %>
|
6
|
+
</div>
|
7
|
+
</section>
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcessGroups
|
5
|
+
module ContentBlocks
|
6
|
+
class HighlightedParticipatoryProcessesCell < Decidim::ViewModel
|
7
|
+
include Decidim::CardHelper
|
8
|
+
include Decidim::IconHelper
|
9
|
+
include ActionView::Helpers::FormOptionsHelper
|
10
|
+
include Decidim::FiltersHelper
|
11
|
+
include Decidim::FilterResource
|
12
|
+
|
13
|
+
def participatory_process_group
|
14
|
+
@participatory_process_group ||= Decidim::ParticipatoryProcessGroup.find(model.scoped_resource_id)
|
15
|
+
end
|
16
|
+
|
17
|
+
def decidim_participatory_processes
|
18
|
+
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers
|
19
|
+
end
|
20
|
+
|
21
|
+
def block_id
|
22
|
+
"processes-grid"
|
23
|
+
end
|
24
|
+
|
25
|
+
def filtered_relation
|
26
|
+
@filtered_relation ||= search.results
|
27
|
+
end
|
28
|
+
|
29
|
+
def default_date_filter
|
30
|
+
return "active" if filtered_relation.any?(&:active?)
|
31
|
+
return "upcoming" if filtered_relation.any?(&:upcoming?)
|
32
|
+
return "past" if filtered_relation.any?(&:past?)
|
33
|
+
|
34
|
+
"all"
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def search_klass
|
40
|
+
Decidim::ParticipatoryProcesses::ParticipatoryProcessSearch
|
41
|
+
end
|
42
|
+
|
43
|
+
def default_filter_params
|
44
|
+
{
|
45
|
+
scope_id: nil,
|
46
|
+
area_id: nil
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def default_search_params
|
51
|
+
{
|
52
|
+
base_relation: base_relation
|
53
|
+
}
|
54
|
+
end
|
55
|
+
|
56
|
+
def base_relation
|
57
|
+
@base_relation ||= Decidim::ParticipatoryProcesses::GroupPublishedParticipatoryProcesses.new(
|
58
|
+
participatory_process_group,
|
59
|
+
current_user
|
60
|
+
).query
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcessGroups
|
5
|
+
module ContentBlocks
|
6
|
+
class HtmlCell < Decidim::ContentBlocks::HtmlCell
|
7
|
+
def block_id
|
8
|
+
model.manifest_name.parameterize.gsub("_", "-")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<section class="section" id="participatory_process_group-metadata">
|
2
|
+
<article class="card card__row">
|
3
|
+
<div>
|
4
|
+
<div class="mb-xs"><strong><%= t("decidim.participatory_process_groups.content_blocks.metadata.developer_group") %></strong></div>
|
5
|
+
<div class="text-small">
|
6
|
+
<%= decidim_sanitize translated_attribute(participatory_process_group.developer_group) %>
|
7
|
+
</div>
|
8
|
+
</div>
|
9
|
+
<div>
|
10
|
+
<div class="mb-xs"><strong><%= t("decidim.participatory_process_groups.content_blocks.metadata.target") %></strong></div>
|
11
|
+
<div class="text-small">
|
12
|
+
<%= decidim_sanitize translated_attribute(participatory_process_group.target) %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
<div>
|
16
|
+
<div class="mb-xs"><strong><%= t("decidim.participatory_process_groups.content_blocks.metadata.participatory_scope") %></strong></div>
|
17
|
+
<div class="text-small">
|
18
|
+
<%= decidim_sanitize translated_attribute(participatory_process_group.participatory_scope) %>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
<div>
|
22
|
+
<div class="mb-xs"><strong><%= t("decidim.participatory_process_groups.content_blocks.metadata.participatory_structure") %></strong></div>
|
23
|
+
<div class="text-small">
|
24
|
+
<%= decidim_sanitize translated_attribute(participatory_process_group.participatory_structure) %>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
</article>
|
28
|
+
</section>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcessGroups
|
5
|
+
module ContentBlocks
|
6
|
+
class MetadataCell < Decidim::ViewModel
|
7
|
+
include Decidim::SanitizeHelper
|
8
|
+
|
9
|
+
def participatory_process_group
|
10
|
+
@participatory_process_group ||= Decidim::ParticipatoryProcessGroup.find(model.scoped_resource_id)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<section class="section" id="participatory_process_group-statistics">
|
2
|
+
<h2 class="section-heading">
|
3
|
+
<%= t("decidim.participatory_process_groups.content_blocks.stats.name") %>
|
4
|
+
</h2>
|
5
|
+
|
6
|
+
<div class="space-stats">
|
7
|
+
<% if stats.collection.present? %>
|
8
|
+
<%= cell("decidim/participatory_processes/statistic", collection: stats.collection) %>
|
9
|
+
<% else %>
|
10
|
+
<span class="muted"><%= t("decidim.participatory_processes.statistics.no_stats") %></span>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
13
|
+
</section>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcessGroups
|
5
|
+
module ContentBlocks
|
6
|
+
class StatsCell < Decidim::ViewModel
|
7
|
+
def stats
|
8
|
+
@stats ||= Decidim::ParticipatoryProcesses::ParticipatoryProcessGroupStatsPresenter.new(participatory_process_group: participatory_process_group)
|
9
|
+
end
|
10
|
+
|
11
|
+
def participatory_process_group
|
12
|
+
@participatory_process_group ||= Decidim::ParticipatoryProcessGroup.find(model.scoped_resource_id)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<section class="section">
|
2
|
+
<h2 class="heading2"><%= translated_attribute(participatory_process_group.title) %></h2>
|
3
|
+
<div class="row">
|
4
|
+
<div class="columns medium-9">
|
5
|
+
<%= decidim_sanitize translated_attribute(participatory_process_group.description) %>
|
6
|
+
<div class="row">
|
7
|
+
<div class="column medium-2 text-muted">
|
8
|
+
<%= icon "grid-three-up", role: "img", class: "mr-xs" %>
|
9
|
+
<%= t("decidim.participatory_process_groups.content_blocks.title.participatory_processes", count: participatory_processes_count) %>
|
10
|
+
</div>
|
11
|
+
<% if has_meta_scope? %>
|
12
|
+
<div class="column medium-3 end text-muted">
|
13
|
+
<%= icon "globe", class: "mr-xs" %>
|
14
|
+
<strong><%= t("decidim.participatory_process_groups.content_blocks.title.meta_scope") %></strong>
|
15
|
+
<%= translated_attribute(meta_scope) %>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
<div class="columns medium-3">
|
21
|
+
<% if has_hashtag? %>
|
22
|
+
<div class="mb-s text-muted">
|
23
|
+
<%= icon "twitter", role: "img", aria_label: "Twitter", class: "mr-xs" %>
|
24
|
+
<%= link_to(
|
25
|
+
"##{hashtag_text}",
|
26
|
+
"https://twitter.com/hashtag/#{hashtag_text}",
|
27
|
+
target: "_blank"
|
28
|
+
) %>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
31
|
+
<% if has_group_url? %>
|
32
|
+
<div class="text-muted">
|
33
|
+
<%= icon "external-link", class: "mr-xs" %>
|
34
|
+
<%= link_to(
|
35
|
+
group_url_text,
|
36
|
+
group_url,
|
37
|
+
target: "_blank"
|
38
|
+
) %>
|
39
|
+
</div>
|
40
|
+
<% end %>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
</section>
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcessGroups
|
5
|
+
module ContentBlocks
|
6
|
+
class TitleCell < Decidim::ViewModel
|
7
|
+
include Decidim::SanitizeHelper
|
8
|
+
include Decidim::IconHelper
|
9
|
+
|
10
|
+
delegate :group_url, to: :participatory_process_group
|
11
|
+
|
12
|
+
def participatory_process_group
|
13
|
+
@participatory_process_group ||= Decidim::ParticipatoryProcessGroup.find(model.scoped_resource_id)
|
14
|
+
end
|
15
|
+
|
16
|
+
def hashtag_text
|
17
|
+
@hashtag_text ||= decidim_html_escape(participatory_process_group.hashtag || "")
|
18
|
+
end
|
19
|
+
|
20
|
+
def has_hashtag?
|
21
|
+
hashtag_text.present?
|
22
|
+
end
|
23
|
+
|
24
|
+
def has_group_url?
|
25
|
+
group_url.present?
|
26
|
+
end
|
27
|
+
|
28
|
+
def meta_scope
|
29
|
+
@meta_scope ||= translated_attribute(participatory_process_group.meta_scope)
|
30
|
+
end
|
31
|
+
|
32
|
+
def has_meta_scope?
|
33
|
+
meta_scope.present?
|
34
|
+
end
|
35
|
+
|
36
|
+
def group_url_text
|
37
|
+
group_uri.host + group_uri.path
|
38
|
+
end
|
39
|
+
|
40
|
+
def decidim_participatory_processes
|
41
|
+
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers
|
42
|
+
end
|
43
|
+
|
44
|
+
def participatory_processes_count
|
45
|
+
@participatory_processes_count ||= participatory_process_group.participatory_processes.count
|
46
|
+
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def group_uri
|
51
|
+
@group_uri = URI.parse(group_url)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcessGroups
|
5
|
+
# This cell renders the filter tabs of participatory processes
|
6
|
+
# in a group. It's inherited from ProcessFiltersCell of participatory
|
7
|
+
# processes index but is based in the group processes
|
8
|
+
#
|
9
|
+
# The `model` must be a Decidim::ParticipatoryProcessGroup`
|
10
|
+
#
|
11
|
+
# Available options:
|
12
|
+
#
|
13
|
+
# - `:base_relation` => A relation of participatory processes. If not
|
14
|
+
# provided is based on the model processes using
|
15
|
+
# GroupPublishedParticipatoryProcesses query.
|
16
|
+
# - `default_date_filter` => The date filter to use if not given by
|
17
|
+
# params. If not provided is inferred from the base relation
|
18
|
+
#
|
19
|
+
# Example:
|
20
|
+
#
|
21
|
+
# cell(
|
22
|
+
# "decidim/participatory_process_groups/process_filters",
|
23
|
+
# group,
|
24
|
+
# base_relation: group.participatory_processes.published,
|
25
|
+
# date_filter: "active"
|
26
|
+
# )
|
27
|
+
class ProcessFiltersCell < Decidim::ParticipatoryProcesses::ProcessFiltersCell
|
28
|
+
def filter_link(filter)
|
29
|
+
Decidim::ParticipatoryProcesses::Engine
|
30
|
+
.routes
|
31
|
+
.url_helpers
|
32
|
+
.participatory_process_group_path(
|
33
|
+
model,
|
34
|
+
filter: {
|
35
|
+
scope_id: get_filter(:scope_id),
|
36
|
+
area_id: get_filter(:area_id),
|
37
|
+
date: filter
|
38
|
+
}
|
39
|
+
)
|
40
|
+
end
|
41
|
+
|
42
|
+
def current_filter
|
43
|
+
get_filter(:date, default_date_filter)
|
44
|
+
end
|
45
|
+
|
46
|
+
def base_relation
|
47
|
+
@base_relation ||= options[:base_relation].presence || Decidim::ParticipatoryProcesses::GroupPublishedParticipatoryProcesses.new(
|
48
|
+
model,
|
49
|
+
current_user
|
50
|
+
).query
|
51
|
+
end
|
52
|
+
|
53
|
+
def process_count_by_filter
|
54
|
+
@process_count_by_filter ||= begin
|
55
|
+
counts = ALL_FILTERS.without("all").each_with_object({}) do |filter_name, collection_by_filter|
|
56
|
+
collection_by_filter.update(filter_name => filtered_processes(filter_name).results.count)
|
57
|
+
end
|
58
|
+
counts.update("all" => counts.values.sum)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def filtered_processes(date_filter)
|
63
|
+
Decidim::ParticipatoryProcesses::ParticipatoryProcessSearch.new(
|
64
|
+
base_relation: base_relation,
|
65
|
+
date: date_filter,
|
66
|
+
scope_id: get_filter(:scope_id),
|
67
|
+
area_id: get_filter(:area_id),
|
68
|
+
current_user: current_user,
|
69
|
+
organization: current_organization
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
def default_date_filter
|
74
|
+
@default_date_filter ||= options[:default_filter].presence || process_count_by_filter.find { |_, count| count.positive? }&.first || "all"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/show.erb
CHANGED
@@ -4,22 +4,8 @@
|
|
4
4
|
<div class="row collapse">
|
5
5
|
<div class="row small-up-1 smallmedium-up-2 mediumlarge-up-3
|
6
6
|
large-up-4 card-grid">
|
7
|
-
<%
|
8
|
-
|
9
|
-
<%= link_to decidim_participatory_processes.participatory_process_path(process), class: "card card--process card--mini" do %>
|
10
|
-
<div aria-hidden="true" class="card__image-top"
|
11
|
-
style="background-image:url(<%= process.hero_image.url %>)"></div>
|
12
|
-
<div class="card__content">
|
13
|
-
<span class="card__title card__link"><%= translated_attribute process.title %></span>
|
14
|
-
<% if process.active_step %>
|
15
|
-
<span class="card--process__small">
|
16
|
-
<%= t("active_step", scope: i18n_scope) %>
|
17
|
-
<strong><%= translated_attribute process.active_step.title %></strong>
|
18
|
-
</span>
|
19
|
-
<% end %>
|
20
|
-
</div>
|
21
|
-
<% end %>
|
22
|
-
</div>
|
7
|
+
<% highlighted_items.each do |item| %>
|
8
|
+
<%= card_for item, size: :s %>
|
23
9
|
<% end %>
|
24
10
|
</div>
|
25
11
|
</div>
|
@@ -1,43 +1,47 @@
|
|
1
|
-
<% process =
|
1
|
+
<% process = highlighted_items.first %>
|
2
2
|
<% title_id = "process_title" %>
|
3
3
|
<section class="wrapper-home home-section">
|
4
4
|
<div class="row" id="highlighted-processes">
|
5
5
|
<h3 class="section-heading"><%= t("active_processes", scope: i18n_scope) %></h3>
|
6
6
|
<div class="row collapse">
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
<%=
|
18
|
-
|
7
|
+
<% if process.is_a? Decidim::ParticipatoryProcessGroup %>
|
8
|
+
<%= render partial: "decidim/participatory_processes/participatory_processes/promoted_process_group.html", locals: { promoted_process_group: process } %>
|
9
|
+
<% else %>
|
10
|
+
<div class="card card--full card--process">
|
11
|
+
<div class="row collapse card--process__row">
|
12
|
+
<div class="column large-6 card--process__column">
|
13
|
+
<div class="card__content">
|
14
|
+
<%= link_to decidim_participatory_processes.participatory_process_path(process), class: "card__link" do %>
|
15
|
+
<h2 class="card__title" id="<%= title_id %>"><%= decidim_html_escape(translated_attribute(process.title)) %></h2>
|
16
|
+
<% end %>
|
17
|
+
<%= decidim_sanitize translated_attribute(process.short_description) %>
|
18
|
+
<%= link_to decidim_participatory_processes.participatory_process_path(process), class: "button small hollow" do %>
|
19
|
+
<span class="show-for-sr"><%= decidim_html_escape(translated_attribute(process.title)) %></span>
|
20
|
+
<%= t("more_information", scope: i18n_scope) %>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
19
23
|
</div>
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
24
|
+
<div class="column large-6 card--process__column">
|
25
|
+
<div class="card--full__image" style="background-image:url(<%= process.hero_image.url %>)">
|
26
|
+
<div class="card__content row collapse">
|
27
|
+
<div class="large-6 large-offset-6 columns">
|
28
|
+
<%= link_to decidim_participatory_processes.participatory_process_path(process), class: "button expanded button--sc" do %>
|
29
|
+
<span class="show-for-sr"><%= t("participate_in", resource_name: translated_attribute(process.title), scope: i18n_scope) %></span>
|
30
|
+
<span aria-hidden="true"><%= t("participate", scope: i18n_scope) %></span>
|
31
|
+
<% if process.active_step %>
|
32
|
+
<span class="button__info">
|
33
|
+
<%= t("active_step", scope: i18n_scope) %>
|
34
|
+
<strong><%= translated_attribute process.active_step.title %></strong>
|
35
|
+
</span>
|
36
|
+
<% end %>
|
33
37
|
<% end %>
|
34
|
-
|
38
|
+
</div>
|
35
39
|
</div>
|
36
40
|
</div>
|
37
41
|
</div>
|
38
42
|
</div>
|
39
43
|
</div>
|
40
|
-
|
44
|
+
<% end %>
|
41
45
|
</div>
|
42
46
|
</div>
|
43
47
|
<%= render "_all_processes" %>
|
@@ -4,32 +4,33 @@ module Decidim
|
|
4
4
|
module ParticipatoryProcesses
|
5
5
|
module ContentBlocks
|
6
6
|
class HighlightedProcessesCell < Decidim::ViewModel
|
7
|
+
include Decidim::ApplicationHelper
|
7
8
|
include Decidim::SanitizeHelper
|
9
|
+
include Decidim::CardHelper
|
10
|
+
include Cell::ViewModel::Partial
|
11
|
+
include ParticipatoryProcessHelper
|
12
|
+
include Decidim::ParticipatoryProcesses::Engine.routes.url_helpers
|
8
13
|
|
9
14
|
delegate :current_user, to: :controller
|
10
15
|
|
11
16
|
def show
|
12
|
-
if
|
17
|
+
if single_item?
|
13
18
|
render "single_process"
|
14
|
-
elsif
|
19
|
+
elsif highlighted_items.any?
|
15
20
|
render
|
16
21
|
end
|
17
22
|
end
|
18
23
|
|
19
|
-
def
|
20
|
-
|
24
|
+
def single_item?
|
25
|
+
highlighted_items.length == 1
|
21
26
|
end
|
22
27
|
|
23
28
|
def max_results
|
24
29
|
model.settings.max_results
|
25
30
|
end
|
26
31
|
|
27
|
-
def
|
28
|
-
@
|
29
|
-
OrganizationPublishedParticipatoryProcesses.new(current_organization, current_user) |
|
30
|
-
HighlightedParticipatoryProcesses.new |
|
31
|
-
FilteredParticipatoryProcesses.new("active")
|
32
|
-
).query.includes([:organization]).limit(max_results)
|
32
|
+
def highlighted_items
|
33
|
+
@highlighted_items ||= promoted_groups + highlighted_processes
|
33
34
|
end
|
34
35
|
|
35
36
|
def i18n_scope
|
@@ -39,6 +40,28 @@ module Decidim
|
|
39
40
|
def decidim_participatory_processes
|
40
41
|
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers
|
41
42
|
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
def highlighted_processes
|
47
|
+
@highlighted_processes ||= if highlighted_processes_max_results.zero?
|
48
|
+
[]
|
49
|
+
else
|
50
|
+
(
|
51
|
+
OrganizationPublishedParticipatoryProcesses.new(current_organization, current_user) |
|
52
|
+
HighlightedParticipatoryProcesses.new |
|
53
|
+
FilteredParticipatoryProcesses.new("active")
|
54
|
+
).query.includes([:organization]).limit(highlighted_processes_max_results)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def promoted_groups
|
59
|
+
@promoted_groups ||= (OrganizationParticipatoryProcessGroups.new(current_organization) | PromotedParticipatoryProcessGroups.new).query.limit(max_results)
|
60
|
+
end
|
61
|
+
|
62
|
+
def highlighted_processes_max_results
|
63
|
+
@highlighted_processes_max_results ||= max_results - promoted_groups.count
|
64
|
+
end
|
42
65
|
end
|
43
66
|
end
|
44
67
|
end
|