decidim-forms 0.26.0 → 0.27.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. checksums.yaml +4 -4
  2. data/app/commands/decidim/forms/admin/update_questionnaire.rb +13 -8
  3. data/app/commands/decidim/forms/answer_questionnaire.rb +3 -3
  4. data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +2 -2
  5. data/app/forms/decidim/forms/admin/display_condition_form.rb +3 -3
  6. data/app/forms/decidim/forms/answer_form.rb +4 -0
  7. data/app/models/decidim/forms/answer.rb +2 -2
  8. data/app/models/decidim/forms/display_condition.rb +1 -1
  9. data/app/models/decidim/forms/questionnaire.rb +7 -0
  10. data/app/presenters/decidim/forms/admin/questionnaire_answer_presenter.rb +10 -2
  11. data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +5 -3
  12. data/app/presenters/decidim/forms/admin_log/questionnaire_presenter.rb +35 -0
  13. data/app/queries/decidim/forms/questionnaire_participant.rb +1 -1
  14. data/app/queries/decidim/forms/questionnaire_participants.rb +1 -1
  15. data/app/queries/decidim/forms/questionnaire_user_answers.rb +1 -1
  16. data/app/views/decidim/forms/questionnaires/_answer.html.erb +3 -1
  17. data/app/views/decidim/forms/questionnaires/show.html.erb +11 -9
  18. data/config/locales/am-ET.yml +1 -0
  19. data/config/locales/ar.yml +7 -0
  20. data/config/locales/bg.yml +1 -0
  21. data/config/locales/ca.yml +6 -3
  22. data/config/locales/cs.yml +6 -3
  23. data/config/locales/da.yml +1 -0
  24. data/config/locales/de.yml +12 -4
  25. data/config/locales/el.yml +1 -4
  26. data/config/locales/en.yml +5 -3
  27. data/config/locales/eo.yml +1 -0
  28. data/config/locales/es-MX.yml +6 -3
  29. data/config/locales/es-PY.yml +6 -3
  30. data/config/locales/es.yml +6 -3
  31. data/config/locales/et.yml +1 -0
  32. data/config/locales/eu.yml +1 -4
  33. data/config/locales/fi-plain.yml +6 -3
  34. data/config/locales/fi.yml +6 -3
  35. data/config/locales/fr-CA.yml +3 -3
  36. data/config/locales/fr.yml +3 -3
  37. data/config/locales/ga-IE.yml +1 -0
  38. data/config/locales/gl.yml +5 -0
  39. data/config/locales/hr.yml +1 -0
  40. data/config/locales/hu.yml +4 -0
  41. data/config/locales/id-ID.yml +1 -0
  42. data/config/locales/is-IS.yml +2 -1
  43. data/config/locales/it.yml +1 -4
  44. data/config/locales/ja.yml +6 -3
  45. data/config/locales/ko.yml +1 -0
  46. data/config/locales/lb.yml +1 -4
  47. data/config/locales/lt.yml +1 -0
  48. data/config/locales/lv.yml +1 -4
  49. data/config/locales/mt.yml +1 -0
  50. data/config/locales/nl.yml +1 -4
  51. data/config/locales/no.yml +1 -4
  52. data/config/locales/om-ET.yml +1 -0
  53. data/config/locales/pl.yml +1 -4
  54. data/config/locales/pt-BR.yml +2 -5
  55. data/config/locales/pt.yml +1 -4
  56. data/config/locales/ro-RO.yml +1 -4
  57. data/config/locales/ru.yml +1 -0
  58. data/config/locales/si-LK.yml +1 -0
  59. data/config/locales/sk.yml +1 -0
  60. data/config/locales/sl.yml +1 -0
  61. data/config/locales/so-SO.yml +1 -0
  62. data/config/locales/sr-CS.yml +1 -0
  63. data/config/locales/sv.yml +1 -4
  64. data/config/locales/sw-KE.yml +1 -0
  65. data/config/locales/ti-ER.yml +1 -0
  66. data/config/locales/tr-TR.yml +1 -4
  67. data/config/locales/uk.yml +1 -0
  68. data/config/locales/val-ES.yml +1 -0
  69. data/config/locales/vi.yml +1 -0
  70. data/config/locales/zh-CN.yml +1 -4
  71. data/config/locales/zh-TW.yml +1 -0
  72. data/lib/decidim/exporters/form_pdf.rb +2 -2
  73. data/lib/decidim/forms/{data_portability_user_answers_serializer.rb → download_your_data_user_answers_serializer.rb} +2 -2
  74. data/lib/decidim/forms/test/factories.rb +22 -13
  75. data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +3 -0
  76. data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +2 -2
  77. data/lib/decidim/forms/user_answers_serializer.rb +2 -2
  78. data/lib/decidim/forms/version.rb +1 -1
  79. data/lib/decidim/forms.rb +1 -1
  80. metadata +14 -13
@@ -1,3 +1,4 @@
1
+ ---
1
2
  es:
2
3
  activemodel:
3
4
  attributes:
@@ -121,6 +122,9 @@ es:
121
122
  update:
122
123
  invalid: Se ha producido un error al guardar el formulario.
123
124
  success: Formulario guardado correctamente.
125
+ admin_log:
126
+ questionnaire:
127
+ update: "%{user_name} actualizó el cuestionario %{resource_name}"
124
128
  errors:
125
129
  answer:
126
130
  body: El campo no puede estar en blanco
@@ -128,10 +132,9 @@ es:
128
132
  extension_allowlist: 'Formatos de archivo aceptados:'
129
133
  images:
130
134
  dimensions: "%{width} x %{height} px"
131
- dimensions_info: 'Esta imagen medirá:'
132
135
  processors:
133
- resize_and_pad: Redimensionada y ajustada a
134
- resize_to_fit: Redimensionada para ajustarla
136
+ resize_and_pad: Esta imagen será redimensionada y ajustada a %{dimensions}.
137
+ resize_to_fit: Esta imagen será redimensionada para ajustarse a %{dimensions}.
135
138
  question_types:
136
139
  files: Archivos
137
140
  long_answer: Respuesta larga
@@ -1 +1,2 @@
1
+ ---
1
2
  et:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  eu:
2
3
  activemodel:
3
4
  attributes:
@@ -118,10 +119,6 @@ eu:
118
119
  extension_allowlist: 'Onartutako formatuak:'
119
120
  images:
120
121
  dimensions: "%{width} x %{height} px"
121
- dimensions_info: 'Irudi honek neurtuko du:'
122
- processors:
123
- resize_and_pad: Birdimentsionatua eta honi egokitua
124
- resize_to_fit: Birdimentsionatua egokitzeko
125
122
  question_types:
126
123
  files: Fitxategiak
127
124
  long_answer: Erantzun luzea
@@ -1,3 +1,4 @@
1
+ ---
1
2
  fi-pl:
2
3
  activemodel:
3
4
  attributes:
@@ -121,6 +122,9 @@ fi-pl:
121
122
  update:
122
123
  invalid: Kyselylomakkeiden tallentamisessa on tapahtunut virheitä.
123
124
  success: Lomake tallennettu onnistuneesti.
125
+ admin_log:
126
+ questionnaire:
127
+ update: "%{user_name} päivitti kyselyä %{resource_name}"
124
128
  errors:
125
129
  answer:
126
130
  body: Runkoteksti ei voi olla tyhjä
@@ -128,10 +132,9 @@ fi-pl:
128
132
  extension_allowlist: 'Sallitut tiedostopäätteet:'
129
133
  images:
130
134
  dimensions: "%{width} x %{height} pikseliä"
131
- dimensions_info: 'Tämän kuvan koko tulee olemaan:'
132
135
  processors:
133
- resize_and_pad: Muutetaan kokoon ja täytetään
134
- resize_to_fit: Muutetaan mahtumaan kokoon
136
+ resize_and_pad: Kuvan kokoa muutetaan ja rajataan arvoon %{dimensions}.
137
+ resize_to_fit: Tämä kuva muutetaan kokoon %{dimensions} sopivaksi.
135
138
  question_types:
136
139
  files: Tiedostot
137
140
  long_answer: Pitkä vastaus
@@ -1,3 +1,4 @@
1
+ ---
1
2
  fi:
2
3
  activemodel:
3
4
  attributes:
@@ -121,6 +122,9 @@ fi:
121
122
  update:
122
123
  invalid: Kyselylomakkeen tallentaminen epäonnistui.
123
124
  success: Lomake tallennettu onnistuneesti.
125
+ admin_log:
126
+ questionnaire:
127
+ update: "%{user_name} päivitti kyselyä %{resource_name}"
124
128
  errors:
125
129
  answer:
126
130
  body: Runkoteksti ei voi olla tyhjä
@@ -128,10 +132,9 @@ fi:
128
132
  extension_allowlist: 'Sallitut tiedostopäätteet:'
129
133
  images:
130
134
  dimensions: "%{width} x %{height} pikseliä"
131
- dimensions_info: 'Tämän kuvan koko tulee olemaan:'
132
135
  processors:
133
- resize_and_pad: Muutetaan kokoon ja täytetään
134
- resize_to_fit: Muutetaan mahtumaan kokoon
136
+ resize_and_pad: Kuvan kokoa muutetaan ja rajataan arvoon %{dimensions}.
137
+ resize_to_fit: Tämä kuva muutetaan kokoon %{dimensions} sopivaksi.
135
138
  question_types:
136
139
  files: Tiedostot
137
140
  long_answer: Pitkä vastaus
@@ -1,3 +1,4 @@
1
+ ---
1
2
  fr-CA:
2
3
  activemodel:
3
4
  attributes:
@@ -128,10 +129,9 @@ fr-CA:
128
129
  extension_allowlist: 'Formats acceptés :'
129
130
  images:
130
131
  dimensions: "%{width} x %{height} px"
131
- dimensions_info: 'Cette image sera :'
132
132
  processors:
133
- resize_and_pad: Redimensionné et ajustée à
134
- resize_to_fit: Redimensionnée pour s'adapter
133
+ resize_and_pad: Cette image sera redimensionnée et recadrée en %{dimensions}.
134
+ resize_to_fit: Cette image sera redimensionnée pour s'adapter à %{dimensions}.
135
135
  question_types:
136
136
  files: Fichiers
137
137
  long_answer: Longue réponse
@@ -1,3 +1,4 @@
1
+ ---
1
2
  fr:
2
3
  activemodel:
3
4
  attributes:
@@ -128,10 +129,9 @@ fr:
128
129
  extension_allowlist: 'Formats acceptés :'
129
130
  images:
130
131
  dimensions: "%{width} x %{height} px"
131
- dimensions_info: 'Cette image sera :'
132
132
  processors:
133
- resize_and_pad: Redimensionné et ajustée à
134
- resize_to_fit: Redimensionnée pour s'adapter
133
+ resize_and_pad: Cette image sera redimensionnée et recadrée en %{dimensions}.
134
+ resize_to_fit: Cette image sera redimensionnée pour s'adapter à %{dimensions}.
135
135
  question_types:
136
136
  files: Fichiers
137
137
  long_answer: Longue réponse
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ga:
2
3
  activemodel:
3
4
  attributes:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  gl:
2
3
  activemodel:
3
4
  attributes:
@@ -62,6 +63,10 @@ gl:
62
63
  body: O corpo non pode estar en branco
63
64
  files:
64
65
  extension_allowlist: 'Formatos aceptados:'
66
+ images:
67
+ processors:
68
+ resize_and_pad: A imaxe axustarase para se encadrar a %{dimensions}.
69
+ resize_to_fit: A imaxe axustarase para se adaptar a %{dimensions}.
65
70
  question_types:
66
71
  long_answer: Resposta longa
67
72
  multiple_option: Múltipla opción
@@ -1 +1,2 @@
1
+ ---
1
2
  hr:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  hu:
2
3
  activemodel:
3
4
  attributes:
@@ -68,6 +69,9 @@ hu:
68
69
  body: A szövegtörzs nem lehet üres
69
70
  files:
70
71
  extension_allowlist: 'Elfogadott formátumok:'
72
+ images:
73
+ processors:
74
+ resize_to_fit: 'A kép át lesz méretezve erre a méretre: %{dimensions}.'
71
75
  question_types:
72
76
  long_answer: Hosszú válasz
73
77
  multiple_option: Több választási lehetőség
@@ -1,3 +1,4 @@
1
+ ---
1
2
  id:
2
3
  activemodel:
3
4
  attributes:
@@ -1 +1,2 @@
1
- is-IS:
1
+ ---
2
+ is:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  it:
2
3
  activemodel:
3
4
  attributes:
@@ -118,10 +119,6 @@ it:
118
119
  extension_allowlist: 'Formati accettati:'
119
120
  images:
120
121
  dimensions: "%{width} x %{height} px"
121
- dimensions_info: 'Questa immagine sarà:'
122
- processors:
123
- resize_and_pad: Ridimensionato e spaziato a
124
- resize_to_fit: Ridimensionato per adattarsi
125
122
  question_types:
126
123
  files: I file
127
124
  long_answer: Risposta lunga
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ja:
2
3
  activemodel:
3
4
  attributes:
@@ -121,6 +122,9 @@ ja:
121
122
  update:
122
123
  invalid: フォームの保存に失敗しました。
123
124
  success: フォームを保存しました。
125
+ admin_log:
126
+ questionnaire:
127
+ update: "%{user_name} が %{resource_name} アンケートを更新しました"
124
128
  errors:
125
129
  answer:
126
130
  body: 本文は空白にできません
@@ -128,10 +132,9 @@ ja:
128
132
  extension_allowlist: '承認されたフォーマット:'
129
133
  images:
130
134
  dimensions: "%{width} x %{height} px"
131
- dimensions_info: 'この画像は次のようになります:'
132
135
  processors:
133
- resize_and_pad: リサイズおよびパッド先
134
- resize_to_fit: フィットするようにリサイズしました
136
+ resize_and_pad: この画像はリサイズされ、 %{dimensions} に合わされます。
137
+ resize_to_fit: この画像は %{dimensions} に合うようにリサイズされます。
135
138
  question_types:
136
139
  files: ファイル
137
140
  long_answer: 長い回答
@@ -1 +1,2 @@
1
+ ---
1
2
  ko:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  lb:
2
3
  activemodel:
3
4
  attributes:
@@ -118,10 +119,6 @@ lb:
118
119
  extension_allowlist: 'Gültige Formate:'
119
120
  images:
120
121
  dimensions: "%{width} x %{height} px"
121
- dimensions_info: 'Das Bild wird:'
122
- processors:
123
- resize_and_pad: in der Größe angepasst und gepolstert zu
124
- resize_to_fit: in der Größe verändert, damit es passt
125
122
  question_types:
126
123
  files: Dateien
127
124
  long_answer: Lange Antwort
@@ -1 +1,2 @@
1
+ ---
1
2
  lt:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  lv:
2
3
  activemodel:
3
4
  attributes:
@@ -69,10 +70,6 @@ lv:
69
70
  extension_allowlist: 'Pieņemtie formāti:'
70
71
  images:
71
72
  dimensions: "%{width} x %{height} pikseļi"
72
- dimensions_info: 'Attēlam būs:'
73
- processors:
74
- resize_and_pad: Mainīts lielums un izveidota robeža
75
- resize_to_fit: Mainīts, lai ietilptu
76
73
  question_types:
77
74
  long_answer: Garā atbilde
78
75
  matrix_multiple: Matrica (vairāki varianti)
@@ -1 +1,2 @@
1
+ ---
1
2
  mt:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  nl:
2
3
  activemodel:
3
4
  attributes:
@@ -122,10 +123,6 @@ nl:
122
123
  extension_allowlist: 'Geaccepteerde formaten:'
123
124
  images:
124
125
  dimensions: "%{width} x %{height} px"
125
- dimensions_info: 'Deze afbeelding zal zijn:'
126
- processors:
127
- resize_and_pad: Verkleind en verwijderd naar
128
- resize_to_fit: Vergrootst naar pasvorm
129
126
  question_types:
130
127
  long_answer: Lang antwoord
131
128
  matrix_multiple: Matrix (meerdere opties)
@@ -1,3 +1,4 @@
1
+ ---
1
2
  "no":
2
3
  activemodel:
3
4
  attributes:
@@ -128,10 +129,6 @@
128
129
  extension_allowlist: 'Aksepterte formater:'
129
130
  images:
130
131
  dimensions: "%{width} x %{height} px"
131
- dimensions_info: 'Dette bildet vil være:'
132
- processors:
133
- resize_and_pad: Endret størrelse og avstand til
134
- resize_to_fit: Endret størrelse for å passe
135
132
  question_types:
136
133
  files: Filer
137
134
  long_answer: Langt svar
@@ -1 +1,2 @@
1
+ ---
1
2
  om:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  pl:
2
3
  activemodel:
3
4
  attributes:
@@ -118,10 +119,6 @@ pl:
118
119
  extension_allowlist: 'Dozwolone formaty:'
119
120
  images:
120
121
  dimensions: "%{width} × %{height} px"
121
- dimensions_info: 'Rozmiar obrazu będzie wynosił:'
122
- processors:
123
- resize_and_pad: Zmieniony i dopełniony do
124
- resize_to_fit: Dopasowany
125
122
  question_types:
126
123
  files: Pliki
127
124
  long_answer: Długa odpowiedź
@@ -1,4 +1,5 @@
1
- pt-BR:
1
+ ---
2
+ pt:
2
3
  activemodel:
3
4
  attributes:
4
5
  answer:
@@ -118,10 +119,6 @@ pt-BR:
118
119
  extension_allowlist: 'Formatos aceitos:'
119
120
  images:
120
121
  dimensions: "%{width} x %{height} px"
121
- dimensions_info: 'Esta imagem será:'
122
- processors:
123
- resize_and_pad: Redimensionado e acolchoado para
124
- resize_to_fit: Redimensionado para caber
125
122
  question_types:
126
123
  files: Arquivos
127
124
  long_answer: Resposta longa
@@ -1,3 +1,4 @@
1
+ ---
1
2
  pt:
2
3
  activemodel:
3
4
  attributes:
@@ -118,10 +119,6 @@ pt:
118
119
  extension_allowlist: 'Formatos aceites:'
119
120
  images:
120
121
  dimensions: "%{width} x %{height} px"
121
- dimensions_info: 'Esta imagem será:'
122
- processors:
123
- resize_and_pad: Redimensionada e ajustada para
124
- resize_to_fit: Redimensionada para caber
125
122
  question_types:
126
123
  files: Ficheiros
127
124
  long_answer: Resposta longa
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ro:
2
3
  activemodel:
3
4
  attributes:
@@ -128,10 +129,6 @@ ro:
128
129
  extension_allowlist: 'Formate acceptate:'
129
130
  images:
130
131
  dimensions: "%{width} x %{height} px"
131
- dimensions_info: 'Această imagine va fi:'
132
- processors:
133
- resize_and_pad: Redimensionat și padded la
134
- resize_to_fit: Redimensionată pentru a se potrivi
135
132
  question_types:
136
133
  files: Fișiere
137
134
  long_answer: Răspuns lung
@@ -1,3 +1,4 @@
1
+ ---
1
2
  ru:
2
3
  decidim:
3
4
  forms:
@@ -1 +1,2 @@
1
+ ---
1
2
  si:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  sk:
2
3
  activemodel:
3
4
  attributes:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  sl:
2
3
  activemodel:
3
4
  attributes:
@@ -1 +1,2 @@
1
+ ---
1
2
  so:
@@ -1 +1,2 @@
1
+ ---
1
2
  sr:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  sv:
2
3
  activemodel:
3
4
  attributes:
@@ -128,10 +129,6 @@ sv:
128
129
  extension_allowlist: 'Godkända format:'
129
130
  images:
130
131
  dimensions: "%{width} x %{height} px"
131
- dimensions_info: 'Denna bild kommer att vara:'
132
- processors:
133
- resize_and_pad: Anpassad och vadderad till
134
- resize_to_fit: Anpassad för att passa
135
132
  question_types:
136
133
  files: Filer
137
134
  long_answer: Långt svar
@@ -1 +1,2 @@
1
+ ---
1
2
  sw:
@@ -1 +1,2 @@
1
+ ---
1
2
  ti:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  tr:
2
3
  activemodel:
3
4
  attributes:
@@ -113,10 +114,6 @@ tr:
113
114
  extension_allowlist: 'Kabul edilen biçimler:'
114
115
  images:
115
116
  dimensions: "%{width} x %{height} px"
116
- dimensions_info: 'Bu resim:'
117
- processors:
118
- resize_and_pad: Yeniden boyutlandırıldı ve dolduruldu
119
- resize_to_fit: Sığacak şekilde yeniden boyutlandırıldı
120
117
  question_types:
121
118
  long_answer: Uzun cevap
122
119
  matrix_multiple: Matris (Çoklu seçenek)
@@ -1 +1,2 @@
1
+ ---
1
2
  uk:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  val:
2
3
  decidim:
3
4
  forms:
@@ -1 +1,2 @@
1
+ ---
1
2
  vi:
@@ -1,3 +1,4 @@
1
+ ---
1
2
  zh-CN:
2
3
  activemodel:
3
4
  attributes:
@@ -112,10 +113,6 @@ zh-CN:
112
113
  extension_allowlist: '接受的格式:'
113
114
  images:
114
115
  dimensions: "%{width} x %{height} px"
115
- dimensions_info: '这张图片将是:'
116
- processors:
117
- resize_and_pad: 缩放并填充到
118
- resize_to_fit: 调整到适合的
119
116
  question_types:
120
117
  long_answer: 长答案
121
118
  matrix_multiple: 矩阵(多选项)
@@ -1 +1,2 @@
1
+ ---
1
2
  zh-TW:
@@ -15,11 +15,11 @@ module Decidim
15
15
  end
16
16
 
17
17
  def template
18
- "decidim/forms/admin/questionnaires/answers/export/pdf.html.erb"
18
+ "decidim/forms/admin/questionnaires/answers/export/pdf"
19
19
  end
20
20
 
21
21
  def layout
22
- "decidim/forms/admin/questionnaires/questionnaire_answers.html.erb"
22
+ "decidim/forms/admin/questionnaires/questionnaire_answers"
23
23
  end
24
24
 
25
25
  def locals
@@ -2,9 +2,9 @@
2
2
 
3
3
  module Decidim
4
4
  module Forms
5
- class DataPortabilityUserAnswersSerializer < Decidim::Exporters::Serializer
5
+ class DownloadYourDataUserAnswersSerializer < Decidim::Exporters::Serializer
6
6
  include Decidim::TranslationsHelper
7
- # Serializes an user answer for data portability
7
+ # Serializes an user answer for download your data
8
8
  def serialize
9
9
  {
10
10
  id: resource.id,
@@ -29,38 +29,47 @@ FactoryBot.define do
29
29
  end
30
30
 
31
31
  trait :with_all_questions do
32
- questions do
32
+ after(:build) do |questionaire, _evaluator|
33
33
  position = 0
34
- qs = %w(short_answer long_answer).collect do |text_question_type|
35
- q = build(:questionnaire_question, question_type: text_question_type, position: position)
34
+ %w(short_answer long_answer).collect do |text_question_type|
35
+ q = create(:questionnaire_question,
36
+ question_type: text_question_type,
37
+ position: position,
38
+ questionnaire: questionaire)
36
39
  position += 1
37
- q
40
+ questionaire.questions << q
38
41
  end
39
42
 
40
43
  %w(single_option multiple_option).each do |option_question_type|
41
- q = build(:questionnaire_question, :with_answer_options, question_type: option_question_type, position: position)
42
- position += 1
43
- qs << q
44
+ q = create(:questionnaire_question, :with_answer_options,
45
+ question_type: option_question_type,
46
+ position: position,
47
+ questionnaire: questionaire)
44
48
  q.display_conditions.build(
45
- condition_question: qs[q.position - 2],
49
+ condition_question: questionaire.questions[q.position - 1],
46
50
  question: q,
47
51
  condition_type: :answered,
48
52
  mandatory: true
49
53
  )
54
+ questionaire.questions << q
55
+ position += 1
50
56
  end
51
57
 
52
58
  %w(matrix_single matrix_multiple).collect do |matrix_question_type|
53
- q = build(:questionnaire_question, :with_answer_options, question_type: matrix_question_type, position: position, body: generate_localized_title)
54
- position += 1
55
- qs << q
59
+ q = build(:questionnaire_question, :with_answer_options,
60
+ question_type: matrix_question_type,
61
+ position: position,
62
+ body: generate_localized_title,
63
+ questionnaire: questionaire)
56
64
  q.display_conditions.build(
57
- condition_question: qs[q.position - 2],
65
+ condition_question: questionaire.questions[q.position - 1],
58
66
  question: q,
59
67
  condition_type: :answered,
60
68
  mandatory: true
61
69
  )
70
+ questionaire.questions << q
71
+ position += 1
62
72
  end
63
- qs
64
73
  end
65
74
  end
66
75
 
@@ -241,6 +241,9 @@ shared_examples_for "has questionnaire" do
241
241
 
242
242
  it "shows errors without submitting the form" do
243
243
  expect(page).to have_no_selector ".alert.flash"
244
+ different_error = I18n.t("decidim.forms.questionnaires.answer.max_choices_alert")
245
+ expect(different_error).to eq("There are too many choices selected")
246
+ expect(page).not_to have_content(different_error)
244
247
 
245
248
  expect(page).to have_content("can't be blank")
246
249
  end
@@ -344,11 +344,11 @@ shared_examples_for "update questions" do
344
344
  end
345
345
 
346
346
  context "when a questionnaire has multiple existing questions" do
347
- let!(:question_1) do
347
+ let!(:question1) do
348
348
  create(:questionnaire_question, questionnaire: questionnaire, body: first_body, position: 0)
349
349
  end
350
350
 
351
- let!(:question_2) do
351
+ let!(:question2) do
352
352
  create(:questionnaire_question, questionnaire: questionnaire, body: second_body, position: 1)
353
353
  end
354
354
 
@@ -79,7 +79,7 @@ module Decidim
79
79
  end
80
80
 
81
81
  def normalize_matrix_choices(answer, choices)
82
- answer.question.matrix_rows.map do |matrix_row|
82
+ answer.question.matrix_rows.to_h do |matrix_row|
83
83
  row_body = translated_attribute(matrix_row.body)
84
84
 
85
85
  row_choices = answer.question.answer_options.map do |answer_option|
@@ -88,7 +88,7 @@ module Decidim
88
88
  end
89
89
 
90
90
  [row_body, row_choices]
91
- end.to_h
91
+ end
92
92
  end
93
93
 
94
94
  def answer_translated_attribute_name(attribute)
@@ -4,7 +4,7 @@ module Decidim
4
4
  # This holds the decidim-forms version.
5
5
  module Forms
6
6
  def self.version
7
- "0.26.0"
7
+ "0.27.0.rc1"
8
8
  end
9
9
  end
10
10
  end
data/lib/decidim/forms.rb CHANGED
@@ -9,7 +9,7 @@ module Decidim
9
9
  # This namespace holds the logic of the `Forms`.
10
10
  module Forms
11
11
  autoload :UserAnswersSerializer, "decidim/forms/user_answers_serializer"
12
- autoload :DataPortabilityUserAnswersSerializer, "decidim/forms/data_portability_user_answers_serializer"
12
+ autoload :DownloadYourDataUserAnswersSerializer, "decidim/forms/download_your_data_user_answers_serializer"
13
13
  end
14
14
 
15
15
  module Exporters