decidim-challenges 0.5.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/commands/decidim/challenges/survey_challenge.rb +1 -1
- data/app/controllers/decidim/solutions/admin/solutions_controller.rb +5 -0
- data/app/forms/decidim/solutions/solutions_form.rb +1 -1
- data/app/models/decidim/challenges/challenge.rb +1 -1
- data/app/models/decidim/problems/problem.rb +1 -1
- data/app/serializers/decidim/solutions/solution_serializer.rb +75 -0
- data/app/views/decidim/challenges/admin/challenges/edit.html.erb +1 -1
- data/app/views/decidim/problems/admin/problems/edit.html.erb +1 -1
- data/app/views/decidim/problems/problems/_sidebar_data.html.erb +2 -2
- data/app/views/decidim/problems/problems/show.html.erb +0 -1
- data/app/views/decidim/sdgs/sdgs/index.html.erb +2 -2
- data/app/views/decidim/sdgs/sdgs_filter/_modal.html.erb +1 -4
- data/app/views/decidim/solutions/admin/solutions/_form.html.erb +1 -1
- data/app/views/decidim/solutions/admin/solutions/edit.html.erb +1 -1
- data/app/views/decidim/solutions/admin/solutions/index.html.erb +1 -0
- data/app/views/decidim/solutions/admin/solutions/show.html.erb +1 -2
- data/app/views/decidim/solutions/solutions/_sidebar_data.html.erb +2 -2
- data/app/views/decidim/solutions/solutions/show.html.erb +1 -1
- data/config/locales/ca.yml +11 -0
- data/config/locales/en.yml +11 -0
- data/config/locales/es.yml +11 -0
- data/lib/decidim/challenges/version.rb +2 -2
- data/lib/decidim/solutions/component.rb +10 -0
- metadata +7 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 46bea652eb21f13814310b3f2010678bf606a89eb0b6f643d52b7618ada9b22f
|
4
|
+
data.tar.gz: 0b54f8699e24dbdb5960300a36fad5d42e0c5a52dfa67d4302a4fc2395a58623
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5aeda521250172c335e590e38a3375ce529c2553db76348dd291829fd42ef8cd6dd5d5d19a67a7b15c20906c6e50315e652a9ab12e4b5e86ab45df30abb21a7
|
7
|
+
data.tar.gz: 62661ef946f28d42006ebb6d1a29f296955bbed4672aaf07295bf0b92e9b0dd6ebd1200e9dc26721eb27cae04819f0a5a1055b2dcace77ff0be28877f4dd7b56
|
@@ -41,7 +41,7 @@ module Decidim
|
|
41
41
|
def answer_questionnaire
|
42
42
|
return unless questionnaire?
|
43
43
|
|
44
|
-
Decidim::Forms::AnswerQuestionnaire.call(survey_form,
|
44
|
+
Decidim::Forms::AnswerQuestionnaire.call(survey_form, challenge.questionnaire) do
|
45
45
|
on(:invalid) do
|
46
46
|
raise ActiveRecord::Rollback
|
47
47
|
end
|
@@ -7,6 +7,7 @@ module Decidim
|
|
7
7
|
#
|
8
8
|
class SolutionsController < Decidim::Solutions::Admin::ApplicationController
|
9
9
|
include Decidim::ApplicationHelper
|
10
|
+
include Decidim::Admin::Filterable
|
10
11
|
|
11
12
|
helper Challenges::ApplicationHelper
|
12
13
|
helper Decidim::PaginateHelper
|
@@ -100,6 +101,10 @@ module Decidim
|
|
100
101
|
def form_presenter
|
101
102
|
@form_presenter ||= present(@form, presenter_class: Decidim::Solutions::SolutionPresenter)
|
102
103
|
end
|
104
|
+
|
105
|
+
def base_query
|
106
|
+
collection.order(created_at: :desc)
|
107
|
+
end
|
103
108
|
end
|
104
109
|
end
|
105
110
|
end
|
@@ -32,7 +32,7 @@ module Decidim
|
|
32
32
|
self.description = translated_attribute(model.description)
|
33
33
|
|
34
34
|
self.documents = model.attachments
|
35
|
-
|
35
|
+
nil unless model.categorization
|
36
36
|
end
|
37
37
|
|
38
38
|
# Finds the Challenge from the given decidim_challenges_challenge_id
|
@@ -25,7 +25,7 @@ module Decidim
|
|
25
25
|
has_many :surveys, class_name: "Decidim::Challenges::Survey", foreign_key: "decidim_challenge_id", dependent: :destroy
|
26
26
|
|
27
27
|
VALID_STATES = [:proposal, :execution, :finished].freeze
|
28
|
-
enum state
|
28
|
+
enum :state, VALID_STATES
|
29
29
|
|
30
30
|
has_many :problems,
|
31
31
|
class_name: "Decidim::Problems::Problem",
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Solutions
|
5
|
+
class SolutionSerializer < Decidim::Exporters::Serializer
|
6
|
+
include Decidim::ApplicationHelper
|
7
|
+
include Decidim::ResourceHelper
|
8
|
+
include Decidim::TranslationsHelper
|
9
|
+
include HtmlToPlainText
|
10
|
+
include ActionView::Helpers::SanitizeHelper
|
11
|
+
|
12
|
+
def serialize
|
13
|
+
{
|
14
|
+
title_label => localized(resource.title),
|
15
|
+
description_label => sanitized_description,
|
16
|
+
status_label => resource&.project_status,
|
17
|
+
challenge_label => translated_challenge_title,
|
18
|
+
url_label => resource&.project_url,
|
19
|
+
created_at_label => resource.created_at,
|
20
|
+
published_at_label => resource&.published_at,
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def localized(value)
|
27
|
+
if value.is_a?(Hash)
|
28
|
+
value[I18n.locale.to_s] || ""
|
29
|
+
else
|
30
|
+
value.to_s
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def sanitize(text)
|
35
|
+
ActionController::Base.helpers.strip_tags(text)
|
36
|
+
end
|
37
|
+
|
38
|
+
def title_label
|
39
|
+
I18n.t("export.title", scope: "decidim.solutions.admin.exports").to_s
|
40
|
+
end
|
41
|
+
|
42
|
+
def description_label
|
43
|
+
I18n.t("export.description", scope: "decidim.solutions.admin.exports").to_s
|
44
|
+
end
|
45
|
+
|
46
|
+
def status_label
|
47
|
+
I18n.t("export.status", scope: "decidim.solutions.admin.exports").to_s
|
48
|
+
end
|
49
|
+
|
50
|
+
def challenge_label
|
51
|
+
I18n.t("export.challenge", scope: "decidim.solutions.admin.exports").to_s
|
52
|
+
end
|
53
|
+
|
54
|
+
def url_label
|
55
|
+
I18n.t("export.url", scope: "decidim.solutions.admin.exports").to_s
|
56
|
+
end
|
57
|
+
|
58
|
+
def created_at_label
|
59
|
+
I18n.t("export.created_at", scope: "decidim.solutions.admin.exports").to_s
|
60
|
+
end
|
61
|
+
|
62
|
+
def published_at_label
|
63
|
+
I18n.t("export.published_at", scope: "decidim.solutions.admin.exports").to_s
|
64
|
+
end
|
65
|
+
|
66
|
+
def translated_challenge_title
|
67
|
+
resource&.challenge&.title.present? ? resource&.challenge&.title&.[](I18n.locale.to_s) : ""
|
68
|
+
end
|
69
|
+
|
70
|
+
def sanitized_description
|
71
|
+
sanitize(localized(resource.description))
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<div class="item__edit-sticky">
|
12
12
|
<div class="item__edit-sticky-container">
|
13
13
|
<%= f.submit t(".update"), class: "button button__sm button__secondary" %>
|
14
|
-
|
14
|
+
|
15
15
|
<% if challenge.published? %>
|
16
16
|
<%= link_to t("actions.unpublish", scope: "decidim.challenges.admin"), challenge_publish_path(challenge), method: :delete, class: "button button__sm button__secondary" %>
|
17
17
|
<% else %>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<div class="item__edit-sticky">
|
12
12
|
<div class="item__edit-sticky-container">
|
13
13
|
<%= f.submit t(".update"), class: "button button__sm button__secondary" %>
|
14
|
-
|
14
|
+
|
15
15
|
<% if problem.published? %>
|
16
16
|
<%= link_to t("actions.unpublish", scope: "decidim.problems.admin"), problem_publish_path(problem), method: :delete, class: "button button__sm button__secondary" %>
|
17
17
|
<% else %>
|
@@ -36,14 +36,14 @@
|
|
36
36
|
<% if @problem.decidim_sectorial_scope_id.present? %>
|
37
37
|
<div class="text-sm flex flex-col items-center gap-1">
|
38
38
|
<p class="uppercase text-xs"><%= t("decidim_sectorial_scope_id", scope: "activemodel.attributes.problem") %></p>
|
39
|
-
<p class="uppercase mb-4"><%= translated_attribute current_organization.scopes.find_by(id: @problem.decidim_sectorial_scope_id).name
|
39
|
+
<p class="uppercase mb-4"><%= translated_attribute current_organization.scopes.find_by(id: @problem.decidim_sectorial_scope_id).name %></p>
|
40
40
|
</div>
|
41
41
|
<% end %>
|
42
42
|
|
43
43
|
<% if @problem.decidim_technological_scope_id.present? %>
|
44
44
|
<div class="text-sm flex flex-col items-center gap-1">
|
45
45
|
<p class="uppercase text-xs"><%= t("decidim_sectorial_scope_id", scope: "activemodel.attributes.problem") %></p>
|
46
|
-
<p class="uppercase mb-4"><%= translated_attribute current_organization.scopes.find_by(id: @problem.decidim_technological_scope_id).name
|
46
|
+
<p class="uppercase mb-4"><%= translated_attribute current_organization.scopes.find_by(id: @problem.decidim_technological_scope_id).name %></p>
|
47
47
|
</div>
|
48
48
|
<% end %>
|
49
49
|
</div>
|
@@ -15,7 +15,7 @@
|
|
15
15
|
idx+= 1
|
16
16
|
idx_str= idx.to_s.rjust(2, "0") %>
|
17
17
|
<div class="sdg-cell" data-value="<%= sdg_code %>">
|
18
|
-
<%= image_pack_tag "media/images/ods-#{idx_str}.svg", alt: "Logo SDG #{idx_str}"%>
|
18
|
+
<%= image_pack_tag "media/images/ods-#{idx_str}.svg", alt: "Logo SDG #{idx_str}" %>
|
19
19
|
<div class="text">
|
20
20
|
<p><%= "#{idx_str}. #{t_sdg(sdg_code)}" %></p>
|
21
21
|
</div>
|
@@ -28,8 +28,5 @@
|
|
28
28
|
<a class="button button__sm md:button__lg button__secondary" data-close="" role="button"><%= t(".close") %></a>
|
29
29
|
</div>
|
30
30
|
</div>
|
31
|
-
|
32
31
|
</div>
|
33
32
|
</div>
|
34
|
-
|
35
|
-
|
@@ -56,7 +56,7 @@
|
|
56
56
|
<%= form.hidden_field :decidim_challenges_challenge_id, value: @form.try(:challenge) ? @form.try(:challenge).id : '' %>
|
57
57
|
<% else %>
|
58
58
|
<%= form.hidden_field :decidim_problems_problem_id, value: @form.try(:problem) ? @form.try(:problem).id : '' %>
|
59
|
-
<div class="card-section"
|
59
|
+
<div class="card-section">
|
60
60
|
<div class="row column">
|
61
61
|
<%= form.select :decidim_challenges_challenge_id,
|
62
62
|
@form.select_challenge_collection,
|
@@ -11,7 +11,7 @@
|
|
11
11
|
<div class="item__edit-sticky">
|
12
12
|
<div class="item__edit-sticky-container">
|
13
13
|
<%= f.submit t(".update"), class: "button button__sm button__secondary" %>
|
14
|
-
|
14
|
+
|
15
15
|
<% if solution.published? %>
|
16
16
|
<%= link_to t("actions.unpublish", scope: "decidim.solutions.admin"), solution_publish_path(solution), method: :delete, class: "button button__sm button__secondary" %>
|
17
17
|
<% else %>
|
@@ -7,6 +7,7 @@
|
|
7
7
|
<span id="js-selected-solutions-count" class="component-counter component-counter--inline" title="<%= t("decidim.solutions.admin.titles.solutions_list") %>"></span>
|
8
8
|
</div>
|
9
9
|
<div class="flex items-center gap-x-4">
|
10
|
+
<%= export_dropdowns(query) %>
|
10
11
|
<% if allowed_to? :create, :solution %>
|
11
12
|
<%= link_to t("actions.new_solution", scope: "decidim.solutions.admin"),
|
12
13
|
new_solution_path,
|
@@ -42,7 +42,7 @@
|
|
42
42
|
<div class="row column">
|
43
43
|
<span class="component__show-description"><%= t ".description" %></span>
|
44
44
|
<p class="component__show-text">
|
45
|
-
<%= decidim_sanitize_editor_admin translated_attribute solution.description
|
45
|
+
<%= decidim_sanitize_editor_admin translated_attribute solution.description %>
|
46
46
|
</p>
|
47
47
|
</div>
|
48
48
|
</div>
|
@@ -111,4 +111,3 @@
|
|
111
111
|
<% end %>
|
112
112
|
</div>
|
113
113
|
</div>
|
114
|
-
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<p class="uppercase mb-4"><%= t(@solution.challenge.state, scope: "decidim.challenges.states") %></p>
|
15
15
|
<% else %>
|
16
16
|
<p class="uppercase mb-4"><%= t(@solution.project_status, scope: "decidim.solutions.solutions.form.project_statuses") %></p>
|
17
|
-
<% end %>
|
17
|
+
<% end %>
|
18
18
|
</div>
|
19
19
|
<% end %>
|
20
20
|
</div>
|
@@ -77,7 +77,7 @@
|
|
77
77
|
</div>
|
78
78
|
<% end %>
|
79
79
|
</div>
|
80
|
-
|
80
|
+
|
81
81
|
<% if has_problem? %>
|
82
82
|
<% if @solution.problem.challenge.sdg_code %>
|
83
83
|
<div class="text-sm flex flex-col items-center gap-1">
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<% if has_problem? %>
|
15
15
|
<h3 class="h4">
|
16
16
|
<span class="title"><%= t("problem", scope: "activemodel.attributes.solution") %></span>:
|
17
|
-
<%= link_to translated_attribute(@solution.problem.title), Decidim::ResourceLocatorPresenter.new(@solution.problem).path %><br
|
17
|
+
<%= link_to translated_attribute(@solution.problem.title), Decidim::ResourceLocatorPresenter.new(@solution.problem).path %><br>
|
18
18
|
<span class="title"><%= t("challenge", scope: "activemodel.attributes.problem") %></span>:
|
19
19
|
<%= link_to translated_attribute(@solution.problem.challenge.title), Decidim::ResourceLocatorPresenter.new(@solution.problem.challenge).path %></strong>
|
20
20
|
</h3>
|
data/config/locales/ca.yml
CHANGED
@@ -1133,6 +1133,17 @@ ca:
|
|
1133
1133
|
publish: Publicar
|
1134
1134
|
unpublish: Despublicar
|
1135
1135
|
view: Veure solució
|
1136
|
+
exports:
|
1137
|
+
solutions: "Solucions"
|
1138
|
+
export:
|
1139
|
+
author: "Autor"
|
1140
|
+
title: "Títol"
|
1141
|
+
description: "Descripció"
|
1142
|
+
status: "Estat"
|
1143
|
+
challenge: "Repte associat"
|
1144
|
+
url: "Enllaç"
|
1145
|
+
created_at: "Data de creació"
|
1146
|
+
published_at: "Publicada"
|
1136
1147
|
solution_publications:
|
1137
1148
|
create:
|
1138
1149
|
error: Hi ha hagut un problema publicant aquesta solució
|
data/config/locales/en.yml
CHANGED
@@ -1135,6 +1135,17 @@ en:
|
|
1135
1135
|
publish: Publish
|
1136
1136
|
unpublish: Unpublish
|
1137
1137
|
view: View solution
|
1138
|
+
exports:
|
1139
|
+
solutions: "Solutions"
|
1140
|
+
export:
|
1141
|
+
author: "Author"
|
1142
|
+
title: "Title"
|
1143
|
+
description: "Description"
|
1144
|
+
status: "Status"
|
1145
|
+
challenge: "Associated challenge"
|
1146
|
+
url: "Link"
|
1147
|
+
created_at: "Creation date"
|
1148
|
+
published_at: "Published"
|
1138
1149
|
solution_publications:
|
1139
1150
|
create:
|
1140
1151
|
error: There's been a problem publising this solution
|
data/config/locales/es.yml
CHANGED
@@ -1140,6 +1140,17 @@ es:
|
|
1140
1140
|
publish: Publicar
|
1141
1141
|
unpublish: Despublicar
|
1142
1142
|
view: Ver solución
|
1143
|
+
exports:
|
1144
|
+
solutions: "Soluciones"
|
1145
|
+
export:
|
1146
|
+
author: "Autor"
|
1147
|
+
title: "Título"
|
1148
|
+
description: "Descripción"
|
1149
|
+
status: "Estado"
|
1150
|
+
challenge: "Reto asociado"
|
1151
|
+
url: "Enlace"
|
1152
|
+
created_at: "Fecha de creación"
|
1153
|
+
published_at: "Publicada"
|
1143
1154
|
solution_publications:
|
1144
1155
|
create:
|
1145
1156
|
error: Ha habido un problema publicando esta solución
|
@@ -49,4 +49,14 @@ Decidim.register_component(:solutions) do |component|
|
|
49
49
|
# component.seeds do |participatory_space|
|
50
50
|
# # Add some seeds for this component
|
51
51
|
# end
|
52
|
+
|
53
|
+
component.exports :solutions do |exports|
|
54
|
+
exports.collection do |component_instance|
|
55
|
+
Decidim::Solutions::Solution.where(component: component_instance)
|
56
|
+
end
|
57
|
+
|
58
|
+
exports.include_in_open_data = true
|
59
|
+
|
60
|
+
exports.serializer Decidim::Solutions::SolutionSerializer
|
61
|
+
end
|
52
62
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-challenges
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Valls
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-core
|
@@ -16,42 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.29'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: decidim
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0.27'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0.27'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: decidim-dev
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0.27'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0.27'
|
26
|
+
version: '0.29'
|
55
27
|
description: Articulates the collective action of diverse actors in order to address
|
56
28
|
shared challenges and the problems that derive from them across the territory.
|
57
29
|
email:
|
@@ -198,6 +170,7 @@ files:
|
|
198
170
|
- app/presenters/decidim/solutions/solution_presenter.rb
|
199
171
|
- app/serializers/decidim/challenges/download_your_data_survey_serializer.rb
|
200
172
|
- app/serializers/decidim/challenges/survey_serializer.rb
|
173
|
+
- app/serializers/decidim/solutions/solution_serializer.rb
|
201
174
|
- app/types/decidim/challenges/challenge_type.rb
|
202
175
|
- app/types/decidim/challenges/challenges_type.rb
|
203
176
|
- app/types/decidim/problems/problem_type.rb
|
@@ -302,14 +275,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
302
275
|
requirements:
|
303
276
|
- - ">="
|
304
277
|
- !ruby/object:Gem::Version
|
305
|
-
version: 3.
|
278
|
+
version: 3.2.9
|
306
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
307
280
|
requirements:
|
308
281
|
- - ">="
|
309
282
|
- !ruby/object:Gem::Version
|
310
283
|
version: '0'
|
311
284
|
requirements: []
|
312
|
-
rubygems_version: 3.
|
285
|
+
rubygems_version: 3.4.19
|
313
286
|
signing_key:
|
314
287
|
specification_version: 4
|
315
288
|
summary: A decidim challenges module
|