decidim-participatory_processes 0.23.3 → 0.24.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/participatory_process_groups/content_block_cell.rb +17 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/filters.erb +22 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/filters_small_view.erb +18 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/participatory_space_filters.erb +6 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/show.erb +7 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes/title_filter_order.erb +8 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/highlighted_participatory_processes_cell.rb +65 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/html/show.erb +3 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/html_cell.rb +13 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/metadata/show.erb +28 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/metadata_cell.rb +15 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/stats/show.erb +13 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/stats_cell.rb +17 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/title/show.erb +43 -0
- data/app/cells/decidim/participatory_process_groups/content_blocks/title_cell.rb +56 -0
- data/app/cells/decidim/participatory_process_groups/process_filters_cell.rb +78 -0
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/show.erb +2 -16
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes/single_process.erb +32 -28
- data/app/cells/decidim/participatory_processes/content_blocks/highlighted_processes_cell.rb +33 -10
- data/app/cells/decidim/participatory_processes/filtered_participatory_processes/show.erb +3 -0
- data/app/cells/decidim/participatory_processes/filtered_participatory_processes_cell.rb +56 -0
- data/app/cells/decidim/participatory_processes/process_cell.rb +6 -1
- data/app/cells/decidim/participatory_processes/process_filters_cell.rb +1 -1
- data/app/cells/decidim/participatory_processes/process_group_cell.rb +6 -1
- data/app/cells/decidim/participatory_processes/process_group_m_cell.rb +3 -1
- data/app/cells/decidim/participatory_processes/process_group_s/image.erb +1 -0
- data/app/cells/decidim/participatory_processes/process_group_s/show.erb +8 -0
- data/app/cells/decidim/participatory_processes/process_group_s_cell.rb +23 -0
- data/app/cells/decidim/participatory_processes/process_s/image.erb +1 -0
- data/app/cells/decidim/participatory_processes/process_s/show.erb +14 -0
- data/app/cells/decidim/participatory_processes/process_s_cell.rb +35 -0
- data/app/cells/decidim/participatory_processes/statistic/show.erb +3 -3
- data/app/cells/decidim/participatory_processes/statistics/show.erb +1 -1
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process.rb +1 -0
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process_admin.rb +7 -75
- data/app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb +11 -2
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process.rb +1 -0
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process_group.rb +11 -2
- data/app/commands/decidim/participatory_processes/admin/update_participatory_process_step.rb +1 -0
- data/app/controllers/decidim/participatory_processes/admin/imports_controller.rb +14 -0
- data/app/controllers/decidim/participatory_processes/admin/moderations/reports_controller.rb +18 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_group_landing_page_content_blocks_controller.rb +48 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_group_landing_page_controller.rb +53 -0
- data/app/controllers/decidim/participatory_processes/admin/participatory_process_groups_controller.rb +3 -1
- data/app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb +1 -2
- data/app/controllers/decidim/participatory_processes/participatory_processes_controller.rb +14 -1
- data/app/events/decidim/participatory_process_role_assigned_event.rb +1 -1
- data/app/forms/decidim/participatory_processes/admin/participatory_process_form.rb +3 -0
- data/app/forms/decidim/participatory_processes/admin/participatory_process_group_form.rb +34 -2
- data/app/forms/decidim/participatory_processes/admin/participatory_process_step_form.rb +1 -1
- data/app/helpers/decidim/participatory_processes/admin/participatory_processes_menu_helper.rb +23 -0
- data/app/helpers/decidim/participatory_processes/admin/process_groups_for_select_helper.rb +1 -1
- data/app/helpers/decidim/participatory_processes/application_helper.rb +0 -12
- data/app/helpers/decidim/participatory_processes/participatory_process_helper.rb +35 -0
- data/app/models/decidim/participatory_process.rb +2 -2
- data/app/models/decidim/participatory_process_group.rb +9 -1
- data/app/presenters/decidim/participatory_processes/admin_log/participatory_process_group_presenter.rb +10 -2
- data/app/presenters/decidim/participatory_processes/participatory_process_group_stats_presenter.rb +67 -0
- data/app/presenters/decidim/participatory_processes/participatory_process_presenter.rb +4 -3
- data/app/presenters/decidim/participatory_processes/participatory_process_stats_presenter.rb +3 -3
- data/app/queries/decidim/participatory_processes/group_participatory_processes.rb +16 -0
- data/app/queries/decidim/participatory_processes/group_published_participatory_processes.rb +21 -0
- data/app/queries/decidim/participatory_processes/organization_participatory_processes.rb +1 -1
- data/app/queries/decidim/participatory_processes/organization_published_participatory_processes.rb +1 -1
- data/app/queries/decidim/participatory_processes/promoted_participatory_process_groups.rb +12 -0
- data/app/queries/decidim/participatory_processes/stats_followers_count.rb +18 -4
- data/app/queries/decidim/participatory_processes/stats_participants_count.rb +18 -4
- data/app/queries/decidim/participatory_processes/visible_participatory_process_groups.rb +6 -2
- data/app/serializers/decidim/participatory_processes/participatory_process_importer.rb +1 -1
- data/app/serializers/decidim/participatory_processes/participatory_process_serializer.rb +1 -1
- data/app/services/decidim/participatory_processes/participatory_process_search.rb +2 -1
- data/app/views/decidim/participatory_processes/admin/participatory_process_copies/new.html.erb +2 -0
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/_form.html.erb +68 -13
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/edit.html.erb +7 -14
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/index.html.erb +12 -3
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/new.html.erb +2 -8
- data/app/views/decidim/participatory_processes/admin/participatory_process_groups/show.html.erb +10 -2
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/edit.html.erb +1 -0
- data/app/views/decidim/participatory_processes/admin/participatory_process_steps/index.html.erb +6 -0
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/edit.html.erb +2 -0
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/index.html.erb +8 -0
- data/app/views/decidim/participatory_processes/admin/participatory_process_user_roles/new.html.erb +2 -0
- data/app/views/decidim/participatory_processes/admin/participatory_processes/_form.html.erb +4 -0
- data/app/views/decidim/participatory_processes/admin/participatory_processes/index.html.erb +14 -3
- data/app/views/decidim/participatory_processes/admin/participatory_processes/new.html.erb +2 -0
- data/app/views/decidim/participatory_processes/admin/shared/_secondary_nav.html.erb +2 -16
- data/app/views/decidim/participatory_processes/participatory_process_groups/show.html.erb +18 -8
- data/app/views/decidim/participatory_processes/participatory_process_groups/show.js.erb +12 -0
- data/app/views/decidim/participatory_processes/participatory_processes/_participatory_process_group.html.erb +4 -0
- data/app/views/decidim/participatory_processes/participatory_processes/_promoted_process_group.html.erb +31 -0
- data/app/views/decidim/participatory_processes/participatory_processes/index.html.erb +4 -2
- data/app/views/decidim/participatory_processes/participatory_processes/show.html.erb +4 -4
- data/app/views/layouts/decidim/admin/participatory_process.html.erb +8 -1
- data/app/views/layouts/decidim/admin/participatory_process_group.html.erb +17 -0
- data/config/locales/ar.yml +3 -10
- data/config/locales/ca.yml +52 -5
- data/config/locales/cs.yml +56 -9
- data/config/locales/de.yml +52 -5
- data/config/locales/el.yml +3 -6
- data/config/locales/en.yml +52 -5
- data/config/locales/es-MX.yml +52 -5
- data/config/locales/es-PY.yml +52 -5
- data/config/locales/es.yml +52 -5
- data/config/locales/eu.yml +3 -6
- data/config/locales/fi-plain.yml +53 -6
- data/config/locales/fi.yml +53 -6
- data/config/locales/fr-CA.yml +52 -5
- data/config/locales/fr.yml +52 -5
- data/config/locales/gl.yml +84 -5
- data/config/locales/hu.yml +3 -6
- data/config/locales/id-ID.yml +3 -5
- data/config/locales/is-IS.yml +3 -3
- data/config/locales/it.yml +8 -6
- data/config/locales/ja.yml +3 -5
- data/config/locales/lv.yml +3 -7
- data/config/locales/nl.yml +50 -6
- data/config/locales/no.yml +3 -6
- data/config/locales/pl.yml +63 -13
- data/config/locales/pt-BR.yml +3 -6
- data/config/locales/pt.yml +3 -6
- data/config/locales/ro-RO.yml +74 -25
- data/config/locales/ru.yml +4 -9
- data/config/locales/sk.yml +3 -8
- data/config/locales/sr-CS.yml +4 -0
- data/config/locales/sv.yml +33 -5
- data/config/locales/tr-TR.yml +51 -5
- data/config/locales/uk.yml +4 -9
- data/config/locales/zh-CN.yml +3 -5
- data/db/migrate/20170220110740_remove_steps_short_description.rb +1 -1
- data/db/migrate/20201007215105_add_hashtag_to_participatory_process_groups.rb +7 -0
- data/db/migrate/20201008154315_add_metadata_columns_to_participatory_process_groups.rb +13 -0
- data/db/migrate/20201013105520_rename_name_column_to_title_in_decidim_participatory_process_groups.rb +39 -0
- data/db/migrate/20201030133444_add_promoted_flag_to_decidim_participatory_process_groups.rb +7 -0
- data/db/migrate/20210204154593_add_weight_field_to_participatory_processes.rb +7 -0
- data/db/migrate/20210310120750_add_followable_counter_cache_to_participatory_processes.rb +16 -0
- data/lib/decidim/api/participatory_process_group_type.rb +17 -0
- data/{app/types/decidim/participatory_processes → lib/decidim/api}/participatory_process_input_filter.rb +0 -0
- data/{app/types/decidim/participatory_processes → lib/decidim/api}/participatory_process_input_sort.rb +2 -2
- data/lib/decidim/api/participatory_process_step_type.rb +23 -0
- data/lib/decidim/api/participatory_process_type.rb +50 -0
- data/lib/decidim/participatory_processes.rb +2 -6
- data/lib/decidim/participatory_processes/admin_engine.rb +49 -1
- data/lib/decidim/participatory_processes/api.rb +11 -0
- data/lib/decidim/participatory_processes/engine.rb +90 -8
- data/lib/decidim/participatory_processes/participatory_space.rb +47 -24
- data/lib/decidim/participatory_processes/query_extensions.rb +18 -20
- data/lib/decidim/participatory_processes/test/factories.rb +15 -2
- data/lib/decidim/participatory_processes/version.rb +1 -1
- metadata +59 -17
- data/app/functions/decidim/participatory_processes/participatory_process_finder.rb +0 -10
- data/app/functions/decidim/participatory_processes/participatory_process_list.rb +0 -11
- data/app/types/decidim/participatory_processes/participatory_process_group_type.rb +0 -20
- data/app/types/decidim/participatory_processes/participatory_process_step_type.rb +0 -28
- data/app/types/decidim/participatory_processes/participatory_process_type.rb +0 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5cc840bc8f8e0626b1f85c64f3c7def8c19be168118fee8cb8fa43617ac0f892
|
4
|
+
data.tar.gz: d9cb7577da65efae1adc6e1d6eed862163f607dc5a0277e6632360d53d1cb7c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71bcb29769ba2496d4b1d1060d64b1feebc18c41385cd7fd30e70291b187d6e3bdfa7caf1a534f613928bb24f269b181b300290e9d237cadc48ddddf8895e465
|
7
|
+
data.tar.gz: a7da2535a902559761461356362e0a123b03e9f78eae73411035b02d96b6578c57fbd96932cb7bc895758c14aa124ce55e5eba5d5313edd2cd9f9a3917e0a88d
|
@@ -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
|