decidim-challenges 0.7.3 → 0.9.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.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/challenges/challenge_g/show.erb +1 -1
  3. data/app/cells/decidim/challenges/challenge_g_cell.rb +0 -20
  4. data/app/cells/decidim/problems/problem_g/show.erb +1 -1
  5. data/app/cells/decidim/problems/problem_g_cell.rb +1 -25
  6. data/app/cells/decidim/solutions/solution_g/show.erb +1 -1
  7. data/app/cells/decidim/solutions/solution_g_cell.rb +0 -40
  8. data/app/commands/decidim/challenges/admin/create_challenge.rb +3 -4
  9. data/app/commands/decidim/challenges/admin/update_challenge.rb +3 -4
  10. data/app/commands/decidim/challenges/survey_challenge.rb +1 -1
  11. data/app/commands/decidim/command_utils.rb +1 -1
  12. data/app/commands/decidim/problems/admin/create_problem.rb +2 -4
  13. data/app/commands/decidim/problems/admin/update_problem.rb +2 -4
  14. data/app/controllers/decidim/challenges/admin/challenges_controller.rb +3 -3
  15. data/app/controllers/decidim/challenges/admin/survey_form_controller.rb +7 -3
  16. data/app/controllers/decidim/challenges/admin/surveys_controller.rb +12 -8
  17. data/app/controllers/decidim/challenges/challenges_controller.rb +1 -8
  18. data/app/controllers/decidim/challenges/surveys_controller.rb +4 -4
  19. data/app/controllers/decidim/problems/admin/problems_controller.rb +3 -3
  20. data/app/controllers/decidim/problems/problems_controller.rb +1 -10
  21. data/app/controllers/decidim/solutions/admin/solutions_controller.rb +4 -4
  22. data/app/controllers/decidim/solutions/solutions_controller.rb +1 -24
  23. data/app/forms/decidim/challenges/admin/challenges_form.rb +2 -9
  24. data/app/forms/decidim/problems/admin/problems_form.rb +3 -19
  25. data/app/forms/decidim/solutions/solutions_form.rb +2 -3
  26. data/app/helpers/decidim/challenges/challenge_cells_helper.rb +1 -1
  27. data/app/helpers/decidim/challenges/challenges_helper.rb +3 -7
  28. data/app/helpers/decidim/problems/problems_helper.rb +3 -8
  29. data/app/helpers/decidim/solutions/application_helper.rb +1 -3
  30. data/app/helpers/decidim/solutions/solution_cells_helper.rb +1 -1
  31. data/app/helpers/decidim/solutions/solutions_helper.rb +2 -5
  32. data/app/models/decidim/challenges/challenge.rb +5 -8
  33. data/app/models/decidim/challenges/survey.rb +5 -2
  34. data/app/models/decidim/problems/problem.rb +5 -54
  35. data/app/models/decidim/solutions/solution.rb +10 -16
  36. data/app/permissions/decidim/challenges/admin/permissions.rb +3 -9
  37. data/app/presenters/decidim/challenges/challenge_presenter.rb +16 -19
  38. data/app/presenters/decidim/problems/problem_presenter.rb +11 -12
  39. data/app/presenters/decidim/solutions/solution_presenter.rb +36 -37
  40. data/app/serializers/decidim/challenges/download_your_data_survey_serializer.rb +5 -5
  41. data/app/serializers/decidim/challenges/survey_serializer.rb +8 -8
  42. data/app/serializers/decidim/solutions/solution_serializer.rb +2 -1
  43. data/app/types/decidim/challenges/challenge_type.rb +1 -3
  44. data/app/types/decidim/challenges/challenges_type.rb +1 -3
  45. data/app/types/decidim/problems/problem_type.rb +1 -3
  46. data/app/types/decidim/problems/problems_type.rb +1 -3
  47. data/app/types/decidim/solutions/solution_type.rb +1 -1
  48. data/app/types/decidim/solutions/solutions_type.rb +1 -3
  49. data/app/views/decidim/challenges/admin/challenges/_form.html.erb +8 -13
  50. data/app/views/decidim/challenges/admin/survey_form/edit_questions.html.erb +46 -0
  51. data/app/views/decidim/challenges/admin/surveys/edit.html.erb +6 -5
  52. data/app/views/decidim/challenges/admin/surveys/index.html.erb +12 -12
  53. data/app/views/decidim/challenges/admin/surveys/show.html.erb +14 -14
  54. data/app/views/decidim/challenges/challenges/_sidebar_data.html.erb +3 -10
  55. data/app/views/decidim/challenges/challenges/show.html.erb +1 -3
  56. data/app/views/decidim/problems/admin/problems/_form.html.erb +8 -17
  57. data/app/views/decidim/problems/problems/_sidebar_data.html.erb +2 -22
  58. data/app/views/decidim/problems/problems/show.html.erb +1 -3
  59. data/app/views/decidim/solutions/admin/solutions/_form.html.erb +9 -9
  60. data/app/views/decidim/solutions/admin/solutions/index.html.erb +3 -3
  61. data/app/views/decidim/solutions/solutions/_form.html.erb +4 -4
  62. data/app/views/decidim/solutions/solutions/_sidebar_data.html.erb +2 -22
  63. data/app/views/decidim/solutions/solutions/show.html.erb +1 -3
  64. data/config/locales/ca.yml +24 -13
  65. data/config/locales/cs.yml +12 -11
  66. data/config/locales/en.yml +25 -12
  67. data/config/locales/es.yml +25 -11
  68. data/config/locales/oc.yml +13 -12
  69. data/db/migrate/20260116075427_add_author_type_to_challenges_surveys.rb +40 -0
  70. data/db/migrate/20260526153523_remove_scope_from_challenges_and_problems.rb +9 -0
  71. data/lib/decidim/challenges/admin_engine.rb +7 -3
  72. data/lib/decidim/challenges/component.rb +2 -2
  73. data/lib/decidim/challenges/engine.rb +0 -1
  74. data/lib/decidim/challenges/test/factories.rb +1 -1
  75. data/lib/decidim/challenges/version.rb +3 -3
  76. data/lib/decidim/problems/test/factories.rb +1 -1
  77. data/lib/decidim/solutions/test/factories.rb +1 -1
  78. metadata +9 -7
  79. data/app/controllers/concerns/decidim/with_default_filters.rb +0 -23
@@ -8,7 +8,6 @@ oc:
8
8
  end_date: Data finalització
9
9
  global_description: Descripció del repte a escala global
10
10
  local_description: Descripció del repte al territori
11
- scope: Territori
12
11
  sdg: Objectius de Desenvolupament Sostenible
13
12
  start_date: Data d'inici
14
13
  status: Estat
@@ -20,13 +19,10 @@ oc:
20
19
  challenge: Repte
21
20
  groups_affected: Col·lectius afectats
22
21
  collaborating_entities: Entitat colaboradora
23
- decidim_sectorial_scope_id: Àmbit sectorial
24
- decidim_technological_scope_id: Àmbit tecnològic
25
22
  description: Descripció
26
23
  end_date: Data finalització
27
24
  prop_entity: Entitat proposant
28
25
  published: Publicat
29
- scope: Territori
30
26
  sdg: Objectius de Desenvolupament Sostenible
31
27
  start_date: Data d'inici
32
28
  status: Estat
@@ -47,10 +43,21 @@ oc:
47
43
  published: Publicat
48
44
  requirements: Requeriments
49
45
  sdg: Objectius de Desenvolupament Sostenible
50
- scope: Territori
51
46
  tags: Paraules clau
52
47
  title: Títol
53
48
  decidim:
49
+ open_data:
50
+ help:
51
+ solutions:
52
+ title: El títol de la solució
53
+ description: La descripció de la solució
54
+ status: L'estat actual del projecte de la solució
55
+ challenge: El títol del repte al qual pertany aquesta solució
56
+ url: L'enllaç extern relacionat amb el projecte de la solució
57
+ author_name: El nom de la persona participant autora d'aquesta solució
58
+ author_email: El correu electrònic de la persona participant autora d'aquesta solució
59
+ created_at: La data en què es va crear aquesta solució
60
+ published_at: La data en què es va publicar aquesta solució
54
61
  shared:
55
62
  filters:
56
63
  state: Estat
@@ -116,6 +123,7 @@ oc:
116
123
  save: Desa
117
124
  form:
118
125
  edit: Edita enquesta
126
+ manage_questions: Gestiona las preguntas
119
127
  title: Enquesta
120
128
  index:
121
129
  title: "%{total} respostes totals"
@@ -147,7 +155,6 @@ oc:
147
155
  finished: Acabada
148
156
  proposal: Proposta
149
157
  related_to: Relacionat amb
150
- scope: Àmbit
151
158
  search: Cerca
152
159
  state: Estat
153
160
  orders:
@@ -1059,12 +1066,8 @@ oc:
1059
1066
  finished: Acabada
1060
1067
  proposal: Proposta
1061
1068
  related_to: Relacionat amb
1062
- scope: Àmbit
1063
1069
  search: Cerca
1064
- sectorial_scope: Àmbit sectorial
1065
1070
  state: Estat
1066
- technological_scope: Àmbit tecnològic
1067
- territorial_scope: Àmbit territorial
1068
1071
  orders:
1069
1072
  label: test
1070
1073
  random: Aleatori
@@ -1208,9 +1211,7 @@ oc:
1208
1211
  financial: Finançers
1209
1212
  related_to: Relacionada amb
1210
1213
  requirement: Requeriment
1211
- scope: Àmbit
1212
1214
  search: Cerca
1213
- territorial_scope: Àmbit territorial
1214
1215
  orders:
1215
1216
  label: Ordenacions
1216
1217
  random: Aleatori
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ class AddAuthorTypeToChallengesSurveys < ActiveRecord::Migration[6.1]
4
+ class ChallengeSurvey < ApplicationRecord
5
+ self.table_name = "decidim_challenges_surveys"
6
+ end
7
+
8
+ def up
9
+ add_column :decidim_challenges_surveys, :decidim_author_type, :string
10
+
11
+ reversible do |direction|
12
+ direction.up do
13
+ execute <<~SQL.squish
14
+ UPDATE decidim_challenges_surveys
15
+ SET decidim_author_type = 'Decidim::UserBaseEntity'
16
+ SQL
17
+ end
18
+ end
19
+
20
+ remove_index :decidim_challenges_surveys, name: "decidim_challenges_surveys_author_challenge_unique", if_exists: true
21
+
22
+ add_index :decidim_challenges_surveys,
23
+ [:decidim_author_id, :decidim_author_type, :decidim_challenge_id],
24
+ unique: true,
25
+ name: "decidim_challenges_surveys_author_challenge_unique"
26
+ change_column_null :decidim_challenges_surveys, :decidim_author_id, false
27
+ change_column_null :decidim_challenges_surveys, :decidim_author_type, false
28
+ end
29
+
30
+ def down
31
+ remove_index :decidim_challenges_surveys, name: "decidim_challenges_surveys_author_challenge_unique", if_exists: true
32
+
33
+ remove_column :decidim_challenges_surveys, :decidim_author_type
34
+
35
+ add_index :decidim_challenges_surveys,
36
+ [:decidim_author_id, :decidim_challenge_id],
37
+ unique: true,
38
+ name: "decidim_challenges_surveys_author_challenge_unique"
39
+ end
40
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class RemoveScopeFromChallengesAndProblems < ActiveRecord::Migration[7.0]
4
+ def change
5
+ remove_column :decidim_challenges_challenges, :decidim_scope_id, :bigint
6
+ remove_column :decidim_problems_problems, :decidim_sectorial_scope_id, :bigint
7
+ remove_column :decidim_problems_problems, :decidim_technological_scope_id, :bigint
8
+ end
9
+ end
@@ -11,13 +11,17 @@ module Decidim
11
11
 
12
12
  # Add admin engine routes here
13
13
  routes do
14
- get "/answer_options", to: "challenge_survey#answer_options", as: :answer_options_challenge_survey, defaults: { format: "json" }
15
-
16
14
  resources :challenges do
17
15
  resource :publish, controller: "challenge_publications", only: [:create, :destroy]
18
16
 
19
17
  resource :surveys, only: [:edit, :update] do
20
- resource :form, only: [:edit, :update], controller: "survey_form"
18
+ resource :form, only: [:edit, :update], controller: "survey_form" do
19
+ member do
20
+ get :edit_questions
21
+ patch :update_questions
22
+ get :response_options, defaults: { format: "json" }
23
+ end
24
+ end
21
25
  collection do
22
26
  get :index_answers, action: :index
23
27
  get :show_answers, action: :show
@@ -55,11 +55,11 @@ Decidim.register_component(:challenges) do |component|
55
55
  component.exports :answers do |exports|
56
56
  exports.collection do |_f, _user, resource_id|
57
57
  questionnaire = Decidim::Forms::Questionnaire.find(resource_id)
58
- Decidim::Forms::QuestionnaireUserAnswers.for(questionnaire)
58
+ Decidim::Forms::QuestionnaireUserResponses.for(questionnaire)
59
59
  end
60
60
 
61
61
  exports.formats %w(CSV JSON Excel FormPDF)
62
62
 
63
- exports.serializer Decidim::Forms::UserAnswersSerializer
63
+ exports.serializer Decidim::Forms::UserResponsesSerializer
64
64
  end
65
65
  end
@@ -2,7 +2,6 @@
2
2
 
3
3
  require "rails"
4
4
  require "decidim/core"
5
- require "wicked_pdf"
6
5
 
7
6
  module Decidim
8
7
  module Challenges
@@ -21,7 +21,7 @@ FactoryBot.define do
21
21
  title { generate_localized_title }
22
22
  local_description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
23
23
  global_description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
24
- tags { Decidim::Faker::Localized.localized { [1..5].collect { generate(:name) }.join(", ") } }
24
+ tags { Array.new(3) { generate(:name) }.join(", ") }
25
25
  state { "execution" }
26
26
  start_date { 1.day.from_now }
27
27
  end_date { start_date + 2.months }
@@ -1,14 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Decidim
4
- # This holds the decidim-meetings version.
4
+ # This holds the decidim-challenges version.
5
5
  module Challenges
6
6
  def self.version
7
- "0.7.3"
7
+ "0.9.0"
8
8
  end
9
9
 
10
10
  def self.decidim_version
11
- "~> 0.29"
11
+ "~> 0.31"
12
12
  end
13
13
  end
14
14
  end
@@ -12,7 +12,7 @@ FactoryBot.define do
12
12
  factory :problem, traits: [:proposal, :execution, :finished], class: "Decidim::Problems::Problem" do
13
13
  title { generate_localized_title }
14
14
  description { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
15
- tags { Decidim::Faker::Localized.localized { [1..5].collect { generate(:name) }.join(", ") } }
15
+ tags { Array.new(3) { generate(:name) }.join(", ") }
16
16
  state { "execution" }
17
17
  causes { "causes" }
18
18
  groups_affected { "groups affected" }
@@ -17,7 +17,7 @@ FactoryBot.define do
17
17
  problem { association(:problem) }
18
18
  challenge { association(:challenge) }
19
19
 
20
- tags { Decidim::Faker::Localized.localized { [1..5].collect { generate(:name) }.join(", ") } }
20
+ tags { Array.new(3) { generate(:name) }.join(", ") }
21
21
  indicators { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
22
22
  objectives { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
23
23
  beneficiaries { Decidim::Faker::Localized.wrapped("<p>", "</p>") { generate_localized_title } }
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.7.3
4
+ version: 0.9.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-24 00:00:00.000000000 Z
11
+ date: 2026-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.29'
19
+ version: '0.31'
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.29'
26
+ version: '0.31'
27
27
  description: Articulates the collective action of diverse actors in order to address
28
28
  shared challenges and the problems that derive from them across the territory.
29
29
  email:
@@ -70,7 +70,6 @@ files:
70
70
  - app/controllers/concerns/decidim/problems/orderable_problems.rb
71
71
  - app/controllers/concerns/decidim/solutions/admin/filterable.rb
72
72
  - app/controllers/concerns/decidim/solutions/orderable_solutions.rb
73
- - app/controllers/concerns/decidim/with_default_filters.rb
74
73
  - app/controllers/concerns/decidim/with_sdgs.rb
75
74
  - app/controllers/decidim/challenges/admin/application_controller.rb
76
75
  - app/controllers/decidim/challenges/admin/challenge_publications_controller.rb
@@ -181,6 +180,7 @@ files:
181
180
  - app/views/decidim/challenges/admin/challenges/edit.html.erb
182
181
  - app/views/decidim/challenges/admin/challenges/index.html.erb
183
182
  - app/views/decidim/challenges/admin/challenges/new.html.erb
183
+ - app/views/decidim/challenges/admin/survey_form/edit_questions.html.erb
184
184
  - app/views/decidim/challenges/admin/surveys/_form.html.erb
185
185
  - app/views/decidim/challenges/admin/surveys/edit.html.erb
186
186
  - app/views/decidim/challenges/admin/surveys/index.html.erb
@@ -241,6 +241,8 @@ files:
241
241
  - db/migrate/20220407110503_add_card_image_to_challenges.rb
242
242
  - db/migrate/20240919094714_add_public_fields_to_solutions.rb
243
243
  - db/migrate/20250902145427_change_user_to_author_in_challenges_surveys.rb
244
+ - db/migrate/20260116075427_add_author_type_to_challenges_surveys.rb
245
+ - db/migrate/20260526153523_remove_scope_from_challenges_and_problems.rb
244
246
  - lib/decidim/challenges.rb
245
247
  - lib/decidim/challenges/admin.rb
246
248
  - lib/decidim/challenges/admin_engine.rb
@@ -276,14 +278,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
276
278
  requirements:
277
279
  - - ">="
278
280
  - !ruby/object:Gem::Version
279
- version: 3.2.9
281
+ version: 3.3.2
280
282
  required_rubygems_version: !ruby/object:Gem::Requirement
281
283
  requirements:
282
284
  - - ">="
283
285
  - !ruby/object:Gem::Version
284
286
  version: '0'
285
287
  requirements: []
286
- rubygems_version: 3.4.19
288
+ rubygems_version: 3.5.11
287
289
  signing_key:
288
290
  specification_version: 4
289
291
  summary: A decidim challenges module
@@ -1,23 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_support/concern"
4
-
5
- module Decidim
6
- module WithDefaultFilters
7
- extend ActiveSupport::Concern
8
-
9
- included do
10
- private
11
-
12
- def default_filter_scope_params
13
- return "all" unless current_component.participatory_space.scopes.any?
14
-
15
- if current_component.participatory_space.scope
16
- ["all", current_component.participatory_space.scope.id] + current_component.participatory_space.scope.children.map { |scope| scope.id.to_s }
17
- else
18
- %w(all global) + current_component.participatory_space.scopes.map { |scope| scope.id.to_s }
19
- end
20
- end
21
- end
22
- end
23
- end