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
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
# This cell renders a set of filtered participatory processes from a base
|
6
|
+
# relation provided by the model
|
7
|
+
#
|
8
|
+
# The `model` must be a relation of participatory processes
|
9
|
+
#
|
10
|
+
# Available options:
|
11
|
+
#
|
12
|
+
# - `default_date_filter` => The date filter to use if not given by
|
13
|
+
# params. If not provided is inferred from the model relation
|
14
|
+
#
|
15
|
+
# Example:
|
16
|
+
#
|
17
|
+
# cell(
|
18
|
+
# "decidim/participatory_processes/filtered_participatory_processes",
|
19
|
+
# group.participatory_processes.published,
|
20
|
+
# date_filter: "active"
|
21
|
+
# )
|
22
|
+
class FilteredParticipatoryProcessesCell < Decidim::ViewModel
|
23
|
+
include Decidim::FilterResource
|
24
|
+
include Decidim::CardHelper
|
25
|
+
|
26
|
+
def elements
|
27
|
+
@elements ||= search.results
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def search_klass
|
33
|
+
Decidim::ParticipatoryProcesses::ParticipatoryProcessSearch
|
34
|
+
end
|
35
|
+
|
36
|
+
def default_search_params
|
37
|
+
{
|
38
|
+
base_relation: model,
|
39
|
+
date: default_date_filter
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
def default_date_filter
|
44
|
+
@default_date_filter ||= options[:default_filter].presence || if model.any?(&:active?)
|
45
|
+
"active"
|
46
|
+
elsif model.any?(&:upcoming?)
|
47
|
+
"upcoming"
|
48
|
+
elsif model.any?(&:past?)
|
49
|
+
"past"
|
50
|
+
else
|
51
|
+
"all"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -12,7 +12,12 @@ module Decidim
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def card_size
|
15
|
-
|
15
|
+
case @options[:size]
|
16
|
+
when :s
|
17
|
+
"decidim/participatory_processes/process_s"
|
18
|
+
else
|
19
|
+
"decidim/participatory_processes/process_m"
|
20
|
+
end
|
16
21
|
end
|
17
22
|
end
|
18
23
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Decidim
|
4
4
|
module ParticipatoryProcesses
|
5
5
|
class ProcessFiltersCell < Decidim::ViewModel
|
6
|
-
ALL_FILTERS = %w(active past
|
6
|
+
ALL_FILTERS = %w(active upcoming past all).freeze
|
7
7
|
|
8
8
|
def filter_link(filter)
|
9
9
|
Decidim::ParticipatoryProcesses::Engine
|
@@ -12,7 +12,12 @@ module Decidim
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def card_size
|
15
|
-
|
15
|
+
case @options[:size]
|
16
|
+
when :s
|
17
|
+
"decidim/participatory_processes/process_group_s"
|
18
|
+
else
|
19
|
+
"decidim/participatory_processes/process_group_m"
|
20
|
+
end
|
16
21
|
end
|
17
22
|
end
|
18
23
|
end
|
@@ -16,7 +16,7 @@ module Decidim
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def title
|
19
|
-
translated_attribute model.
|
19
|
+
translated_attribute model.title
|
20
20
|
end
|
21
21
|
|
22
22
|
def resource_path
|
@@ -36,10 +36,12 @@ module Decidim
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def processes_count_status
|
39
|
+
# rubocop: disable Style/StringConcatenation
|
39
40
|
content_tag(
|
40
41
|
:strong,
|
41
42
|
t("layouts.decidim.participatory_process_groups.participatory_process_group.processes_count")
|
42
43
|
) + " " + processes_visible_for_user
|
44
|
+
# rubocop: enable Style/StringConcatenation
|
43
45
|
end
|
44
46
|
|
45
47
|
def processes_visible_for_user
|
@@ -0,0 +1 @@
|
|
1
|
+
<div aria-hidden="true" class="card__image-top" style="background-image:url(<%= resource_image_path %>)"></div>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div class="column" id="<%= dom_id(model) %>">
|
2
|
+
<%= link_to resource_path, class: "card card--process card--stack card--mini" do %>
|
3
|
+
<%= render :image if has_image? %>
|
4
|
+
<div class="card__content">
|
5
|
+
<span class="card__title card__link"><%= title %></span>
|
6
|
+
</div>
|
7
|
+
<% end %>
|
8
|
+
</div>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
# This cell renders the Small (:s) process group card
|
6
|
+
# for an given instance of a ParticipatoryProcessGroup
|
7
|
+
class ProcessGroupSCell < Decidim::CardMCell
|
8
|
+
private
|
9
|
+
|
10
|
+
def has_image?
|
11
|
+
model.hero_image.url.present?
|
12
|
+
end
|
13
|
+
|
14
|
+
def resource_path
|
15
|
+
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers.participatory_process_group_path(model)
|
16
|
+
end
|
17
|
+
|
18
|
+
def resource_image_path
|
19
|
+
model.hero_image.url
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<div aria-hidden="true" class="card__image-top" style="background-image:url(<%= resource_image_path %>)"></div>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<div class="column" id="<%= dom_id(model) %>">
|
2
|
+
<%= link_to resource_path, class: "card card--process card--mini" do %>
|
3
|
+
<%= render :image if has_image? %>
|
4
|
+
<div class="card__content">
|
5
|
+
<span class="card__title card__link"><%= title %></span>
|
6
|
+
<% if has_step? %>
|
7
|
+
<span class="card--process__small">
|
8
|
+
<%= t("active_step", scope: i18n_scope) %>
|
9
|
+
<strong><%= step_title %></strong>
|
10
|
+
</span>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
# This cell renders the Small (:s) process card
|
6
|
+
# for an given instance of a ParticipatoryProcess
|
7
|
+
class ProcessSCell < Decidim::CardMCell
|
8
|
+
private
|
9
|
+
|
10
|
+
def has_image?
|
11
|
+
model.hero_image.url.present?
|
12
|
+
end
|
13
|
+
|
14
|
+
def has_step?
|
15
|
+
model.active_step.present?
|
16
|
+
end
|
17
|
+
|
18
|
+
def resource_path
|
19
|
+
Decidim::ParticipatoryProcesses::Engine.routes.url_helpers.participatory_process_path(model)
|
20
|
+
end
|
21
|
+
|
22
|
+
def resource_image_path
|
23
|
+
model.hero_image.url
|
24
|
+
end
|
25
|
+
|
26
|
+
def step_title
|
27
|
+
translated_attribute model.active_step.title
|
28
|
+
end
|
29
|
+
|
30
|
+
def i18n_scope
|
31
|
+
"decidim.participatory_processes.pages.home.highlighted_processes"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -1,9 +1,9 @@
|
|
1
|
-
<div class="
|
2
|
-
<span class="
|
1
|
+
<div class="space-stats__data">
|
2
|
+
<span class="space-stats__number">
|
3
3
|
<%= stat_number %>
|
4
4
|
</span>
|
5
5
|
|
6
|
-
<h4 class="
|
6
|
+
<h4 class="space-stats__title">
|
7
7
|
<%= stat_title %>
|
8
8
|
</h4>
|
9
9
|
</div>
|
data/app/commands/decidim/participatory_processes/admin/create_participatory_process_group.rb
CHANGED
@@ -46,10 +46,19 @@ module Decidim
|
|
46
46
|
) do
|
47
47
|
ParticipatoryProcessGroup.create(
|
48
48
|
organization: form.current_organization,
|
49
|
-
|
49
|
+
title: form.title,
|
50
50
|
description: form.description,
|
51
|
+
hashtag: form.hashtag,
|
52
|
+
group_url: form.group_url,
|
51
53
|
hero_image: form.hero_image, # Keep after organization
|
52
|
-
participatory_processes: participatory_processes
|
54
|
+
participatory_processes: participatory_processes,
|
55
|
+
developer_group: form.developer_group,
|
56
|
+
local_area: form.local_area,
|
57
|
+
meta_scope: form.meta_scope,
|
58
|
+
participatory_scope: form.participatory_scope,
|
59
|
+
participatory_structure: form.participatory_structure,
|
60
|
+
target: form.target,
|
61
|
+
promoted: form.promoted
|
53
62
|
)
|
54
63
|
end
|
55
64
|
end
|
data/app/commands/decidim/participatory_processes/admin/update_participatory_process_group.rb
CHANGED
@@ -51,11 +51,20 @@ module Decidim
|
|
51
51
|
|
52
52
|
def attributes
|
53
53
|
{
|
54
|
-
|
54
|
+
title: form.title,
|
55
55
|
hero_image: form.hero_image,
|
56
56
|
remove_hero_image: form.remove_hero_image,
|
57
57
|
description: form.description,
|
58
|
-
|
58
|
+
hashtag: form.hashtag,
|
59
|
+
group_url: form.group_url,
|
60
|
+
participatory_processes: participatory_processes,
|
61
|
+
developer_group: form.developer_group,
|
62
|
+
local_area: form.local_area,
|
63
|
+
meta_scope: form.meta_scope,
|
64
|
+
participatory_scope: form.participatory_scope,
|
65
|
+
participatory_structure: form.participatory_structure,
|
66
|
+
target: form.target,
|
67
|
+
promoted: form.promoted
|
59
68
|
}
|
60
69
|
end
|
61
70
|
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
module Admin
|
6
|
+
# This controller allows importing things.
|
7
|
+
# It is targeted for customizations for importing things that lives under
|
8
|
+
# a participatory process.
|
9
|
+
class ImportsController < Decidim::Admin::ImportsController
|
10
|
+
include Concerns::ParticipatoryProcessAdmin
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
module Admin
|
6
|
+
module Moderations
|
7
|
+
# This controller allows admins to manage moderation reports in a participatory process.
|
8
|
+
class ReportsController < Decidim::Admin::Moderations::ReportsController
|
9
|
+
include Concerns::ParticipatoryProcessAdmin
|
10
|
+
|
11
|
+
def permissions_context
|
12
|
+
super.merge(current_participatory_space: current_participatory_space)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
module Admin
|
6
|
+
# Controller that allows to manage the content from the participatory process landing page content blocks
|
7
|
+
class ParticipatoryProcessGroupLandingPageContentBlocksController < Decidim::ParticipatoryProcesses::Admin::ApplicationController
|
8
|
+
include Decidim::Admin::LandingPageContentBlocks
|
9
|
+
|
10
|
+
layout "decidim/admin/participatory_process_group"
|
11
|
+
|
12
|
+
helper_method :participatory_process_group
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def content_block_scope
|
17
|
+
:participatory_process_group_homepage
|
18
|
+
end
|
19
|
+
|
20
|
+
def scoped_resource
|
21
|
+
@scoped_resource ||= collection.find(params[:participatory_process_group_id])
|
22
|
+
end
|
23
|
+
|
24
|
+
def enforce_permission_to_update_resource
|
25
|
+
enforce_permission_to :update, :process_group, process_group: scoped_resource
|
26
|
+
end
|
27
|
+
|
28
|
+
def edit_resource_landing_page_path
|
29
|
+
edit_participatory_process_group_landing_page_path(scoped_resource)
|
30
|
+
end
|
31
|
+
|
32
|
+
def resource_landing_page_content_block_path
|
33
|
+
participatory_process_group_landing_page_content_block_path(scoped_resource, params[:id])
|
34
|
+
end
|
35
|
+
|
36
|
+
def submit_button_text
|
37
|
+
t("participatory_process_group_landing_page_content_blocks.edit.update", scope: "decidim.admin")
|
38
|
+
end
|
39
|
+
|
40
|
+
alias participatory_process_group scoped_resource
|
41
|
+
|
42
|
+
def collection
|
43
|
+
@collection ||= OrganizationParticipatoryProcessGroups.new(current_user.organization).query
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
module Admin
|
6
|
+
# Controller that allows managing the participatory process group landing
|
7
|
+
# page
|
8
|
+
class ParticipatoryProcessGroupLandingPageController < Decidim::ParticipatoryProcesses::Admin::ApplicationController
|
9
|
+
include Decidim::Admin::LandingPage
|
10
|
+
|
11
|
+
layout "decidim/admin/participatory_process_group"
|
12
|
+
|
13
|
+
helper_method :participatory_process_group
|
14
|
+
|
15
|
+
def content_block_scope
|
16
|
+
:participatory_process_group_homepage
|
17
|
+
end
|
18
|
+
|
19
|
+
def scoped_resource
|
20
|
+
@scoped_resource ||= collection.find(params[:participatory_process_group_id])
|
21
|
+
end
|
22
|
+
|
23
|
+
def enforce_permission_to_update_resource
|
24
|
+
enforce_permission_to :update, :process_group, process_group: scoped_resource
|
25
|
+
end
|
26
|
+
|
27
|
+
def resource_sort_url
|
28
|
+
participatory_process_group_landing_page_path(scoped_resource)
|
29
|
+
end
|
30
|
+
|
31
|
+
def active_content_blocks_title
|
32
|
+
t("participatory_process_group_landing_page.edit.active_content_blocks", scope: "decidim.admin")
|
33
|
+
end
|
34
|
+
|
35
|
+
def inactive_content_blocks_title
|
36
|
+
t("participatory_process_group_landing_page.edit.inactive_content_blocks", scope: "decidim.admin")
|
37
|
+
end
|
38
|
+
|
39
|
+
def resource_content_block_cell
|
40
|
+
"decidim/participatory_process_groups/content_block"
|
41
|
+
end
|
42
|
+
|
43
|
+
alias participatory_process_group scoped_resource
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def collection
|
48
|
+
@collection ||= OrganizationParticipatoryProcessGroups.new(current_user.organization).query
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -16,6 +16,7 @@ module Decidim
|
|
16
16
|
|
17
17
|
def show
|
18
18
|
enforce_permission_to :read, :process_group, process_group: participatory_process_group
|
19
|
+
render layout: "decidim/admin/participatory_process_group"
|
19
20
|
end
|
20
21
|
|
21
22
|
def new
|
@@ -44,6 +45,7 @@ module Decidim
|
|
44
45
|
@participatory_process_group = collection.find(params[:id])
|
45
46
|
enforce_permission_to :update, :process_group, process_group: @participatory_process_group
|
46
47
|
@form = form(ParticipatoryProcessGroupForm).from_model(@participatory_process_group)
|
48
|
+
render layout: "decidim/admin/participatory_process_group"
|
47
49
|
end
|
48
50
|
|
49
51
|
def update
|
@@ -59,7 +61,7 @@ module Decidim
|
|
59
61
|
|
60
62
|
on(:invalid) do
|
61
63
|
flash.now[:alert] = I18n.t("participatory_process_groups.update.error", scope: "decidim.admin")
|
62
|
-
render :edit
|
64
|
+
render :edit, layout: "decidim/admin/participatory_process_group"
|
63
65
|
end
|
64
66
|
end
|
65
67
|
end
|
data/app/controllers/decidim/participatory_processes/participatory_process_groups_controller.rb
CHANGED
@@ -4,7 +4,7 @@ module Decidim
|
|
4
4
|
module ParticipatoryProcesses
|
5
5
|
class ParticipatoryProcessGroupsController < Decidim::ParticipatoryProcesses::ApplicationController
|
6
6
|
helper Decidim::SanitizeHelper
|
7
|
-
helper_method :participatory_processes, :group
|
7
|
+
helper_method :participatory_processes, :group
|
8
8
|
|
9
9
|
before_action :set_group
|
10
10
|
|
@@ -27,7 +27,6 @@ module Decidim
|
|
27
27
|
group.participatory_processes.published.public_spaces
|
28
28
|
end
|
29
29
|
end
|
30
|
-
alias collection participatory_processes
|
31
30
|
|
32
31
|
def set_group
|
33
32
|
@group = Decidim::ParticipatoryProcessGroup.find(params[:id])
|
@@ -10,10 +10,11 @@ module Decidim
|
|
10
10
|
include FilterResource
|
11
11
|
|
12
12
|
helper_method :collection,
|
13
|
-
:
|
13
|
+
:promoted_collection,
|
14
14
|
:participatory_processes,
|
15
15
|
:stats,
|
16
16
|
:metrics,
|
17
|
+
:participatory_process_group,
|
17
18
|
:default_date_filter,
|
18
19
|
:related_processes,
|
19
20
|
:linked_assemblies
|
@@ -71,6 +72,14 @@ module Decidim
|
|
71
72
|
@promoted_participatory_processes ||= published_processes | PromotedParticipatoryProcesses.new
|
72
73
|
end
|
73
74
|
|
75
|
+
def promoted_participatory_process_groups
|
76
|
+
@promoted_participatory_process_groups ||= PromotedParticipatoryProcessGroups.new
|
77
|
+
end
|
78
|
+
|
79
|
+
def promoted_collection
|
80
|
+
@promoted_collection ||= promoted_participatory_processes.query + promoted_participatory_process_groups.query
|
81
|
+
end
|
82
|
+
|
74
83
|
def collection
|
75
84
|
@collection ||= participatory_processes + participatory_process_groups
|
76
85
|
end
|
@@ -96,6 +105,10 @@ module Decidim
|
|
96
105
|
@metrics ||= ParticipatoryProcessMetricChartsPresenter.new(participatory_process: current_participatory_space)
|
97
106
|
end
|
98
107
|
|
108
|
+
def participatory_process_group
|
109
|
+
@participatory_process_group ||= current_participatory_space.participatory_process_group
|
110
|
+
end
|
111
|
+
|
99
112
|
def default_date_filter
|
100
113
|
return "active" if published_processes.any?(&:active?)
|
101
114
|
return "upcoming" if published_processes.any?(&:upcoming?)
|
@@ -10,20 +10,52 @@ module Decidim
|
|
10
10
|
include TranslatableAttributes
|
11
11
|
include Decidim::HasUploadValidations
|
12
12
|
|
13
|
-
translatable_attribute :name, String
|
14
13
|
translatable_attribute :description, String
|
14
|
+
translatable_attribute :developer_group, String
|
15
|
+
translatable_attribute :local_area, String
|
16
|
+
translatable_attribute :meta_scope, String
|
17
|
+
translatable_attribute :title, String
|
18
|
+
translatable_attribute :participatory_scope, String
|
19
|
+
translatable_attribute :participatory_structure, String
|
20
|
+
translatable_attribute :target, String
|
21
|
+
|
22
|
+
attribute :group_url, String
|
23
|
+
attribute :hashtag, String
|
15
24
|
attribute :participatory_process_ids, Array[Integer]
|
16
25
|
|
26
|
+
attribute :promoted, Boolean
|
27
|
+
|
17
28
|
mimic :participatory_process_group
|
18
29
|
|
19
30
|
attribute :hero_image
|
20
31
|
attribute :remove_hero_image
|
21
32
|
|
22
|
-
validates :
|
33
|
+
validates :title, :description, translatable_presence: true
|
23
34
|
|
24
35
|
validates :hero_image, passthru: { to: Decidim::ParticipatoryProcessGroup }
|
25
36
|
|
37
|
+
validate :group_url_format
|
38
|
+
|
26
39
|
alias organization current_organization
|
40
|
+
|
41
|
+
def group_url
|
42
|
+
return if super.blank?
|
43
|
+
|
44
|
+
return "http://#{super.strip}" unless super.match?(%r{\A(http|https)://}i)
|
45
|
+
|
46
|
+
super.strip
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def group_url_format
|
52
|
+
return if group_url.blank?
|
53
|
+
|
54
|
+
uri = URI.parse(group_url)
|
55
|
+
errors.add :group_url, :invalid if !uri.is_a?(URI::HTTP) || uri.host.nil?
|
56
|
+
rescue URI::InvalidURIError
|
57
|
+
errors.add :group_url, :invalid
|
58
|
+
end
|
27
59
|
end
|
28
60
|
end
|
29
61
|
end
|
@@ -20,7 +20,7 @@ module Decidim
|
|
20
20
|
attribute :cta_path, String
|
21
21
|
|
22
22
|
validates :title, translatable_presence: true
|
23
|
-
validates :cta_path, format: { with: %r{\A[a-zA-Z]+[a-zA-Z0-9
|
23
|
+
validates :cta_path, format: { with: %r{\A[a-zA-Z]+[a-zA-Z0-9\-_/]+\z} }, allow_blank: true
|
24
24
|
|
25
25
|
validates :start_date, date: { before: :end_date, allow_blank: true, if: proc { |obj| obj.end_date.present? } }
|
26
26
|
validates :end_date, date: { after: :start_date, allow_blank: true, if: proc { |obj| obj.start_date.present? } }
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module ParticipatoryProcesses
|
5
|
+
module Admin
|
6
|
+
module ParticipatoryProcessesMenuHelper
|
7
|
+
include Decidim::Admin::SidebarMenuHelper
|
8
|
+
|
9
|
+
def participatory_process_menu
|
10
|
+
@participatory_process_menu ||= sidebar_menu(:admin_participatory_process_menu)
|
11
|
+
end
|
12
|
+
|
13
|
+
def participatory_process_group_menu
|
14
|
+
@participatory_process_group_menu ||= sidebar_menu(:admin_participatory_process_group_menu)
|
15
|
+
end
|
16
|
+
|
17
|
+
def participatory_processes_menu
|
18
|
+
@participatory_processes_menu ||= sidebar_menu(:admin_participatory_processes_menu)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -14,7 +14,7 @@ module Decidim
|
|
14
14
|
def process_groups_for_select
|
15
15
|
@process_groups_for_select ||=
|
16
16
|
OrganizationParticipatoryProcessGroups.new(current_organization).map do |group|
|
17
|
-
[translated_attribute(group.
|
17
|
+
[translated_attribute(group.title), group.id]
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -6,18 +6,6 @@ module Decidim
|
|
6
6
|
#
|
7
7
|
module ApplicationHelper
|
8
8
|
include Decidim::ResourceHelper
|
9
|
-
|
10
|
-
# Public: Renders all hooks registered as `hook_name`.
|
11
|
-
#
|
12
|
-
# Note: We're passing a deep copy of the view context to allow
|
13
|
-
# us to extend it without polluting the original view context
|
14
|
-
#
|
15
|
-
# @param hook_name [Symbol] representing the name of the hook.
|
16
|
-
#
|
17
|
-
# @return [String] an HTML safe String
|
18
|
-
def render_participatory_processes_hook(hook_name)
|
19
|
-
Decidim::ParticipatoryProcesses.view_hooks.render(hook_name, deep_dup)
|
20
|
-
end
|
21
9
|
end
|
22
10
|
end
|
23
11
|
end
|