decidim-challenges 0.7.4 → 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 (77) 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/problems/problem.rb +5 -54
  34. data/app/models/decidim/solutions/solution.rb +10 -16
  35. data/app/permissions/decidim/challenges/admin/permissions.rb +3 -9
  36. data/app/presenters/decidim/challenges/challenge_presenter.rb +16 -19
  37. data/app/presenters/decidim/problems/problem_presenter.rb +11 -12
  38. data/app/presenters/decidim/solutions/solution_presenter.rb +36 -37
  39. data/app/serializers/decidim/challenges/download_your_data_survey_serializer.rb +5 -5
  40. data/app/serializers/decidim/challenges/survey_serializer.rb +8 -8
  41. data/app/serializers/decidim/solutions/solution_serializer.rb +2 -1
  42. data/app/types/decidim/challenges/challenge_type.rb +1 -3
  43. data/app/types/decidim/challenges/challenges_type.rb +1 -3
  44. data/app/types/decidim/problems/problem_type.rb +1 -3
  45. data/app/types/decidim/problems/problems_type.rb +1 -3
  46. data/app/types/decidim/solutions/solution_type.rb +1 -1
  47. data/app/types/decidim/solutions/solutions_type.rb +1 -3
  48. data/app/views/decidim/challenges/admin/challenges/_form.html.erb +8 -13
  49. data/app/views/decidim/challenges/admin/survey_form/edit_questions.html.erb +46 -0
  50. data/app/views/decidim/challenges/admin/surveys/edit.html.erb +6 -5
  51. data/app/views/decidim/challenges/admin/surveys/index.html.erb +12 -12
  52. data/app/views/decidim/challenges/admin/surveys/show.html.erb +14 -14
  53. data/app/views/decidim/challenges/challenges/_sidebar_data.html.erb +3 -10
  54. data/app/views/decidim/challenges/challenges/show.html.erb +1 -3
  55. data/app/views/decidim/problems/admin/problems/_form.html.erb +8 -17
  56. data/app/views/decidim/problems/problems/_sidebar_data.html.erb +2 -22
  57. data/app/views/decidim/problems/problems/show.html.erb +1 -3
  58. data/app/views/decidim/solutions/admin/solutions/_form.html.erb +9 -9
  59. data/app/views/decidim/solutions/admin/solutions/index.html.erb +3 -3
  60. data/app/views/decidim/solutions/solutions/_form.html.erb +4 -4
  61. data/app/views/decidim/solutions/solutions/_sidebar_data.html.erb +2 -22
  62. data/app/views/decidim/solutions/solutions/show.html.erb +1 -3
  63. data/config/locales/ca.yml +24 -13
  64. data/config/locales/cs.yml +12 -11
  65. data/config/locales/en.yml +25 -12
  66. data/config/locales/es.yml +25 -11
  67. data/config/locales/oc.yml +13 -12
  68. data/db/migrate/20260526153523_remove_scope_from_challenges_and_problems.rb +9 -0
  69. data/lib/decidim/challenges/admin_engine.rb +7 -3
  70. data/lib/decidim/challenges/component.rb +2 -2
  71. data/lib/decidim/challenges/engine.rb +0 -1
  72. data/lib/decidim/challenges/test/factories.rb +1 -1
  73. data/lib/decidim/challenges/version.rb +3 -3
  74. data/lib/decidim/problems/test/factories.rb +1 -1
  75. data/lib/decidim/solutions/test/factories.rb +1 -1
  76. metadata +8 -7
  77. data/app/controllers/concerns/decidim/with_default_filters.rb +0 -23
@@ -25,35 +25,34 @@ module Decidim
25
25
 
26
26
  # Render the solution title
27
27
  #
28
- # links - should render hashtags as links?
29
- # extras - should include extra hashtags?
28
+ # html_escape - should escape the HTML special characters?
30
29
  #
31
30
  # Returns a String.
32
- def title(links: false, extras: true, html_escape: false)
31
+ def title(html_escape: false)
33
32
  text = translated_attribute(solution.title)
34
33
  text = decidim_html_escape(text) if html_escape
35
34
 
36
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
37
- renderer.render(links:, extras:).html_safe
35
+ renderer = Decidim::ContentRenderers::BlobRenderer.new(text)
36
+ renderer.render.html_safe
38
37
  end
39
38
 
40
- def id_and_title(links: false, extras: true, html_escape: false)
41
- "##{solution.id} - #{title(links:, extras:, html_escape:)}"
39
+ def id_and_title(html_escape: false)
40
+ "##{solution.id} - #{title(html_escape:)}"
42
41
  end
43
42
 
44
43
  # Render the solution description
45
44
  #
46
- # links - should render hashtags as links?
47
- # extras - should include extra hashtags?
45
+ # links - should render URLs as links?
46
+ # strip_tags - should remove the HTML tags?
48
47
  #
49
48
  # Returns a String.
50
- def description(links: false, extras: true, strip_tags: false)
49
+ def description(links: false, strip_tags: false)
51
50
  text = translated_attribute(solution.description)
52
51
 
53
52
  text = strip_tags(sanitize_text(text)) if strip_tags
54
53
 
55
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
56
- text = renderer.render(links:, extras:).html_safe
54
+ renderer = Decidim::ContentRenderers::BlobRenderer.new(text)
55
+ text = renderer.render.html_safe
57
56
 
58
57
  text = Decidim::ContentRenderers::LinkRenderer.new(text).render if links
59
58
  text
@@ -61,17 +60,17 @@ module Decidim
61
60
 
62
61
  # Render the solution indicators
63
62
  #
64
- # links - should render hashtags as links?
65
- # extras - should include extra hashtags?
63
+ # links - should render URLs as links?
64
+ # strip_tags - should remove the HTML tags?
66
65
  #
67
66
  # Returns a String.
68
- def indicators(links: false, extras: true, strip_tags: false)
67
+ def indicators(links: false, strip_tags: false)
69
68
  text = translated_attribute(solution.indicators)
70
69
 
71
70
  text = strip_tags(sanitize_text(text)) if strip_tags
72
71
 
73
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
74
- text = renderer.render(links:, extras:).html_safe
72
+ renderer = Decidim::ContentRenderers::BlobRenderer.new(text)
73
+ text = renderer.render.html_safe
75
74
 
76
75
  text = Decidim::ContentRenderers::LinkRenderer.new(text).render if links
77
76
  text
@@ -79,17 +78,17 @@ module Decidim
79
78
 
80
79
  # Render the solution beneficiaries
81
80
  #
82
- # links - should render hashtags as links?
83
- # extras - should include extra hashtags?
81
+ # links - should render URLs as links?
82
+ # strip_tags - should remove the HTML tags?
84
83
  #
85
84
  # Returns a String.
86
- def beneficiaries(links: false, extras: true, strip_tags: false)
85
+ def beneficiaries(links: false, strip_tags: false)
87
86
  text = translated_attribute(solution.beneficiaries)
88
87
 
89
88
  text = strip_tags(sanitize_text(text)) if strip_tags
90
89
 
91
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
92
- text = renderer.render(links:, extras:).html_safe
90
+ renderer = Decidim::ContentRenderers::BlobRenderer.new(text)
91
+ text = renderer.render.html_safe
93
92
 
94
93
  text = Decidim::ContentRenderers::LinkRenderer.new(text).render if links
95
94
  text
@@ -97,17 +96,17 @@ module Decidim
97
96
 
98
97
  # Render the solution requirements
99
98
  #
100
- # links - should render hashtags as links?
101
- # extras - should include extra hashtags?
99
+ # links - should render URLs as links?
100
+ # strip_tags - should remove the HTML tags?
102
101
  #
103
102
  # Returns a String.
104
- def requirements(links: false, extras: true, strip_tags: false)
103
+ def requirements(links: false, strip_tags: false)
105
104
  text = translated_attribute(solution.requirements)
106
105
 
107
106
  text = strip_tags(sanitize_text(text)) if strip_tags
108
107
 
109
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
110
- text = renderer.render(links:, extras:).html_safe
108
+ renderer = Decidim::ContentRenderers::BlobRenderer.new(text)
109
+ text = renderer.render.html_safe
111
110
 
112
111
  text = Decidim::ContentRenderers::LinkRenderer.new(text).render if links
113
112
  text
@@ -115,17 +114,17 @@ module Decidim
115
114
 
116
115
  # Render the solution financing_type
117
116
  #
118
- # links - should render hashtags as links?
119
- # extras - should include extra hashtags?
117
+ # links - should render URLs as links?
118
+ # strip_tags - should remove the HTML tags?
120
119
  #
121
120
  # Returns a String.
122
- def financing_type(links: false, extras: true, strip_tags: false)
121
+ def financing_type(links: false, strip_tags: false)
123
122
  text = translated_attribute(solution.financing_type)
124
123
 
125
124
  text = strip_tags(sanitize_text(text)) if strip_tags
126
125
 
127
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
128
- text = renderer.render(links:, extras:).html_safe
126
+ renderer = Decidim::ContentRenderers::BlobRenderer.new(text)
127
+ text = renderer.render.html_safe
129
128
 
130
129
  text = Decidim::ContentRenderers::LinkRenderer.new(text).render if links
131
130
  text
@@ -133,17 +132,17 @@ module Decidim
133
132
 
134
133
  # Render the solution objectives
135
134
  #
136
- # links - should render hashtags as links?
137
- # extras - should include extra hashtags?
135
+ # links - should render URLs as links?
136
+ # strip_tags - should remove the HTML tags?
138
137
  #
139
138
  # Returns a String.
140
- def objectives(links: false, extras: true, strip_tags: false)
139
+ def objectives(links: false, strip_tags: false)
141
140
  text = translated_attribute(solution.objectives)
142
141
 
143
142
  text = strip_tags(sanitize_text(text)) if strip_tags
144
143
 
145
- renderer = Decidim::ContentRenderers::HashtagRenderer.new(text)
146
- text = renderer.render(links:, extras:).html_safe
144
+ renderer = Decidim::ContentRenderers::BlobRenderer.new(text)
145
+ text = renderer.render.html_safe
147
146
 
148
147
  text = Decidim::ContentRenderers::LinkRenderer.new(text).render if links
149
148
  text
@@ -3,8 +3,8 @@
3
3
  module Decidim
4
4
  module Challenges
5
5
  # This class serializes the specific data in each Survey.
6
- # This is `Questionnaire->questions->answer_options` but not `answers`
7
- # and `answer_choices`.
6
+ # This is `Questionnaire->questions->response_options` but not `responses`
7
+ # and `response_choices`.
8
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.
@@ -31,13 +31,13 @@ module Decidim
31
31
  def serialize_questions(questions)
32
32
  questions.collect do |question|
33
33
  json = question.attributes.as_json
34
- json[:answer_options] = serialize_answer_options(question.answer_options)
34
+ json[:response_options] = serialize_response_options(question.response_options)
35
35
  json
36
36
  end
37
37
  end
38
38
 
39
- def serialize_answer_options(answer_options)
40
- answer_options.collect do |option|
39
+ def serialize_response_options(response_options)
40
+ response_options.collect do |option|
41
41
  option.attributes.as_json
42
42
  end
43
43
  end
@@ -12,25 +12,25 @@ module Decidim
12
12
  name: resource.author.name,
13
13
  email: resource.author.email,
14
14
  },
15
- survey_form_answers: serialize_answers,
15
+ survey_form_answers: serialize_responses,
16
16
  }
17
17
  end
18
18
 
19
19
  private
20
20
 
21
- def serialize_answers
21
+ def serialize_responses
22
22
  questions = resource.challenge.questionnaire.questions
23
- answers = resource.challenge.questionnaire.answers.where(user: resource.author)
23
+ responses = resource.challenge.questionnaire.responses.where(user: resource.author)
24
24
  questions.each_with_index.inject({}) do |serialized, (question, idx)|
25
- answer = answers.find_by(question:)
26
- serialized.update("#{idx + 1}. #{translated_attribute(question.body)}" => normalize_body(answer))
25
+ response = responses.find_by(question:)
26
+ serialized.update("#{idx + 1}. #{translated_attribute(question.body)}" => normalize_body(response))
27
27
  end
28
28
  end
29
29
 
30
- def normalize_body(answer)
31
- return "" unless answer
30
+ def normalize_body(response)
31
+ return "" unless response
32
32
 
33
- answer.body || answer.choices.pluck(:body)
33
+ response.body || response.choices.pluck(:body)
34
34
  end
35
35
  end
36
36
  end
@@ -74,7 +74,8 @@ module Decidim
74
74
  end
75
75
 
76
76
  def translated_challenge_title
77
- resource&.challenge&.title.present? ? resource&.challenge&.title&.[](I18n.locale.to_s) : ""
77
+ title = resource&.challenge&.title
78
+ title.present? ? title[I18n.locale.to_s] : ""
78
79
  end
79
80
 
80
81
  def sanitized_description
@@ -3,8 +3,6 @@
3
3
  module Decidim
4
4
  module Challenges
5
5
  class ChallengeType < Decidim::Api::Types::BaseObject
6
- implements Decidim::Core::ScopableInterface
7
- implements Decidim::Core::AttachableInterface
8
6
  implements Decidim::Core::TraceableInterface
9
7
  implements Decidim::Core::TimestampsInterface
10
8
 
@@ -15,7 +13,7 @@ module Decidim
15
13
  field :title, Decidim::Core::TranslatedFieldType, "The title of this challenge (same as the component name).", null: false
16
14
  field :local_description, Decidim::Core::TranslatedFieldType, "The local description of this challenge.", null: true
17
15
  field :global_description, Decidim::Core::TranslatedFieldType, "The global description of this challenge.", null: true
18
- field :tags, Decidim::Core::TranslatedFieldType, "The tags of this challenge.", null: true
16
+ field :tags, GraphQL::Types::String, "The tags of this challenge.", null: true
19
17
  field :sdg_code, GraphQL::Types::String, "The Sustainable Development Goal this challenge is associated with.", null: true
20
18
  field :state, GraphQL::Types::String, "The state for this challenge.", null: true
21
19
  field :start_date, Decidim::Core::DateType, "The start date", null: true
@@ -2,9 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Challenges
5
- class ChallengesType < Decidim::Api::Types::BaseObject
6
- implements Decidim::Core::ComponentInterface
7
-
5
+ class ChallengesType < Decidim::Core::ComponentType
8
6
  graphql_name "Challenges"
9
7
  description "A challenges component of a participatory space."
10
8
 
@@ -13,9 +13,7 @@ module Decidim
13
13
  field :title, Decidim::Core::TranslatedFieldType, "The title of this problem (same as the component name).", null: false
14
14
  field :description, Decidim::Core::TranslatedFieldType, "The description of this problem.", null: true
15
15
  field :challenge, Decidim::Challenges::ChallengeType, "The related Challenge", null: true
16
- field :sectorial_scope, Decidim::Core::ScopeApiType, "The object's sectorial scope", null: true
17
- field :technological_scope, Decidim::Core::ScopeApiType, "The object's technological scope", null: true
18
- field :tags, Decidim::Core::TranslatedFieldType, "The tags of this problem.", null: true
16
+ field :tags, GraphQL::Types::String, "The tags of this problem.", null: true
19
17
  field :state, GraphQL::Types::String, "The state for this problem.", null: true
20
18
  field :start_date, Decidim::Core::DateType, "The start date", null: true
21
19
  field :end_date, Decidim::Core::DateType, "The end date", null: true
@@ -2,9 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Problems
5
- class ProblemsType < Decidim::Api::Types::BaseObject
6
- implements Decidim::Core::ComponentInterface
7
-
5
+ class ProblemsType < Decidim::Core::ComponentType
8
6
  graphql_name "Problems"
9
7
  description "A problems component of a participatory space."
10
8
 
@@ -13,7 +13,7 @@ module Decidim
13
13
  field :title, Decidim::Core::TranslatedFieldType, "The title of this solution (same as the component name).", null: false
14
14
  field :description, Decidim::Core::TranslatedFieldType, "The description of this solution.", null: true
15
15
  field :problem, Decidim::Problems::ProblemType, "The related Problem", null: true
16
- field :tags, Decidim::Core::TranslatedFieldType, "The tags of this solution.", null: true
16
+ field :tags, GraphQL::Types::String, "The tags of this solution.", null: true
17
17
  field :indicators, Decidim::Core::TranslatedFieldType, "The indicators of this solution.", null: true
18
18
  field :beneficiaries, Decidim::Core::TranslatedFieldType, "The beneficiaries of this solution.", null: true
19
19
  field :requirements, Decidim::Core::TranslatedFieldType, "The requirements of this solution.", null: true
@@ -2,9 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Solutions
5
- class SolutionsType < Decidim::Api::Types::BaseObject
6
- implements Decidim::Core::ComponentInterface
7
-
5
+ class SolutionsType < Decidim::Core::ComponentType
8
6
  graphql_name "Solutions"
9
7
  description "A solutions component of a participatory space."
10
8
 
@@ -1,29 +1,25 @@
1
1
  <div class="form__wrapper">
2
2
  <div class="card pt-4">
3
3
  <div class="card-section">
4
- <div class="row column hashtags__container">
5
- <%= form.translated :text_field, :title, autofocus: true, class: "js-hashtags", hashtaggable: true, aria: { label: :title } %>
4
+ <div class="row column">
5
+ <%= form.translated :text_field, :title, autofocus: true, aria: { label: :title } %>
6
6
  </div>
7
7
 
8
- <div class="row column hashtags__container">
8
+ <div class="row column">
9
9
  <%= form.translated :editor, :local_description %>
10
10
  </div>
11
11
 
12
- <div class="row column hashtags__container">
12
+ <div class="row column">
13
13
  <%= form.translated :editor, :global_description %>
14
14
  </div>
15
15
 
16
- <div class="row column hashtags__container">
17
- <%= form.text_field :tags %>
18
- </div>
19
-
20
16
  <div class="row column">
21
- <%= scopes_select_field form, :decidim_scope_id, root: nil %>
17
+ <%= form.text_field :tags %>
22
18
  </div>
23
19
 
24
20
  <% if params[:component_id] %>
25
21
  <% if Decidim::Component.where(participatory_space: Decidim::Component.find(params[:component_id]).participatory_space).pluck(:manifest_name).include? 'sdgs' %>
26
- <div class="row column hashtags__container">
22
+ <div class="row column">
27
23
  <%= form.select :sdg_code,
28
24
  @form.select_sdg_collection,
29
25
  selected: [t_sdg(@form.sdg_code), @form.sdg_code],
@@ -35,15 +31,14 @@
35
31
  <div class="row column">
36
32
  <%= form.select :state,
37
33
  @form.select_states_collection,
38
- selected: [I18n.t(@form.try(:state), scope: 'decidim.challenges.states'), Decidim::Challenges::Challenge::states[@form.try(:state)]],
39
34
  label: t("models.challenge.fields.state", scope: "decidim.challenges.admin") %>
40
35
  </div>
41
36
 
42
- <div class="row column hashtags__container">
37
+ <div class="row column">
43
38
  <%= form.text_field :collaborating_entities %>
44
39
  </div>
45
40
 
46
- <div class="row column hashtags__container">
41
+ <div class="row column">
47
42
  <%= form.text_field :coordinating_entities %>
48
43
  </div>
49
44
 
@@ -0,0 +1,46 @@
1
+ <% add_decidim_page_title(t("decidim.forms.admin.questionnaires.edit_questions.title")) %>
2
+
3
+ <% if templates_defined? && choose_template? %>
4
+ <%= render partial: "decidim/templates/admin/questionnaire_templates/choose", locals: { target: questionnaire, form_title: t("decidim.forms.admin.questionnaires.edit.title"), show_buttons: true } %>
5
+ <% else %>
6
+
7
+ <div class="questionnaire-questions">
8
+ <div class="item_show__header">
9
+ <h1 class="item_show__header-title">
10
+ <%= t("decidim.forms.admin.questionnaires.edit_questions.title") %>
11
+ <% if questionnaire.questions_editable? %>
12
+ <button class="button button__sm button__secondary add-question"><%= t("add_question", scope: "decidim.forms.admin.questionnaires.edit_questions") %></button>
13
+ <button class="button button__sm button__secondary add-separator"><%= t("add_separator", scope: "decidim.forms.admin.questionnaires.edit_questions") %></button>
14
+ <button class="button button__sm button__secondary add-title-and-description"><%= t("add_title_and_description", scope: "decidim.forms.admin.questionnaires.edit_questions") %></button>
15
+ <% end %>
16
+ <% if allowed_to? :preview, :questionnaire %>
17
+ <%= link_to t("preview", scope: "decidim.forms.admin.questionnaires.form"), public_url, class: "button button__sm button__transparent-secondary", target: :_blank, data: { "external-link": false } %>
18
+ <% end %>
19
+ <% unless template? questionnaire.questionnaire_for %>
20
+ <% if questionnaire.responses.any? %>
21
+ <%= export_dropdown(current_component, questionnaire.id) if allowed_to? :export_response, :questionnaire_responses %>
22
+ <% if allowed_to? :show, :questionnaire_responses %>
23
+ <%= link_to t("actions.show", scope: "decidim.forms.admin.questionnaires"), questionnaire_participants_url, class: "button button__sm button__secondary new whitespace-nowrap" %>
24
+ <% end %>
25
+ <% else %>
26
+ <button class="button button__sm button__secondary whitespace-nowrap" disabled><%= t("empty", scope: "decidim.forms.admin.questionnaires.responses") %></button>
27
+ <% end %>
28
+ <% end %>
29
+ </h1>
30
+ </div>
31
+ </div>
32
+
33
+ <div class="item__edit item__edit-1col">
34
+ <div class="item__edit-form">
35
+ <%= decidim_form_for(@form, url: update_questions_challenge_surveys_form_path(challenge_id: @challenge.id), method: :patch, html: { class: "form-defaults form edit_questionnaire" }) do |form| %>
36
+ <%= render partial: "decidim/forms/admin/questionnaires/questions_form", object: form %>
37
+ <div class="item__edit-sticky">
38
+ <div class="item__edit-sticky-container">
39
+ <%= form.submit t("save", scope: "decidim.forms.admin.questionnaires.edit"), class: "button button__sm button__secondary" %>
40
+ </div>
41
+ </div>
42
+ <% end %>
43
+ </div>
44
+ </div>
45
+
46
+ <% end %>
@@ -1,24 +1,25 @@
1
1
  <% add_decidim_page_title(t("decidim.forms.admin.questionnaires.edit.title")) %>
2
2
 
3
3
  <% if templates_defined? && choose_template? %>
4
- <%= render partial: "decidim/templates/admin/questionnaire_templates/choose", locals: { target: questionnaire, form_title: t("decidim.forms.admin.questionnaires.edit.title") } %>
4
+ <%= render partial: "decidim/templates/admin/questionnaire_templates/choose", locals: { target: questionnaire, form_title: t("decidim.forms.admin.questionnaires.edit.title"), show_buttons: true } %>
5
5
  <% else %>
6
6
  <div class="item_show__header">
7
7
  <h1 class="item_show__header-title">
8
8
  <%= edit_questionnaire_title %>
9
9
 
10
10
  <%= link_to t("decidim.challenges.admin.surveys.form.edit"), edit_challenge_surveys_form_path(challenge_id: @challenge.id), class: "button button__sm button__secondary" %>
11
+ <%= link_to t("decidim.challenges.admin.surveys.form.manage_questions"), edit_questions_challenge_surveys_form_path(challenge_id: @challenge.id), class: "button button__sm button__secondary" %>
12
+
11
13
  <% unless template? questionnaire.questionnaire_for %>
12
14
  <% if allowed_to? :preview, :questionnaire %>
13
15
  <%= link_to t("preview", scope: "decidim.forms.admin.questionnaires.form"), public_url, class: "button button__sm button__secondary", target: :_blank, data: { "external-link": false } %>
14
16
  <% end %>
15
- <% if questionnaire.answers.any? %>
16
- <%= export_dropdown(current_component, questionnaire.id) if allowed_to? :export_answers, :questionnaire %>
17
- <% if allowed_to? :show, :questionnaire_answers %>
17
+ <% if questionnaire.responses.any? %>
18
+ <% if allowed_to? :show, :questionnaire_responses %>
18
19
  <%= link_to t("actions.show", scope: "decidim.forms.admin.questionnaires"), questionnaire_participants_url, class: "button button__sm button__secondary new whitespace-nowrap" %>
19
20
  <% end %>
20
21
  <% else %>
21
- <button class="button button__sm button__secondary whitespace-nowrap" disabled><%= t("empty", scope: "decidim.forms.admin.questionnaires.answers") %></button>
22
+ <button class="button button__sm button__secondary whitespace-nowrap" disabled><%= t("empty", scope: "decidim.forms.admin.questionnaires.responses") %></button>
22
23
  <% end %>
23
24
  <% end %>
24
25
  </h1>
@@ -1,4 +1,4 @@
1
- <div class="card" id="answers">
1
+ <div class="card" id="responses">
2
2
  <div class="item_show__header">
3
3
  <h1 class="item_show__header-title">
4
4
  <%= t ".title", total: @total %>
@@ -11,10 +11,10 @@
11
11
  <tr>
12
12
  <th>#</th>
13
13
  <th><%= first_table_th(@participants.first) %></th>
14
- <th><%= t("user_status", scope: "decidim.forms.user_answers_serializer") %></th>
15
- <th><%= t("ip_hash", scope: "decidim.forms.user_answers_serializer") %></th>
16
- <th><%= t("completion", scope: "decidim.forms.user_answers_serializer") %></th>
17
- <th><%= t("created_at", scope: "decidim.forms.user_answers_serializer") %></th>
14
+ <th><%= t("user_status", scope: "decidim.forms.user_responses_serializer") %></th>
15
+ <th><%= t("ip_hash", scope: "decidim.forms.user_responses_serializer") %></th>
16
+ <th><%= t("completion", scope: "decidim.forms.user_responses_serializer") %></th>
17
+ <th><%= t("created_at", scope: "decidim.forms.user_responses_serializer") %></th>
18
18
  <th></th>
19
19
  </tr>
20
20
  </thead>
@@ -23,21 +23,21 @@
23
23
  <tr>
24
24
  <td><%= idx + 1 + page_offset %></td>
25
25
  <td>
26
- <% if allowed_to? :show, :questionnaire_answers %>
27
- <%= link_to first_table_td(participant), questionnaire_participant_answers_url(participant.session_token) %>
26
+ <% if allowed_to? :show, :questionnaire_responses %>
27
+ <%= link_to first_table_td(participant), questionnaire_participant_responses_url(participant.session_token) %>
28
28
  <% else %>
29
29
  <%= first_table_td(participant) %></td>
30
30
  <% end %>
31
31
  <td><%= participant.status %></td>
32
32
  <td><%= participant.ip_hash %></td>
33
33
  <td><%= display_percentage(participant.completion) %></td>
34
- <td><%= l participant.answered_at, format: :short %></td>
34
+ <td><%= l participant.responded_at, format: :short %></td>
35
35
  <td class="table-list__actions">
36
- <% if allowed_to? :show, :questionnaire_answers %>
37
- <%= icon_link_to "eye-line", questionnaire_participant_answers_url(participant.session_token), t("actions.show", scope: "decidim.forms.admin.questionnaires.answers"), class: "action-icon--eye" %>
36
+ <% if allowed_to? :show, :questionnaire_responses %>
37
+ <%= icon_link_to "eye-line", questionnaire_participant_responses_url(participant.session_token), t("actions.show", scope: "decidim.forms.admin.questionnaires.responses"), class: "action-icon--eye" %>
38
38
  <% end %>
39
- <% if allowed_to? :export_response, :questionnaire_answers %>
40
- <%= icon_link_to "download-line", questionnaire_export_response_url(participant.session_token), t("actions.export", scope: "decidim.forms.admin.questionnaires.answers"), class: "action-icon--data-transfer-download" %>
39
+ <% if allowed_to? :export_response, :questionnaire_responses %>
40
+ <%= icon_link_to "download-line", questionnaire_export_response_url(participant.session_token), t("actions.export", scope: "decidim.forms.admin.questionnaires.responses"), class: "action-icon--data-transfer-download" %>
41
41
  <% end %>
42
42
  </td>
43
43
  </tr>
@@ -1,12 +1,12 @@
1
- <div class="card" id="answers">
1
+ <div class="card" id="responses">
2
2
  <div class="item_show__header">
3
3
  <h1 class="item_show__header-title">
4
4
  <%= t ".title", number: current_idx %>
5
5
 
6
- <%= link_to t("actions.next", scope: "decidim.forms.admin.questionnaires.answers").html_safe, next_url, rel: "next", class: "button button__sm button__secondary next" unless last? %>
7
- <%= link_to t("actions.previous", scope: "decidim.forms.admin.questionnaires.answers").html_safe, prev_url, rel: "prev", class: "button button__sm button__secondary prev" unless first? %>
8
- <%= link_to t("actions.export", scope: "decidim.forms.admin.questionnaires.answers"), questionnaire_export_response_url(@participant.session_token), class: "button button__sm button__secondary export" %>
9
- <%= link_to t("actions.back", scope: "decidim.forms.admin.questionnaires.answers"), questionnaire_participants_url, class: "button button__sm button__secondary back" %>
6
+ <%= link_to t("actions.next", scope: "decidim.forms.admin.questionnaires.responses").html_safe, next_url, rel: "next", class: "button button__sm button__secondary next" unless last? %>
7
+ <%= link_to t("actions.previous", scope: "decidim.forms.admin.questionnaires.responses").html_safe, prev_url, rel: "prev", class: "button button__sm button__secondary prev" unless first? %>
8
+ <%= link_to t("actions.export", scope: "decidim.forms.admin.questionnaires.responses"), questionnaire_export_response_url(@participant.session_token), class: "button button__sm button__secondary export" %>
9
+ <%= link_to t("actions.back", scope: "decidim.forms.admin.questionnaires.responses"), questionnaire_participants_url, class: "button button__sm button__secondary back" %>
10
10
  </h1>
11
11
  </div>
12
12
  <div class="card-section">
@@ -14,11 +14,11 @@
14
14
  <table class="table-list">
15
15
  <thead>
16
16
  <tr>
17
- <th><%= t("session_token", scope: "decidim.forms.user_answers_serializer") %></th>
18
- <th><%= t("user_status", scope: "decidim.forms.user_answers_serializer") %></th>
19
- <th><%= t("ip_hash", scope: "decidim.forms.user_answers_serializer") %></th>
20
- <th><%= t("completion", scope: "decidim.forms.user_answers_serializer") %></th>
21
- <th><%= t("created_at", scope: "decidim.forms.user_answers_serializer") %></th>
17
+ <th><%= t("session_token", scope: "decidim.forms.user_responses_serializer") %></th>
18
+ <th><%= t("user_status", scope: "decidim.forms.user_responses_serializer") %></th>
19
+ <th><%= t("ip_hash", scope: "decidim.forms.user_responses_serializer") %></th>
20
+ <th><%= t("completion", scope: "decidim.forms.user_responses_serializer") %></th>
21
+ <th><%= t("created_at", scope: "decidim.forms.user_responses_serializer") %></th>
22
22
  <th></th>
23
23
  </tr>
24
24
  </thead>
@@ -28,15 +28,15 @@
28
28
  <td><%= @participant.status %></td>
29
29
  <td><%= @participant.ip_hash %></td>
30
30
  <td><%= display_percentage(@participant.completion) %></td>
31
- <td><%= l @participant.answered_at, format: :short %></td>
31
+ <td><%= l @participant.responded_at, format: :short %></td>
32
32
  </tr>
33
33
  </tbody>
34
34
  </table>
35
35
  </div>
36
36
  <dl class="p-4 [&_ul]:list-disc [&_ul]:pl-4">
37
- <% @participant.answers.each do |answer| %>
38
- <dt class="font-semibold"><%= answer.question %></dt>
39
- <dd><%= answer.body %></dd>
37
+ <% @participant.responses.each do |response| %>
38
+ <dt class="font-semibold"><%= response.question %></dt>
39
+ <dd><%= response.body %></dd>
40
40
  <% end %>
41
41
  </dl>
42
42
  </div>
@@ -17,13 +17,6 @@
17
17
  <p class="uppercase mb-4"><%= t(@challenge.state, scope: "decidim.challenges.states") %></p>
18
18
  </div>
19
19
 
20
- <% if @challenge_scope.present? %>
21
- <div class="text-sm flex flex-col items-center gap-1">
22
- <p class="uppercase text-xs"><%= t("scope", scope: "activemodel.attributes.challenge") %></p>
23
- <p class="uppercase mb-4"><%= translated_attribute(@challenge_scope.name) %></p>
24
- </div>
25
- <% end %>
26
-
27
20
  <% if @challenge.coordinating_entities.present? %>
28
21
  <div class="text-sm flex flex-col items-center gap-1">
29
22
  <p class="uppercase text-xs"><%= t("coordinating_entities", scope: "activemodel.attributes.challenge") %></p>
@@ -39,7 +32,7 @@
39
32
  <% end %>
40
33
  </div>
41
34
 
42
- <% if has_sdgs? %>
35
+ <% if has_sdgs? && @sdg.present? %>
43
36
  <div class="text-sm flex flex-col items-center gap-1">
44
37
  <p class="uppercase text-xs text-center"><%= t("sdg", scope: "activemodel.attributes.challenge") %></p>
45
38
  <div class="ods challenges flex items-center">
@@ -55,6 +48,6 @@
55
48
 
56
49
  <section class="layout-aside__section actions__secondary">
57
50
  <%= resource_reference(current_participatory_space) %>
58
- <%= render partial: "decidim/shared/follow_button", class: "text-center", locals: { followable: current_participatory_space, large: false } %>
59
- <%= cell "decidim/share_button", nil %>
51
+ <%= cell("decidim/follow_button", @challenge, button_classes: "button button__sm button__transparent-secondary") %>
52
+ <%= cell("decidim/share_widget", @challenge) %>
60
53
  </section>
@@ -4,13 +4,11 @@
4
4
  <%= render layout: "layouts/decidim/shared/layout_item", locals: { back_path: challenges_path } do %>
5
5
  <section class="layout-main__section layout-main__heading">
6
6
  <h1 class="h2 decorator">
7
- <%= present(@challenge).title(links: true, html_escape: true) %>
7
+ <%= present(@challenge).title(html_escape: true) %>
8
8
  </h1>
9
9
  </section>
10
10
 
11
11
  <section class="layout-main__section content-block__description">
12
- <%= render partial: "decidim/shared/share_modal" %>
13
-
14
12
  <h3 class="h4"><%= t("local_description", scope: "activemodel.attributes.challenge") %></h3>
15
13
  <div class="rich-text-display">
16
14
  <p><%= present(@challenge).local_description %></p>