decidim-forms 0.30.9 → 0.31.0.rc1

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 (162) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -10
  3. data/app/cells/decidim/forms/matrix_readonly/show.erb +1 -1
  4. data/app/cells/decidim/forms/matrix_readonly_cell.rb +3 -3
  5. data/app/cells/decidim/forms/question_readonly/show.erb +5 -5
  6. data/app/cells/decidim/forms/question_readonly/title_and_description.erb +3 -3
  7. data/app/cells/decidim/forms/response_readonly_cell.rb +9 -0
  8. data/app/cells/decidim/forms/step_navigation/show.erb +3 -3
  9. data/app/cells/decidim/forms/step_navigation_cell.rb +3 -3
  10. data/app/commands/decidim/forms/admin/update_questions.rb +6 -6
  11. data/app/commands/decidim/forms/{answer_questionnaire.rb → response_questionnaire.rb} +35 -35
  12. data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +12 -12
  13. data/app/controllers/decidim/forms/admin/concerns/{has_questionnaire_answers.rb → has_questionnaire_responses.rb} +23 -19
  14. data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +38 -33
  15. data/app/forms/decidim/forms/admin/display_condition_form.rb +15 -15
  16. data/app/forms/decidim/forms/admin/question_form.rb +3 -3
  17. data/app/forms/decidim/forms/admin/{answer_option_form.rb → response_option_form.rb} +3 -3
  18. data/app/forms/decidim/forms/questionnaire_form.rb +18 -16
  19. data/app/forms/decidim/forms/{answer_choice_form.rb → response_choice_form.rb} +5 -5
  20. data/app/forms/decidim/forms/{answer_form.rb → response_form.rb} +9 -9
  21. data/app/helpers/decidim/forms/admin/application_helper.rb +2 -2
  22. data/app/helpers/decidim/forms/admin/concerns/{has_questionnaire_answers_pagination_helper.rb → has_questionnaire_responses_pagination_helper.rb} +4 -4
  23. data/app/helpers/decidim/forms/admin/concerns/{has_questionnaire_answers_url_helper.rb → has_questionnaire_responses_url_helper.rb} +5 -5
  24. data/app/helpers/decidim/forms/admin/questionnaire_responses_helper.rb +32 -0
  25. data/app/helpers/decidim/forms/application_helper.rb +1 -2
  26. data/app/jobs/decidim/forms/{export_questionnaire_answers_job.rb → export_questionnaire_responses_job.rb} +5 -5
  27. data/app/models/decidim/forms/display_condition.rb +20 -20
  28. data/app/models/decidim/forms/question.rb +14 -13
  29. data/app/models/decidim/forms/question_matrix_row.rb +1 -1
  30. data/app/models/decidim/forms/questionnaire.rb +11 -11
  31. data/app/models/decidim/forms/{answer.rb → response.rb} +9 -9
  32. data/app/models/decidim/forms/response_choice.rb +22 -0
  33. data/app/models/decidim/forms/{answer_option.rb → response_option.rb} +5 -5
  34. data/app/packs/entrypoints/decidim_forms_admin.js +3 -3
  35. data/app/packs/src/decidim/forms/admin/collapsible_questions.js +12 -10
  36. data/app/packs/src/decidim/forms/admin/forms.js +47 -66
  37. data/app/packs/src/decidim/forms/admin/{publish_answers_buttons.js → publish_responses_buttons.js} +12 -12
  38. data/app/packs/src/decidim/forms/display_conditions.component.js +12 -12
  39. data/app/packs/src/decidim/forms/forms.js +8 -29
  40. data/app/packs/stylesheets/decidim/forms/forms.scss +2 -2
  41. data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +13 -13
  42. data/app/presenters/decidim/forms/admin/questionnaire_response_presenter.rb +89 -0
  43. data/app/presenters/decidim/forms/admin_log/question_presenter.rb +3 -3
  44. data/app/presenters/decidim/forms/{answer_option_presenter.rb → response_option_presenter.rb} +2 -2
  45. data/app/queries/decidim/forms/questionnaire_participant.rb +5 -5
  46. data/app/queries/decidim/forms/questionnaire_participants.rb +6 -6
  47. data/app/queries/decidim/forms/questionnaire_user_responses.rb +32 -0
  48. data/app/views/decidim/forms/admin/questionnaires/_display_condition.html.erb +9 -9
  49. data/app/views/decidim/forms/admin/questionnaires/_form.html.erb +2 -2
  50. data/app/views/decidim/forms/admin/questionnaires/_matrix_row.html.erb +3 -3
  51. data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +25 -15
  52. data/app/views/decidim/forms/admin/questionnaires/_questions_form.html.erb +14 -21
  53. data/app/views/decidim/forms/admin/questionnaires/_response_option.html.erb +45 -0
  54. data/app/views/decidim/forms/admin/questionnaires/_response_option_template.html.erb +7 -0
  55. data/app/views/decidim/forms/admin/questionnaires/_separator.html.erb +15 -5
  56. data/app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb +15 -5
  57. data/app/views/decidim/forms/admin/questionnaires/edit.html.erb +1 -1
  58. data/app/views/decidim/forms/admin/questionnaires/edit_questions.html.erb +8 -8
  59. data/app/views/decidim/forms/admin/questionnaires/responses/index.html.erb +80 -0
  60. data/app/views/decidim/forms/admin/questionnaires/responses/show.html.erb +43 -0
  61. data/app/views/decidim/forms/questionnaires/_questionnaire.html.erb +24 -22
  62. data/app/views/decidim/forms/questionnaires/_questionnaire_readonly.html.erb +8 -3
  63. data/app/views/decidim/forms/questionnaires/_response.html.erb +61 -0
  64. data/app/views/decidim/forms/questionnaires/edit.html.erb +2 -2
  65. data/app/views/decidim/forms/questionnaires/responses/_files.html.erb +1 -0
  66. data/app/views/decidim/forms/questionnaires/responses/_long_response.html.erb +3 -0
  67. data/app/views/decidim/forms/questionnaires/{answers → responses}/_matrix_multiple.html.erb +16 -15
  68. data/app/views/decidim/forms/questionnaires/{answers → responses}/_matrix_single.html.erb +17 -16
  69. data/app/views/decidim/forms/questionnaires/responses/_multiple_option.html.erb +26 -0
  70. data/app/views/decidim/forms/questionnaires/responses/_separator.html.erb +1 -0
  71. data/app/views/decidim/forms/questionnaires/responses/_short_response.html.erb +3 -0
  72. data/app/views/decidim/forms/questionnaires/responses/_single_option.html.erb +33 -0
  73. data/app/views/decidim/forms/questionnaires/responses/_sorting.html.erb +26 -0
  74. data/app/views/decidim/forms/questionnaires/responses/_title_and_description.html.erb +1 -0
  75. data/app/views/decidim/forms/questionnaires/show.html.erb +10 -10
  76. data/config/assets.rb +2 -2
  77. data/config/locales/ar.yml +2 -22
  78. data/config/locales/bg.yml +10 -36
  79. data/config/locales/ca-IT.yml +82 -76
  80. data/config/locales/ca.yml +82 -76
  81. data/config/locales/cs.yml +79 -76
  82. data/config/locales/de.yml +80 -74
  83. data/config/locales/el.yml +10 -36
  84. data/config/locales/en.yml +90 -84
  85. data/config/locales/es-MX.yml +82 -76
  86. data/config/locales/es-PY.yml +82 -76
  87. data/config/locales/es.yml +80 -74
  88. data/config/locales/eu.yml +83 -77
  89. data/config/locales/fi-plain.yml +78 -72
  90. data/config/locales/fi.yml +76 -70
  91. data/config/locales/fr-CA.yml +72 -70
  92. data/config/locales/fr.yml +72 -70
  93. data/config/locales/ga-IE.yml +4 -7
  94. data/config/locales/gl.yml +4 -22
  95. data/config/locales/hu.yml +4 -22
  96. data/config/locales/id-ID.yml +2 -22
  97. data/config/locales/it.yml +8 -40
  98. data/config/locales/ja.yml +87 -81
  99. data/config/locales/lb.yml +8 -36
  100. data/config/locales/lt.yml +10 -36
  101. data/config/locales/lv.yml +4 -22
  102. data/config/locales/nl.yml +10 -36
  103. data/config/locales/no.yml +10 -36
  104. data/config/locales/pl.yml +10 -36
  105. data/config/locales/pt-BR.yml +10 -120
  106. data/config/locales/pt.yml +8 -36
  107. data/config/locales/ro-RO.yml +30 -52
  108. data/config/locales/ru.yml +2 -9
  109. data/config/locales/sk.yml +3 -183
  110. data/config/locales/sl.yml +0 -5
  111. data/config/locales/sv.yml +77 -70
  112. data/config/locales/tr-TR.yml +8 -36
  113. data/config/locales/val-ES.yml +2 -0
  114. data/config/locales/zh-CN.yml +8 -36
  115. data/config/locales/zh-TW.yml +10 -36
  116. data/db/migrate/20190315203056_add_session_token_to_decidim_forms_answers.rb +1 -1
  117. data/db/migrate/20250314150250_rename_answer_to_response_in_decidim_forms.rb +30 -0
  118. data/db/migrate/20250319130003_change_question_types_in_questions.rb +14 -0
  119. data/lib/decidim/api/question_matrix_row_type.rb +13 -0
  120. data/lib/decidim/api/question_type.rb +4 -3
  121. data/lib/decidim/api/questionnaire_type.rb +1 -0
  122. data/lib/decidim/api/response_option_type.rb +13 -0
  123. data/lib/decidim/exporters/form_pdf.rb +35 -43
  124. data/lib/decidim/forms/api.rb +2 -1
  125. data/lib/decidim/forms/{download_your_data_user_answers_serializer.rb → download_your_data_user_responses_serializer.rb} +3 -3
  126. data/lib/decidim/forms/engine.rb +2 -2
  127. data/lib/decidim/forms/test/factories.rb +24 -24
  128. data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +178 -176
  129. data/lib/decidim/forms/test/shared_examples/manage_questionnaire_responses.rb +159 -0
  130. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +19 -19
  131. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +44 -90
  132. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +10 -10
  133. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +43 -140
  134. data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +4 -6
  135. data/lib/decidim/forms/test.rb +1 -1
  136. data/lib/decidim/forms/user_responses_serializer.rb +110 -0
  137. data/lib/decidim/forms/version.rb +1 -1
  138. data/lib/decidim/forms.rb +2 -2
  139. metadata +48 -46
  140. data/app/cells/decidim/forms/answer_readonly_cell.rb +0 -9
  141. data/app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb +0 -30
  142. data/app/models/decidim/forms/answer_choice.rb +0 -22
  143. data/app/presenters/decidim/forms/admin/questionnaire_answer_presenter.rb +0 -112
  144. data/app/queries/decidim/forms/questionnaire_user_answers.rb +0 -32
  145. data/app/views/decidim/forms/admin/questionnaires/_answer_option.html.erb +0 -45
  146. data/app/views/decidim/forms/admin/questionnaires/_answer_option_template.html.erb +0 -7
  147. data/app/views/decidim/forms/admin/questionnaires/answers/index.html.erb +0 -49
  148. data/app/views/decidim/forms/admin/questionnaires/answers/show.html.erb +0 -43
  149. data/app/views/decidim/forms/questionnaires/_answer.html.erb +0 -60
  150. data/app/views/decidim/forms/questionnaires/answers/_files.html.erb +0 -1
  151. data/app/views/decidim/forms/questionnaires/answers/_long_answer.html.erb +0 -3
  152. data/app/views/decidim/forms/questionnaires/answers/_multiple_option.html.erb +0 -25
  153. data/app/views/decidim/forms/questionnaires/answers/_separator.html.erb +0 -1
  154. data/app/views/decidim/forms/questionnaires/answers/_short_answer.html.erb +0 -3
  155. data/app/views/decidim/forms/questionnaires/answers/_single_option.html.erb +0 -32
  156. data/app/views/decidim/forms/questionnaires/answers/_sorting.html.erb +0 -26
  157. data/app/views/decidim/forms/questionnaires/answers/_title_and_description.html.erb +0 -1
  158. data/lib/decidim/api/answer_option_type.rb +0 -13
  159. data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +0 -149
  160. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/draggable_behavior.rb +0 -47
  161. data/lib/decidim/forms/user_answers_serializer.rb +0 -105
  162. /data/app/cells/decidim/forms/{answer_readonly → response_readonly}/show.erb +0 -0
@@ -1,40 +1,41 @@
1
- <div class="answer-questionnaire__multiple-matrix">
1
+ <div class="response-questionnaire__multiple-matrix">
2
2
  <table>
3
3
  <thead>
4
4
  <tr>
5
5
  <td></td>
6
- <% answer.question.answer_options.each_with_index do |answer_option, idx| %>
7
- <th><%= translated_attribute(answer_option.body) %></th>
6
+ <% response.question.response_options.each_with_index do |response_option, idx| %>
7
+ <th><%= translated_attribute(response_option.body) %></th>
8
8
  <% end %>
9
9
  </tr>
10
10
  </thead>
11
11
  <tbody>
12
- <% answer.question.matrix_rows.by_position.each_with_index do |row, row_idx| %>
12
+ <% response.question.matrix_rows.by_position.each_with_index do |row, row_idx| %>
13
13
  <tr class="js-check-box-collection">
14
14
  <td><%= translated_attribute row.body %></td>
15
- <% answer.question.answer_options.each_with_index do |answer_option, idx| %>
16
- <% choice = answer.selected_choices.find { |choice| choice.answer_option_id == answer_option.id && choice.matrix_row_id == row.id } %>
15
+ <% response.question.response_options.each_with_index do |response_option, idx| %>
16
+ <% choice = response.selected_choices.find { |choice| choice.response_option_id == response_option.id && choice.matrix_row_id == row.id } %>
17
17
  <% choice_id = "#{field_id}_matrix_row_#{row_idx}_choice_#{idx}" %>
18
18
  <td>
19
19
  <div class="js-collection-input">
20
- <%= check_box_tag "questionnaire[responses][#{answer_idx}][choices][][body]",
21
- translated_attribute(answer_option.body),
20
+ <%= check_box_tag "questionnaire[responses][#{response_idx}][choices][][body]",
21
+ translated_attribute(response_option.body),
22
22
  choice.present?,
23
- "aria-label": translated_attribute(answer_option.body),
23
+ "aria-label": translated_attribute(response_option.body),
24
24
  id: "#{choice_id}_body", disabled: %>
25
- <%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][][answer_option_id]",
26
- answer_option.id,
27
- id: "#{choice_id}_answer_option",
25
+ <%= hidden_field_tag "questionnaire[responses][#{response_idx}][choices][][response_option_id]",
26
+ response_option.id,
27
+ id: "#{choice_id}_response_option",
28
28
  disabled: true %>
29
- <%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][][matrix_row_id]",
29
+ <%= hidden_field_tag "questionnaire[responses][#{response_idx}][choices][][matrix_row_id]",
30
30
  row.id,
31
31
  id: "#{choice_id}_matrix_row",
32
32
  disabled: true %>
33
- <% if answer_option.free_text %>
34
- <%= text_field_tag "questionnaire[responses][#{answer_idx}][choices][][custom_body]",
33
+ <% if response_option.free_text %>
34
+ <%= text_field_tag "questionnaire[responses][#{response_idx}][choices][][custom_body]",
35
35
  choice.try(:custom_body),
36
36
  id: "#{choice_id}_custom_body",
37
37
  disabled: true,
38
+ data: { controller: "character-counter" },
38
39
  maxlength: %>
39
40
  <% end %>
40
41
  </div>
@@ -1,40 +1,41 @@
1
- <div class="answer-questionnaire__single-matrix">
1
+ <div class="response-questionnaire__single-matrix">
2
2
  <table>
3
3
  <thead>
4
4
  <tr>
5
5
  <td></td>
6
- <% answer.question.answer_options.each_with_index do |answer_option, idx| %>
7
- <th><%= translated_attribute(answer_option.body) %></th>
6
+ <% response.question.response_options.each_with_index do |response_option, idx| %>
7
+ <th><%= translated_attribute(response_option.body) %></th>
8
8
  <% end %>
9
9
  </tr>
10
10
  </thead>
11
11
  <tbody>
12
- <% answer.question.matrix_rows.by_position.each_with_index do |row, row_idx| %>
12
+ <% response.question.matrix_rows.by_position.each_with_index do |row, row_idx| %>
13
13
  <tr class="js-radio-button-collection">
14
14
  <td><%= translated_attribute row.body %></td>
15
- <% answer.question.answer_options.each_with_index do |answer_option, idx| %>
16
- <% choice = answer.choices.find { |choice| choice.answer_option_id == answer_option.id && choice.matrix_row_id == row.id } %>
15
+ <% response.question.response_options.each_with_index do |response_option, idx| %>
16
+ <% choice = response.choices.find { |choice| choice.response_option_id == response_option.id && choice.matrix_row_id == row.id } %>
17
17
  <% choice_id = "#{field_id}_matrix_row_#{row_idx}_choice_#{idx}" %>
18
18
  <td>
19
19
  <div class="js-collection-input">
20
- <%= radio_button_tag "questionnaire[responses][#{answer_idx}][choices][#{row_idx}][body]",
21
- translated_attribute(answer_option.body),
22
- answer_option.id == choice.try(:answer_option_id),
23
- "aria-label": translated_attribute(answer_option.body),
20
+ <%= radio_button_tag "questionnaire[responses][#{response_idx}][choices][#{row_idx}][body]",
21
+ translated_attribute(response_option.body),
22
+ response_option.id == choice.try(:response_option_id),
23
+ "aria-label": translated_attribute(response_option.body),
24
24
  id: "#{choice_id}_body", disabled: %>
25
- <%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][#{row_idx}][answer_option_id]",
26
- answer_option.id,
27
- id: "#{choice_id}_answer_option",
25
+ <%= hidden_field_tag "questionnaire[responses][#{response_idx}][choices][#{row_idx}][response_option_id]",
26
+ response_option.id,
27
+ id: "#{choice_id}_response_option",
28
28
  disabled: true %>
29
- <%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][#{row_idx}][matrix_row_id]",
29
+ <%= hidden_field_tag "questionnaire[responses][#{response_idx}][choices][#{row_idx}][matrix_row_id]",
30
30
  row.id,
31
31
  id: "#{choice_id}_matrix_row",
32
32
  disabled: true %>
33
- <% if answer_option.free_text %>
34
- <%= text_field_tag "questionnaire[responses][#{answer_idx}][choices][#{row_idx}][custom_body]",
33
+ <% if response_option.free_text %>
34
+ <%= text_field_tag "questionnaire[responses][#{response_idx}][choices][#{row_idx}][custom_body]",
35
35
  choice.try(:custom_body),
36
36
  id: "#{choice_id}_custom_body",
37
37
  disabled: true,
38
+ data: { controller: "character-counter" },
38
39
  maxlength: %>
39
40
  <% end %>
40
41
  </div>
@@ -0,0 +1,26 @@
1
+ <div class="response-questionnaire__single-option js-check-box-collection">
2
+ <% response.question.response_options.each_with_index do |response_option, idx| %>
3
+ <% choice = response.selected_choices.find { |choice| choice.response_option_id == response_option.id } %>
4
+
5
+ <div class="js-collection-input">
6
+ <%= label_tag do %>
7
+ <%= check_box_tag "questionnaire[responses][#{response_idx}][choices][#{idx}][body]",
8
+ translated_attribute(response_option.body),
9
+ choice.present?, disabled: %>
10
+
11
+ <%= translated_attribute(response_option.body) %>
12
+
13
+ <%= hidden_field_tag "questionnaire[responses][#{response_idx}][choices][#{idx}][response_option_id]", response_option.id %>
14
+ <% end %>
15
+
16
+ <% if response_option.free_text %>
17
+ <%= text_field_tag "questionnaire[responses][#{response_idx}][choices][#{idx}][custom_body]",
18
+ choice.try(:custom_body),
19
+ disabled: true,
20
+ data: { controller: "character-counter" },
21
+ maxlength:,
22
+ class: "w-full" %>
23
+ <% end %>
24
+ </div>
25
+ <% end %>
26
+ </div>
@@ -0,0 +1 @@
1
+ <%= response_form.hidden_field :body, value: "separator", id: field_id, disabled: %>
@@ -0,0 +1,3 @@
1
+ <div>
2
+ <%= response_form.text_field :body, label: false, id: field_id, disabled:, maxlength:, class: "w-full", required: false, data: { controller: "character-counter" } %>
3
+ </div>
@@ -0,0 +1,33 @@
1
+ <div class="response-questionnaire__single-option js-radio-button-collection">
2
+ <% choice = response.choices.first %>
3
+
4
+ <% response.question.response_options.each_with_index do |response_option, idx| %>
5
+ <% choice_id = "#{field_id}_choices_#{idx}" %>
6
+
7
+ <div class="js-collection-input">
8
+ <%= label_tag "#{choice_id}_body" do %>
9
+ <%= radio_button_tag "questionnaire[responses][#{response_idx}][choices][][body]",
10
+ translated_attribute(response_option.body),
11
+ response_option.id == choice.try(:response_option_id),
12
+ id: "#{choice_id}_body", disabled: %>
13
+
14
+ <%= translated_attribute(response_option.body) %>
15
+
16
+ <%= hidden_field_tag "questionnaire[responses][#{response_idx}][choices][][response_option_id]",
17
+ response_option.id,
18
+ id: "#{choice_id}_response_option",
19
+ disabled: true %>
20
+ <% end %>
21
+
22
+ <% if response_option.free_text %>
23
+ <%= text_field_tag "questionnaire[responses][#{response_idx}][choices][][custom_body]",
24
+ choice.try(:custom_body),
25
+ id: "#{choice_id}_custom_body",
26
+ disabled: true,
27
+ maxlength:,
28
+ data: { controller: "character-counter" },
29
+ class: "w-full" %>
30
+ <% end %>
31
+ </div>
32
+ <% end %>
33
+ </div>
@@ -0,0 +1,26 @@
1
+ <div class="response-questionnaire__sorting-container js-sortable-check-box-collection">
2
+ <%
3
+ # This is a block that aims to identify the order to the response questions, and if there is an user response, use that
4
+ # to order the date that needs to be displayed. It is done like this to help with edit user response form
5
+ %>
6
+ <% ordering = response.question.response_options.pluck(:id) %>
7
+ <% if response.selected_choices.present? %>
8
+ <% ordering = response.selected_choices.map(&:response_option_id) %>
9
+ <% end %>
10
+
11
+ <% ids_for_order = ordering.map.with_index { |id, index| "#{id}=#{index + 1}" }.join(", ") %>
12
+
13
+ <% response.question.reload.response_options.reorder(Arel.sql("POSITION(id::text in '#{ids_for_order}')")).each_with_index do |response_option, idx| %>
14
+ <% choice = response.selected_choices.find { |choice| choice.response_option_id == response_option.id } %>
15
+
16
+ <div class="response-questionnaire__sorting js-collection-input" role="button">
17
+ <%= translated_attribute(response_option.body) %>
18
+
19
+ <%= icon "drag-move-2-line" %>
20
+
21
+ <%= hidden_field_tag "questionnaire[responses][#{response_idx}][choices][#{idx}][position]", choice.try(:position) %>
22
+ <%= hidden_field_tag "questionnaire[responses][#{response_idx}][choices][#{idx}][body]", translated_attribute(response_option.body) %>
23
+ <%= hidden_field_tag "questionnaire[responses][#{response_idx}][choices][#{idx}][response_option_id]", response_option.id %>
24
+ </div>
25
+ <% end %>
26
+ </div>
@@ -0,0 +1 @@
1
+ <%= response_form.hidden_field :body, value: "title-and-description", id: field_id, disabled: %>
@@ -29,17 +29,17 @@
29
29
  <% end %>
30
30
 
31
31
  <section>
32
- <% if allow_answers? %>
33
- <% if visitor_can_answer? %>
34
- <% if visitor_already_answered? %>
35
- <% if visitor_can_edit_answers? && current_component.manifest_name == "surveys" %>
36
- <% body = t("decidim.forms.questionnaires.show.questionnaire_answered_edit.body",
37
- link: link_to(t("decidim.forms.questionnaires.show.questionnaire_answered_edit.edit"), edit_survey_path(questionnaire_for))
32
+ <% if allow_responses? %>
33
+ <% if visitor_can_respond? %>
34
+ <% if visitor_already_responded? %>
35
+ <% if visitor_can_edit_responses? && current_component.manifest_name == "surveys" %>
36
+ <% body = t("decidim.forms.questionnaires.show.questionnaire_responded_edit.body",
37
+ link: link_to(t("decidim.forms.questionnaires.show.questionnaire_responded_edit.edit"), edit_survey_path(questionnaire_for))
38
38
  ) %>
39
39
  <% else %>
40
- <% body = t("decidim.forms.questionnaires.show.questionnaire_answered.body") %>
40
+ <% body = t("decidim.forms.questionnaires.show.questionnaire_responded.body") %>
41
41
  <% end %>
42
- <%= cell("decidim/announcement", { title: t("decidim.forms.questionnaires.show.questionnaire_answered.title"), body: body }) %>
42
+ <%= cell("decidim/announcement", { title: t("decidim.forms.questionnaires.show.questionnaire_responded.title"), body: body }) %>
43
43
  <% else %>
44
44
  <% if @form.responses_by_step.flatten.empty? %>
45
45
  <%= cell("decidim/announcement", t("decidim.forms.questionnaires.show.empty")) %>
@@ -51,8 +51,8 @@
51
51
  <%= render partial: "decidim/forms/questionnaires/questionnaire_readonly" %>
52
52
  <% end %>
53
53
  <% else %>
54
- <% if questionnaire_for.class.name == "Decidim::Surveys::Survey" && show_published_questions_answers? %>
55
- <%= render partial: "decidim/surveys/surveys/published_questions_answers" %>
54
+ <% if questionnaire_for.class.name == "Decidim::Surveys::Survey" && show_published_questions_responses? %>
55
+ <%= render partial: "decidim/surveys/surveys/published_questions_responses" %>
56
56
  <% else %>
57
57
  <%= cell("decidim/announcement", { title: t("decidim.forms.questionnaires.show.questionnaire_closed.title"), body: t("decidim.forms.questionnaires.show.questionnaire_closed.body") }, callout_class: "warning") %>
58
58
  <% end %>
data/config/assets.rb CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  base_path = File.expand_path("..", __dir__)
4
4
 
5
- Decidim::Webpacker.register_path("#{base_path}/app/packs")
6
- Decidim::Webpacker.register_entrypoints(
5
+ Decidim::Shakapacker.register_path("#{base_path}/app/packs")
6
+ Decidim::Shakapacker.register_entrypoints(
7
7
  decidim_forms: "#{base_path}/app/packs/entrypoints/decidim_forms.js",
8
8
  decidim_forms_admin: "#{base_path}/app/packs/entrypoints/decidim_forms_admin.js"
9
9
  )
@@ -2,8 +2,6 @@
2
2
  ar:
3
3
  activemodel:
4
4
  attributes:
5
- answer:
6
- body: إجابة
7
5
  question:
8
6
  max_choices: أقصى عدد من الخيارات
9
7
  question_type: نوع
@@ -17,10 +15,6 @@ ar:
17
15
  description: وصف
18
16
  tos: شروط الخدمة
19
17
  questionnaires:
20
- answer_option:
21
- answer_option: خيار الإجابة
22
- remove: إزالة
23
- statement: بيان
24
18
  display_condition:
25
19
  condition_question: سؤال
26
20
  remove: حذف
@@ -32,36 +26,26 @@ ar:
32
26
  remove: إزالة
33
27
  statement: بيان
34
28
  question:
35
- add_answer_option: إضافة خيار الإجابة
36
29
  any: أي
37
30
  description: وصف
31
+ down: أسفل
38
32
  question: سؤال
39
33
  remove: إزالة
40
34
  statement: بيان
35
+ up: فوق
41
36
  title_and_description:
42
37
  description: الوصف
43
38
  update:
44
39
  invalid: كانت هناك مشكلة في حفظ النموذج.
45
40
  question_types:
46
- long_answer: اجابة طويلة
47
41
  multiple_option: خيار متعدد
48
- short_answer: اجابة قصيرة
49
42
  single_option: خيار واحد
50
43
  sorting: فرز
51
44
  questionnaires:
52
- answer:
53
- invalid: كانت هناك مشكلة في الإجابة على النموذج.
54
- success: نموذج أجاب بنجاح.
55
45
  question:
56
46
  max_choices: 'خيارات ماكس: %{n}'
57
47
  show:
58
- answer_questionnaire:
59
- title: أجب عن النموذج
60
- questionnaire_answered:
61
- body: لقد أجبت بالفعل على هذا النموذج.
62
- title: تمت الاجابة مسبقا
63
48
  questionnaire_closed:
64
- body: النموذج مغلق ولا يمكن الرد عليه.
65
49
  title: شكل مغلق
66
50
  questionnaire_for_private_users:
67
51
  body: النموذج متاح فقط للمستخدمين من القطاع الخاص
@@ -70,7 +54,3 @@ ar:
70
54
  step_navigation:
71
55
  show:
72
56
  submit: خضع
73
- user_answers_serializer:
74
- created_at: أجاب على
75
- id: معرف الإجابة
76
- question: سؤال
@@ -2,8 +2,6 @@
2
2
  bg:
3
3
  activemodel:
4
4
  attributes:
5
- answer:
6
- body: Отговор
7
5
  question:
8
6
  max_choices: Максимален брой възможности
9
7
  question_type: Тип
@@ -19,35 +17,19 @@ bg:
19
17
  tos: Условия за ползване
20
18
  questionnaires:
21
19
  actions:
22
- show: Показване на отговорите
23
- answer_option:
24
- answer_option: Възможност за отговор
25
- remove: Премахни
26
- statement: Изявление
27
- answers:
28
- actions:
29
- show: Показване на отговорите
30
- empty: Все още няма отговори
31
- export_response:
32
- title: survey_user_answers_%{token}
33
- show:
34
- title: 'Отговор № %{number}'
20
+ back: Назад към въпросите
35
21
  display_condition:
36
- answer_option: Възможност за отговор
37
22
  condition_question: Въпрос
38
23
  condition_type: Условие
39
24
  condition_types:
40
- answered: Отговорено
41
25
  equal: Равно
42
26
  match: Включва текст
43
- not_answered: Неотговорено
44
27
  not_equal: Не е равно
45
28
  condition_value: Включен текст
46
29
  display_condition: Условие за показване
47
30
  mandatory: Това условие винаги трябва да бъде удовлетворено, независимо от състоянието на другите условия
48
31
  remove: Премахни
49
32
  save_warning: Не забравяйте да запазите формуляра, преди да конфигурирате условията за показване
50
- select_answer_option: Изберете вариант за отговор
51
33
  select_condition_question: Изберете въпрос
52
34
  select_condition_type: Изберете тип условие
53
35
  edit:
@@ -64,27 +46,35 @@ bg:
64
46
  remove: Премахни
65
47
  statement: Изявление
66
48
  question:
67
- add_answer_option: Добавяне на възможност за отговор
68
49
  add_display_condition: Добавяне на условие за показване
69
50
  add_display_condition_info: Запазете формуляра, за да конфигурирате условията за показване
70
51
  add_matrix_row: Добавяне на ред
71
52
  any: Някой
72
53
  collapse: Свий
73
54
  description: Описание
55
+ down: Надолу
74
56
  expand: Разтваряне
75
57
  question: Въпрос
76
58
  remove: Премахни
77
59
  statement: Изявление
60
+ up: Горе
61
+ responses:
62
+ actions:
63
+ show: Показване на отговорите
78
64
  separator:
65
+ down: Долу
79
66
  remove: Премахни
80
67
  separator: Разделител
68
+ up: Горе
81
69
  title_and_description:
82
70
  collapse: Свий
83
71
  description: Описание
72
+ down: Долу
84
73
  expand: Разтваряне
85
74
  remove: Премахни
86
75
  title: Заглавие
87
76
  title_and_description: Заглавие и описание
77
+ up: Горе
88
78
  update:
89
79
  invalid: Възникна проблем при запазването на формуляра.
90
80
  success: Формулярите бяха запазени успешно.
@@ -98,31 +88,20 @@ bg:
98
88
  resize_to_fit: Това изображение ще бъде преоразмерено и уплътнено до %{dimensions}.
99
89
  question_types:
100
90
  files: Файлове
101
- long_answer: Дълъг отговор
102
91
  matrix_multiple: Матрица (множество опции)
103
92
  matrix_single: Матрица (единична опция)
104
93
  multiple_option: Множество опции
105
- short_answer: Кратък отговор
106
94
  single_option: Единична опция
107
95
  sorting: Сортиране
108
96
  title_and_description: Заглавие и описание
109
97
  questionnaires:
110
- answer:
111
- invalid: Възникна проблем при попълването на отговорите във формуляра.
112
- success: Отговорите са попълнени успешно във формуляра.
113
98
  question:
114
99
  max_choices: 'Максимален брой избрани варианти: %{n}'
115
100
  show:
116
- answer_questionnaire:
117
- title: Попълване на отговори във формуляра
118
101
  current_step: Стъпка %{step}
119
102
  empty: Все още няма конфигурирани въпроси за този формуляр.
120
103
  of_total_steps: от %{total_steps}
121
- questionnaire_answered:
122
- body: Вече сте попълнили отговорите в този формуляр.
123
- title: Вече сте отговорили
124
104
  questionnaire_closed:
125
- body: Формулярът е затворен и не можете да попълните отговорите си.
126
105
  title: Формулярът е затворен
127
106
  questionnaire_for_private_users:
128
107
  body: Формулярът е налице само за частни потребители
@@ -138,8 +117,3 @@ bg:
138
117
  back: Назад
139
118
  continue: Продължи
140
119
  submit: Изпрати
141
- user_answers_serializer:
142
- body: Отговор
143
- created_at: Отговорено на
144
- id: ID на отговора
145
- question: Въпрос