decidim-challenges 0.5.0 → 0.6.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/controllers/decidim/solutions/admin/solutions_controller.rb +5 -0
- data/app/serializers/decidim/challenges/{data_serializer.rb → download_your_data_survey_serializer.rb} +1 -1
- data/app/serializers/decidim/solutions/solution_serializer.rb +67 -0
- data/app/views/decidim/solutions/admin/solutions/index.html.erb +1 -0
- 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 +1 -1
- data/lib/decidim/solutions/component.rb +10 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f6741d5f3e2e1eec682344b9ed01dc6ea9b1c98c60c7c239eecd50b39b7b28b
|
4
|
+
data.tar.gz: 724e8cb63ca6ee7cb8e13eae897850fa2cad889246f6894e36118d92e3997b3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 372cbf8488a77d85974463a7b992860b2c5aa54e1bb7bbd46d1971d5e1a38f6ff1b05a5e5bdbab35a9df562ebcf9466b900531e912e4b5e313068e34e59cbf57
|
7
|
+
data.tar.gz: d52802d6d03a1fceb5dee5dcbfacacba2a37ac54eedc4efc45435e7a1bb12ff9b3664c9ffa8bc06701f44ede84a4fc95faff62e7a3dbf3667556d6907cd0ffd2
|
@@ -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
|
@@ -5,7 +5,7 @@ module Decidim
|
|
5
5
|
# This class serializes the specific data in each Survey.
|
6
6
|
# This is `Questionnaire->questions->answer_options` but not `answers`
|
7
7
|
# and `answer_choices`.
|
8
|
-
class
|
8
|
+
class DownloadYourDataSurveySerializer < Decidim::Exporters::Serializer
|
9
9
|
# Returns: Array of Decidim::Forms::Questionnaire as a json hash,
|
10
10
|
# or nil if none exists.
|
11
11
|
def serialize
|
@@ -0,0 +1,67 @@
|
|
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 => resource.title[I18n.locale.to_s],
|
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 sanitize(text)
|
27
|
+
ActionController::Base.helpers.strip_tags(text)
|
28
|
+
end
|
29
|
+
|
30
|
+
def title_label
|
31
|
+
I18n.t("export.title", scope: "decidim.solutions.admin.exports").to_s
|
32
|
+
end
|
33
|
+
|
34
|
+
def description_label
|
35
|
+
I18n.t("export.description", scope: "decidim.solutions.admin.exports").to_s
|
36
|
+
end
|
37
|
+
|
38
|
+
def status_label
|
39
|
+
I18n.t("export.status", scope: "decidim.solutions.admin.exports").to_s
|
40
|
+
end
|
41
|
+
|
42
|
+
def challenge_label
|
43
|
+
I18n.t("export.challenge", scope: "decidim.solutions.admin.exports").to_s
|
44
|
+
end
|
45
|
+
|
46
|
+
def url_label
|
47
|
+
I18n.t("export.url", scope: "decidim.solutions.admin.exports").to_s
|
48
|
+
end
|
49
|
+
|
50
|
+
def created_at_label
|
51
|
+
I18n.t("export.created_at", scope: "decidim.solutions.admin.exports").to_s
|
52
|
+
end
|
53
|
+
|
54
|
+
def published_at_label
|
55
|
+
I18n.t("export.published_at", scope: "decidim.solutions.admin.exports").to_s
|
56
|
+
end
|
57
|
+
|
58
|
+
def translated_challenge_title
|
59
|
+
resource&.challenge&.title.present? ? resource&.challenge&.title&.[](I18n.locale.to_s) : ""
|
60
|
+
end
|
61
|
+
|
62
|
+
def sanitized_description
|
63
|
+
sanitize(resource.description[I18n.locale.to_s])
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -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,
|
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.6.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-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-core
|
@@ -196,8 +196,9 @@ files:
|
|
196
196
|
- app/presenters/decidim/challenges/challenge_presenter.rb
|
197
197
|
- app/presenters/decidim/problems/problem_presenter.rb
|
198
198
|
- app/presenters/decidim/solutions/solution_presenter.rb
|
199
|
-
- app/serializers/decidim/challenges/
|
199
|
+
- app/serializers/decidim/challenges/download_your_data_survey_serializer.rb
|
200
200
|
- app/serializers/decidim/challenges/survey_serializer.rb
|
201
|
+
- app/serializers/decidim/solutions/solution_serializer.rb
|
201
202
|
- app/types/decidim/challenges/challenge_type.rb
|
202
203
|
- app/types/decidim/challenges/challenges_type.rb
|
203
204
|
- app/types/decidim/problems/problem_type.rb
|