decidim-forms 0.16.1 → 0.17.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 (39) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/decidim_forms_manifest.css +3 -0
  3. data/app/assets/stylesheets/decidim/forms/forms.scss +37 -0
  4. data/app/cells/decidim/forms/answer_readonly/show.erb +3 -0
  5. data/app/cells/decidim/forms/answer_readonly_cell.rb +9 -0
  6. data/app/cells/decidim/forms/question_readonly/show.erb +15 -0
  7. data/app/cells/decidim/forms/question_readonly_cell.rb +9 -0
  8. data/app/forms/decidim/forms/admin/answer_option_form.rb +3 -1
  9. data/app/forms/decidim/forms/admin/question_form.rb +3 -1
  10. data/app/views/decidim/forms/questionnaires/_answer.html.erb +1 -1
  11. data/app/views/decidim/forms/questionnaires/show.html.erb +4 -0
  12. data/config/locales/ar-SA.yml +20 -0
  13. data/config/locales/ca.yml +15 -12
  14. data/config/locales/cs.yml +82 -0
  15. data/config/locales/de.yml +3 -0
  16. data/config/locales/en.yml +16 -12
  17. data/config/locales/es-MX.yml +3 -0
  18. data/config/locales/es-PY.yml +3 -0
  19. data/config/locales/es.yml +15 -12
  20. data/config/locales/eu.yml +3 -0
  21. data/config/locales/fi-plain.yml +82 -0
  22. data/config/locales/fi.yml +13 -10
  23. data/config/locales/fr.yml +3 -0
  24. data/config/locales/gl.yml +3 -0
  25. data/config/locales/hu.yml +3 -0
  26. data/config/locales/id-ID.yml +20 -0
  27. data/config/locales/it.yml +3 -0
  28. data/config/locales/nl.yml +3 -0
  29. data/config/locales/pl.yml +3 -0
  30. data/config/locales/pt-BR.yml +3 -0
  31. data/config/locales/pt.yml +3 -0
  32. data/config/locales/sv.yml +3 -0
  33. data/config/locales/tr-TR.yml +15 -12
  34. data/lib/decidim/forms/engine.rb +5 -1
  35. data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +16 -12
  36. data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +1 -1
  37. data/lib/decidim/forms/user_answers_serializer.rb +9 -1
  38. data/lib/decidim/forms/version.rb +1 -1
  39. metadata +16 -8
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dfc852138be38454c86dc60667c513505d19a01916bc30fcd797acf1e1b45fbe
4
- data.tar.gz: b960749e226aa14299f9151a76e0264f615891f3eb6d8c937097d82e8240d45d
3
+ metadata.gz: 7d81ecefd5a170425406afb4b1e9012970f1149750f5dc1e71520b12f550f667
4
+ data.tar.gz: 37cb9ccc0e7cc64f7cd45062e90e3c882a5aa3c5bc85159787221c223949a80a
5
5
  SHA512:
6
- metadata.gz: 25efb8c847f1e661b53f39fd929eb0d14cb18cd6cacfb4b25ac27c7bba51ff5a7c2b6f1a4dc112f1d4e86564540bb8c666b806c9e50a1eaf14b9278291530f0d
7
- data.tar.gz: 97c68527f8943eb0de125f385ea0db758a23b2fadcff3ade3b723c763609f41de90fd5b59f019ca7287ea3a5a012487e30bc790f8477035d8cc988b0950e0f2a
6
+ metadata.gz: 0f746e69717ed7aadc2bd29f867cf6cbe209c70e076e2b8d5473d1cc32a73ad73a8cf5b63f59222fb01f12de4fd9e16972bdbc64a25c64375a18e609ac4ee0c8
7
+ data.tar.gz: '086519491a2c72ab2a8715aead24ba985f470db18683e65d61b7a1089d30923aff48c58922075c217fbde04e166d4a15b985803384416c04e3478efe45d92660'
@@ -0,0 +1,3 @@
1
+ /*
2
+ *= link decidim/forms/forms.scss
3
+ */
@@ -0,0 +1,37 @@
1
+ .questionnaire-question_readonly{
2
+ font-weight: bold;
3
+ font-size: .875rem;
4
+
5
+ p{
6
+ margin-bottom: .5rem;
7
+ }
8
+
9
+ em{
10
+ font-weight: normal;
11
+ font-size: 90%;
12
+ }
13
+
14
+ p + ul{
15
+ margin-top: -.5rem;
16
+ }
17
+ }
18
+
19
+ .questionnaire-question_readonly-answers{
20
+ margin-bottom: .5rem;
21
+
22
+ &.single_option{
23
+ list-style-type: disc;
24
+ }
25
+
26
+ &.multiple_option{
27
+ list-style-type: square;
28
+ }
29
+
30
+ &.sorting{
31
+ list-style-type: circle;
32
+ }
33
+ }
34
+
35
+ .questionnaire-question_readonly-answer{
36
+ font-weight: normal;
37
+ }
@@ -0,0 +1,3 @@
1
+ <li class="questionnaire-question_readonly-answer">
2
+ <%= translated_attribute(model.body) %>
3
+ </li>
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Forms
5
+ # This cell renders a possible answer of a question (readonly)
6
+ class AnswerReadonlyCell < Decidim::ViewModel
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ <li class="questionnaire-question_readonly">
2
+ <p>
3
+ <%= translated_attribute(model.body) %>
4
+ <br />
5
+ <em>
6
+ (<%= t(model.question_type, scope: "decidim.forms.question_types") %>)
7
+ </em>
8
+ </p>
9
+
10
+ <% if model.multiple_choice? %>
11
+ <ul class="questionnaire-question_readonly-answers <%= model.question_type %>">
12
+ <%= cell("decidim/forms/answer_readonly", collection: model.answer_options) %>
13
+ </ul>
14
+ <% end %>
15
+ </li>
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Forms
5
+ # This cell renders a question (readonly) of a questionnaire
6
+ class QuestionReadonlyCell < Decidim::ViewModel
7
+ end
8
+ end
9
+ end
@@ -15,7 +15,9 @@ module Decidim
15
15
  validates :body, translatable_presence: true, unless: :deleted
16
16
 
17
17
  def to_param
18
- id || "questionnaire-question-answer-option-id"
18
+ return id if id.present?
19
+
20
+ "questionnaire-question-answer-option-id"
19
21
  end
20
22
  end
21
23
  end
@@ -23,7 +23,9 @@ module Decidim
23
23
  validates :body, translatable_presence: true, unless: :deleted
24
24
 
25
25
  def to_param
26
- id || "questionnaire-question-id"
26
+ return id if id.present?
27
+
28
+ "questionnaire-question-id"
27
29
  end
28
30
 
29
31
  def number_of_options
@@ -22,7 +22,7 @@
22
22
  <%= label_tag "#{choice_id}_body" do %>
23
23
  <%= radio_button_tag "questionnaire[answers][#{answer_idx}][choices][][body]",
24
24
  translated_attribute(answer_option.body),
25
- choice.try(:body),
25
+ answer_option.id == choice.try(:answer_option_id),
26
26
  id: "#{choice_id}_body", disabled: disabled %>
27
27
 
28
28
  <%= translated_attribute(answer_option.body) %>
@@ -66,6 +66,10 @@
66
66
  <p>
67
67
  <%= t(".answer_questionnaire.anonymous_user_message", sign_in_link: decidim.new_user_session_path, sign_up_link: decidim.new_user_registration_path).html_safe %>
68
68
  </p>
69
+
70
+ <ol>
71
+ <%= cell("decidim/forms/question_readonly", collection: @questionnaire.questions) %>
72
+ </ol>
69
73
  </div>
70
74
  <% end %>
71
75
  <% else %>
@@ -33,6 +33,7 @@ ar:
33
33
  title: عنوان
34
34
  form:
35
35
  add_question: أضف سؤال
36
+ already_answered_warning: تمت الإجابة على النموذج من قبل بعض المستخدمين حتى لا تتمكن من تعديل أسئلته.
36
37
  question:
37
38
  add_answer_option: إضافة خيار الإجابة
38
39
  any: أي
@@ -42,6 +43,9 @@ ar:
42
43
  remove: إزالة
43
44
  statement: بيان
44
45
  up: فوق
46
+ update:
47
+ invalid: كانت هناك مشكلة في حفظ النموذج.
48
+ success: تم حفظ النماذج بنجاح.
45
49
  errors:
46
50
  answer:
47
51
  body: لا يمكن أن يكون الجسم فارغًا
@@ -52,11 +56,27 @@ ar:
52
56
  single_option: خيار واحد
53
57
  sorting: فرز
54
58
  questionnaires:
59
+ answer:
60
+ invalid: كانت هناك مشكلة في الإجابة على النموذج.
61
+ success: نموذج أجاب بنجاح.
55
62
  question:
56
63
  max_choices: 'خيارات ماكس: %{n}'
57
64
  show:
65
+ answer_questionnaire:
66
+ anonymous_user_message: <a href="%{sign_in_link}">قم بتسجيل الدخول بحسابك</a> أو <a href="%{sign_up_link}">اشترك</a> للإجابة على النموذج
67
+ title: أجب عن النموذج
58
68
  are_you_sure: لا يمكن التراجع عن هذا الإجراء ولن تتمكن من تعديل إجاباتك. هل أنت واثق؟
59
69
  questionnaire_answered:
70
+ body: لقد أجبت بالفعل على هذا النموذج.
60
71
  title: تمت الاجابة مسبقا
72
+ questionnaire_closed:
73
+ body: النموذج مغلق ولا يمكن الرد عليه.
74
+ title: شكل مغلق
75
+ questionnaire_for_private_users:
76
+ body: النموذج متاح فقط للمستخدمين من القطاع الخاص
77
+ title: شكل مغلق
61
78
  submit: خضع
62
79
  tos_agreement: من خلال المشاركة ، فإنك تقبل شروط الخدمة
80
+ user_answers_serializer:
81
+ created_at: أجاب على
82
+ id: معرف الإجابة
@@ -33,7 +33,7 @@ ca:
33
33
  title: Títol
34
34
  form:
35
35
  add_question: Afegeix una pregunta
36
- already_answered_warning: No pots modificar les pregunte d'aquest qüestionari perquè ja ha estat contestat per alguns usuaris.
36
+ already_answered_warning: No pots modificar les preguntes d'aquest formulari perquè ja ha estat contestat per algunes participants.
37
37
  question:
38
38
  add_answer_option: Afegeix una opció de resposta
39
39
  any: Cap
@@ -44,8 +44,8 @@ ca:
44
44
  statement: Declaració
45
45
  up: Pujar
46
46
  update:
47
- invalid: S'han produït alguns errors en desar el qüestionari.
48
- success: Els qüestionaris s'han desat correctament.
47
+ invalid: S'han produït un error en desar el formulari.
48
+ success: Els formularis s'han desat correctament.
49
49
  errors:
50
50
  answer:
51
51
  body: El camp no pot estar en blanc
@@ -57,23 +57,26 @@ ca:
57
57
  sorting: Ordenació
58
58
  questionnaires:
59
59
  answer:
60
- invalid: S'han produït errors en respondre el qüestionari.
61
- success: El qüestionari ha estat respost amb èxit.
60
+ invalid: S'han produït un error en respondre el formulari.
61
+ success: El formulari ha estat respost correctament.
62
62
  question:
63
63
  max_choices: 'Opcions màximes: %{n}'
64
64
  show:
65
65
  answer_questionnaire:
66
- anonymous_user_message: <a href="%{sign_in_link}">Inicia sessió amb el teu compte</a> o <a href="%{sign_up_link}">registra't</a> per respondre el qüestionari.
67
- title: Respon el qüestionari
66
+ anonymous_user_message: <a href="%{sign_in_link}">Inicia sessió amb el teu compte</a> o <a href="%{sign_up_link}">registra't</a> per respondre el formulari.
67
+ title: Respon el formulari
68
68
  are_you_sure: Aquesta acció no es pot desfer i no podràs editar les teves respostes. Estàs segur?
69
69
  questionnaire_answered:
70
- body: Ja has respost a aquest qüestionari.
70
+ body: Ja has respost a aquest formulari.
71
71
  title: Ja has respost
72
72
  questionnaire_closed:
73
- body: El qüestionari està tancat i no es pot respondre.
74
- title: S'ha tancat el qüestionari
73
+ body: El formulari està tancat i no es pot respondre.
74
+ title: S'ha tancat el formulari
75
75
  questionnaire_for_private_users:
76
- body: El qüestionari només està disponible per a usuaris privats
77
- title: S'ha tancat el qüestionari
76
+ body: El formulari només està disponible per a participants privades
77
+ title: S'ha tancat el formulari
78
78
  submit: Enviar respostes
79
79
  tos_agreement: En participar, acceptes els Termes i condicions d'ús
80
+ user_answers_serializer:
81
+ created_at: Respost el
82
+ id: Identificador de resposta
@@ -0,0 +1,82 @@
1
+ cs:
2
+ activemodel:
3
+ attributes:
4
+ answer:
5
+ body: Odpovědět
6
+ question:
7
+ max_choices: Maximální počet možností
8
+ question_type: Typ
9
+ questionnaire_question:
10
+ mandatory: Povinné
11
+ errors:
12
+ models:
13
+ answer:
14
+ attributes:
15
+ choices:
16
+ missing: nejsou úplné
17
+ too_many: jsou příliš mnoho
18
+ decidim:
19
+ forms:
20
+ admin:
21
+ models:
22
+ components:
23
+ description: Popis
24
+ tos: Podmínky služby
25
+ questionnaires:
26
+ answer_option:
27
+ answer_option: Možnost odpovědi
28
+ free_text: Volný text
29
+ remove: Odstranit
30
+ statement: Prohlášení
31
+ edit:
32
+ save: Uložit
33
+ title: Titul
34
+ form:
35
+ add_question: Přidat otázku
36
+ already_answered_warning: Dotazník již odpověděli někteří uživatelé, takže nemusíte upravovat své dotazy.
37
+ question:
38
+ add_answer_option: Přidat možnost odpovědi
39
+ any: Žádný
40
+ description: Popis
41
+ down: Dolů
42
+ question: Otázka
43
+ remove: Odstranit
44
+ statement: Prohlášení
45
+ up: Nahoru
46
+ update:
47
+ invalid: Při ukládání dotazníku došlo k chybám.
48
+ success: Dotazníky byly úspěšně uloženy.
49
+ errors:
50
+ answer:
51
+ body: Tělo nemůže být prázdné
52
+ question_types:
53
+ long_answer: Dlouhá odpověď
54
+ multiple_option: Více možností
55
+ short_answer: Stručná odpověď
56
+ single_option: Jedna možnost
57
+ sorting: Třídění
58
+ questionnaires:
59
+ answer:
60
+ invalid: Při odpovědi na dotazník došlo k chybám.
61
+ success: Dotazník úspěšně odpověděl.
62
+ question:
63
+ max_choices: 'Max možnosti: %{n}'
64
+ show:
65
+ answer_questionnaire:
66
+ anonymous_user_message: <a href="%{sign_in_link}">Přihlaste se svým účtem</a> nebo <a href="%{sign_up_link}">zaregistrujte</a> abyste odpověděli na dotazník.
67
+ title: Odpovězte na dotazník
68
+ are_you_sure: Tato akce nemůže být odvolána a vaše odpovědi nebudete moci upravovat. Jsi si jistá?
69
+ questionnaire_answered:
70
+ body: Již jste odpověděli na tento dotazník.
71
+ title: Již jste odpověděli
72
+ questionnaire_closed:
73
+ body: Dotazník je uzavřen a nelze jej zodpovědět.
74
+ title: Dotazník byl uzavřen
75
+ questionnaire_for_private_users:
76
+ body: Dotazník je k dispozici pouze pro soukromé uživatele
77
+ title: Dotazník byl uzavřen
78
+ submit: Předložit
79
+ tos_agreement: Účastí přijímáte jeho smluvní podmínky
80
+ user_answers_serializer:
81
+ created_at: Zodpovězeno
82
+ id: ID odpovědi
@@ -77,3 +77,6 @@ de:
77
77
  title: Fragebogen geschlossen
78
78
  submit: einreichen
79
79
  tos_agreement: Mit der Teilnahme stimmen Sie den Nutzungsbedingungen zu
80
+ user_answers_serializer:
81
+ created_at: Beantwortet am
82
+ id: ID beantworten
@@ -1,3 +1,4 @@
1
+ ---
1
2
  en:
2
3
  activemodel:
3
4
  attributes:
@@ -33,7 +34,7 @@ en:
33
34
  title: Title
34
35
  form:
35
36
  add_question: Add question
36
- already_answered_warning: The questionnaire is already answered by some users so you cannot modify its questions.
37
+ already_answered_warning: The form is already answered by some users so you cannot modify its questions.
37
38
  question:
38
39
  add_answer_option: Add answer option
39
40
  any: Any
@@ -44,8 +45,8 @@ en:
44
45
  statement: Statement
45
46
  up: Up
46
47
  update:
47
- invalid: There's been errors when saving the questionnaire.
48
- success: Questionnaires saved successfully.
48
+ invalid: There was a problem saving the form.
49
+ success: Forms successfully saved.
49
50
  errors:
50
51
  answer:
51
52
  body: Body can't be blank
@@ -57,23 +58,26 @@ en:
57
58
  sorting: Sorting
58
59
  questionnaires:
59
60
  answer:
60
- invalid: There's been errors when answering the questionnaire.
61
- success: Questionnaire answered successfully.
61
+ invalid: There was a problem answering the form.
62
+ success: Form successfully answered.
62
63
  question:
63
64
  max_choices: 'Max choices: %{n}'
64
65
  show:
65
66
  answer_questionnaire:
66
- anonymous_user_message: <a href="%{sign_in_link}">Sign in with your account</a> or <a href="%{sign_up_link}">sign up</a> to answer the questionnaire.
67
- title: Answer the questionnaire
67
+ anonymous_user_message: <a href="%{sign_in_link}">Sign in with your account</a> or <a href="%{sign_up_link}">sign up</a> to answer the form.
68
+ title: Answer the form
68
69
  are_you_sure: This action cannot be undone and you will not be able to edit your answers. Are you sure?
69
70
  questionnaire_answered:
70
- body: You have already answered this questionnaire.
71
+ body: You have already answered this form.
71
72
  title: Already answered
72
73
  questionnaire_closed:
73
- body: The questionnaire is closed and cannot be answered.
74
- title: Questionnaire closed
74
+ body: The form is closed and cannot be answered.
75
+ title: Form closed
75
76
  questionnaire_for_private_users:
76
- body: The questionnaire is available only for private users
77
- title: Questionnaire closed
77
+ body: The form is available only for private users
78
+ title: Form closed
78
79
  submit: Submit
79
80
  tos_agreement: By participating you accept its Terms of Service
81
+ user_answers_serializer:
82
+ created_at: Answered on
83
+ id: Answer ID
@@ -77,3 +77,6 @@ es-MX:
77
77
  title: Cuestionario cerrado
78
78
  submit: Enviar
79
79
  tos_agreement: Al responder aceptas los Términos y condiciones de uso
80
+ user_answers_serializer:
81
+ created_at: Respondido en
82
+ id: ID de respuesta
@@ -77,3 +77,6 @@ es-PY:
77
77
  title: Cuestionario cerrado
78
78
  submit: Enviar
79
79
  tos_agreement: Al responder aceptas los Términos y condiciones de uso
80
+ user_answers_serializer:
81
+ created_at: Respondido en
82
+ id: ID de respuesta
@@ -33,7 +33,7 @@ es:
33
33
  title: Título
34
34
  form:
35
35
  add_question: Añadir pregunta
36
- already_answered_warning: Algunos usuarios ya han respondido al cuestionario, por lo que no puedes modificar las preguntas.
36
+ already_answered_warning: Algunas participantes ya han respondido el formulario, por lo que no puedes modificar las preguntas.
37
37
  question:
38
38
  add_answer_option: Añadir opción de respuesta
39
39
  any: Alguna
@@ -44,8 +44,8 @@ es:
44
44
  statement: Declaración
45
45
  up: Arriba
46
46
  update:
47
- invalid: Ha habido errores al guardar el cuestionario.
48
- success: Cuestionarios guardados con éxito.
47
+ invalid: Se ha producido un error al guardar el formulario.
48
+ success: Formularios guardados correctamente.
49
49
  errors:
50
50
  answer:
51
51
  body: El campo no puede estar en blanco
@@ -57,23 +57,26 @@ es:
57
57
  sorting: Ordenación
58
58
  questionnaires:
59
59
  answer:
60
- invalid: Ha habido errores al responder al cuestionario.
61
- success: Has respondido al cuestionario con éxito.
60
+ invalid: Se ha producido un error al responder el formulario.
61
+ success: Has respondido al formulario correctamente.
62
62
  question:
63
63
  max_choices: 'Opciones máximas: %{n}'
64
64
  show:
65
65
  answer_questionnaire:
66
- anonymous_user_message: <a href="%{sign_in_link}">Inicia sesión con tu cuenta</a> o <a href="%{sign_up_link}">regístrese</a> para responder al cuestionario.
67
- title: Responde al cuestionario
66
+ anonymous_user_message: <a href="%{sign_in_link}">Inicia sesión con tu cuenta</a> o <a href="%{sign_up_link}">regístrate</a> para responder al formulario.
67
+ title: Responde el formulario
68
68
  are_you_sure: Esta acción no se puede deshacer y no podrás editar tus respuestas. ¿Estás seguro?
69
69
  questionnaire_answered:
70
- body: Ya has respondido este cuestionario.
70
+ body: Ya has respondido este formulario.
71
71
  title: Ya has respondido
72
72
  questionnaire_closed:
73
- body: El cuestionario está cerrado y ya no puedes responder.
74
- title: Cuestionario cerrado
73
+ body: El formulario está cerrado y ya no puedes responder.
74
+ title: Formulario cerrado
75
75
  questionnaire_for_private_users:
76
- body: El cuestionario está disponible solo para usuarios privados
77
- title: Cuestionario cerrado
76
+ body: El formulario está disponible solo para participantes privadas
77
+ title: Formulario cerrado
78
78
  submit: Enviar
79
79
  tos_agreement: Al responder aceptas los Términos y condiciones de uso
80
+ user_answers_serializer:
81
+ created_at: Respondido en
82
+ id: ID de respuesta
@@ -77,3 +77,6 @@ eu:
77
77
  title: Galdeketa itxia
78
78
  submit: Bidali
79
79
  tos_agreement: Zerbitzu-baldintzak onartzen dituzunean parte hartuz
80
+ user_answers_serializer:
81
+ created_at: Erantzuna
82
+ id: Erantzun IDa
@@ -0,0 +1,82 @@
1
+ fi-pl:
2
+ activemodel:
3
+ attributes:
4
+ answer:
5
+ body: Vastaus
6
+ question:
7
+ max_choices: Valintojen enimmäismäärä
8
+ question_type: Tyyppi
9
+ questionnaire_question:
10
+ mandatory: Pakollinen
11
+ errors:
12
+ models:
13
+ answer:
14
+ attributes:
15
+ choices:
16
+ missing: ovat puutteellisia
17
+ too_many: liian monta
18
+ decidim:
19
+ forms:
20
+ admin:
21
+ models:
22
+ components:
23
+ description: Kuvaus
24
+ tos: Käyttöehdot
25
+ questionnaires:
26
+ answer_option:
27
+ answer_option: Vastausvaihtoehto
28
+ free_text: Vapaa teksti
29
+ remove: Poista
30
+ statement: Selite
31
+ edit:
32
+ save: Tallenna
33
+ title: Otsikko
34
+ form:
35
+ add_question: Lisää kysymys
36
+ already_answered_warning: Jotkut käyttäjät ovat jo vastanneet kyselyyn, joten et voi muokata kysymyksiä.
37
+ question:
38
+ add_answer_option: Lisää vastausvaihtoehto
39
+ any: Minkä tahansa
40
+ description: Kuvaus
41
+ down: Alas
42
+ question: Kysymys
43
+ remove: Poista
44
+ statement: Selite
45
+ up: Ylös
46
+ update:
47
+ invalid: Kyselylomakkeiden tallentamisessa on tapahtunut virheitä.
48
+ success: Kyselylomakkeet tallennettiin onnistuneesti.
49
+ errors:
50
+ answer:
51
+ body: Runkoteksti ei voi olla tyhjä
52
+ question_types:
53
+ long_answer: Pitkä vastaus
54
+ multiple_option: Useita vaihtoehtoja
55
+ short_answer: Lyhyt vastaus
56
+ single_option: Yksi vaihtoehto
57
+ sorting: Järjestäminen
58
+ questionnaires:
59
+ answer:
60
+ invalid: Kyselylomakkeeseen vastatessa tapahtui virheitä.
61
+ success: Kyselyyn vastattu onnistuneesti.
62
+ question:
63
+ max_choices: 'Valintojen maksimimäärä: %{n}'
64
+ show:
65
+ answer_questionnaire:
66
+ anonymous_user_message: <a href="%{sign_in_link}">Kirjaudu sisään tililläsi</a> tai <a href="%{sign_up_link}">rekisteröidy</a> vastataksesi kyselyyn.
67
+ title: Vastaa kyselyyn
68
+ are_you_sure: Tätä toimintoa ei voi kumota, etkä voi muokata vastauksiasi. Oletko varma?
69
+ questionnaire_answered:
70
+ body: Olet jo vastannut tähän kyselyyn.
71
+ title: Olet jo vastannut
72
+ questionnaire_closed:
73
+ body: Kyselylomake on suljettu, eikä siihen voi vastata.
74
+ title: Kysely on suljettu
75
+ questionnaire_for_private_users:
76
+ body: Kyselylomake on saatavilla vain yksityisille käyttäjille
77
+ title: Kysely on suljettu
78
+ submit: Lähetä
79
+ tos_agreement: Osallistumalla hyväksyt käyttöehdot
80
+ user_answers_serializer:
81
+ created_at: Vastattu
82
+ id: Vastaa tunnus
@@ -33,7 +33,7 @@ fi:
33
33
  title: Otsikko
34
34
  form:
35
35
  add_question: Lisää kysymys
36
- already_answered_warning: Jotkut käyttäjät ovat jo vastanneet kyselyyn, joten et voi muokata kysymyksiä.
36
+ already_answered_warning: Jotkut käyttäjät ovat jo vastanneet tähän kyselylomakkeeseen, joten et voi enää muokata kysymyksiä.
37
37
  question:
38
38
  add_answer_option: Lisää vastausvaihtoehto
39
39
  any: Minkä tahansa
@@ -44,7 +44,7 @@ fi:
44
44
  statement: Selite
45
45
  up: Ylös
46
46
  update:
47
- invalid: Kyselylomakkeiden tallentamisessa on tapahtunut virheitä.
47
+ invalid: Kyselylomakkeen tallentaminen epäonnistui.
48
48
  success: Kyselylomakkeet tallennettiin onnistuneesti.
49
49
  errors:
50
50
  answer:
@@ -57,23 +57,26 @@ fi:
57
57
  sorting: Järjestäminen
58
58
  questionnaires:
59
59
  answer:
60
- invalid: Kyselylomakkeeseen vastatessa tapahtui virheitä.
61
- success: Kyselyyn vastattu onnistuneesti.
60
+ invalid: Kyselylomakkeeseen vastaaminen epäonnistui.
61
+ success: Kyselylomakkeeseen vastaaminen onnistui.
62
62
  question:
63
63
  max_choices: 'Valintojen maksimimäärä: %{n}'
64
64
  show:
65
65
  answer_questionnaire:
66
- anonymous_user_message: <a href="%{sign_in_link}">Kirjaudu sisään tililläsi</a> tai <a href="%{sign_up_link}">rekisteröidy</a> vastataksesi kyselyyn.
67
- title: Vastaa kyselyyn
66
+ anonymous_user_message: <a href="%{sign_in_link}">Kirjaudu sisään tililläsi</a> tai <a href="%{sign_up_link}">rekisteröidy</a> vastataksesi lomakkeeseen.
67
+ title: Vastaa kyselylomakkeeseen
68
68
  are_you_sure: Tätä toimintoa ei voi kumota, etkä voi muokata vastauksiasi. Oletko varma?
69
69
  questionnaire_answered:
70
- body: Olet jo vastannut tähän kyselyyn.
70
+ body: Olet jo vastannut tähän kyselylomakkeeseen.
71
71
  title: Olet jo vastannut
72
72
  questionnaire_closed:
73
73
  body: Kyselylomake on suljettu, eikä siihen voi vastata.
74
- title: Kysely on suljettu
74
+ title: Kyselylomake on suljettu
75
75
  questionnaire_for_private_users:
76
- body: Kyselylomake on saatavilla vain yksityisille käyttäjille
77
- title: Kysely on suljettu
76
+ body: Kyselylomake on nähtävillä vain yksityisille käyttäjille
77
+ title: Kyselylomake on suljettu
78
78
  submit: Lähetä
79
79
  tos_agreement: Osallistumalla hyväksyt käyttöehdot
80
+ user_answers_serializer:
81
+ created_at: Vastauksen ajankohta
82
+ id: Vastauksen ID
@@ -77,3 +77,6 @@ fr:
77
77
  title: Questionnaire fermé
78
78
  submit: Soumettre
79
79
  tos_agreement: En participant, vous acceptez ses conditions d'utilisation
80
+ user_answers_serializer:
81
+ created_at: Répondu le
82
+ id: ID de réponse
@@ -77,3 +77,6 @@ gl:
77
77
  title: Cuestionario pechado
78
78
  submit: Enviar
79
79
  tos_agreement: Ao participar aceptas as Condicións de servizo
80
+ user_answers_serializer:
81
+ created_at: Respondeu
82
+ id: ID de resposta
@@ -77,3 +77,6 @@ hu:
77
77
  title: A kérdőív lezárult
78
78
  submit: Beküldés
79
79
  tos_agreement: A részvétellel elfogadja az Általános Szerződési Feltételeket
80
+ user_answers_serializer:
81
+ created_at: Válaszolt
82
+ id: Válaszazonosító
@@ -33,6 +33,7 @@ id:
33
33
  title: Judul
34
34
  form:
35
35
  add_question: Tambahkan pertanyaan
36
+ already_answered_warning: Formulir sudah dijawab oleh beberapa pengguna sehingga Anda tidak dapat mengubah pertanyaannya.
36
37
  question:
37
38
  add_answer_option: Tambahkan opsi jawaban
38
39
  any: Apa saja
@@ -42,6 +43,9 @@ id:
42
43
  remove: Menghapus
43
44
  statement: Pernyataan
44
45
  up: Naik
46
+ update:
47
+ invalid: Terjadi masalah saat menyimpan formulir.
48
+ success: Formulir berhasil disimpan.
45
49
  errors:
46
50
  answer:
47
51
  body: Tubuh tidak boleh kosong
@@ -52,11 +56,27 @@ id:
52
56
  single_option: Opsi tunggal
53
57
  sorting: Penyortiran
54
58
  questionnaires:
59
+ answer:
60
+ invalid: Ada masalah saat menjawab formulir.
61
+ success: Formulir berhasil dijawab.
55
62
  question:
56
63
  max_choices: 'Pilihan maksimal: %{n}'
57
64
  show:
65
+ answer_questionnaire:
66
+ anonymous_user_message: <a href="%{sign_in_link}">Masuk dengan akun Anda</a> atau <a href="%{sign_up_link}">mendaftar</a> untuk menjawab formulir.
67
+ title: Jawab formulirnya
58
68
  are_you_sure: Tindakan ini tidak dapat diurungkan dan Anda tidak akan dapat mengedit jawaban Anda. Apakah kamu yakin
59
69
  questionnaire_answered:
70
+ body: Anda sudah menjawab formulir ini.
60
71
  title: Sudah dijawab
72
+ questionnaire_closed:
73
+ body: Formulir ditutup dan tidak dapat dijawab.
74
+ title: Formulir ditutup
75
+ questionnaire_for_private_users:
76
+ body: Formulir ini hanya tersedia untuk pengguna pribadi
77
+ title: Formulir ditutup
61
78
  submit: Menyerahkan
62
79
  tos_agreement: Dengan berpartisipasi Anda menerima Ketentuan Layanannya
80
+ user_answers_serializer:
81
+ created_at: Dijawab pada
82
+ id: ID jawaban
@@ -77,3 +77,6 @@ it:
77
77
  title: Questionario chiuso
78
78
  submit: Sottoscrivi
79
79
  tos_agreement: Partecipando accetti i suoi Termini di servizio
80
+ user_answers_serializer:
81
+ created_at: Risposto
82
+ id: ID risposta
@@ -77,3 +77,6 @@ nl:
77
77
  title: Vragenlijst gesloten
78
78
  submit: voorleggen
79
79
  tos_agreement: Door deel te nemen, gaat u akkoord met de Servicevoorwaarden
80
+ user_answers_serializer:
81
+ created_at: Beantwoord
82
+ id: Antwoord ID
@@ -77,3 +77,6 @@ pl:
77
77
  title: Ankieta została zamknięta
78
78
  submit: Zatwierdź
79
79
  tos_agreement: Biorąc udział w programie, akceptujesz jego Warunki korzystania z usługi
80
+ user_answers_serializer:
81
+ created_at: Odpowiedziałem na
82
+ id: ID odpowiedzi
@@ -77,3 +77,6 @@ pt-BR:
77
77
  title: Questionário fechado
78
78
  submit: Enviar
79
79
  tos_agreement: Ao participar você aceita seus Termos de Serviço
80
+ user_answers_serializer:
81
+ created_at: Respondido em
82
+ id: ID da resposta
@@ -77,3 +77,6 @@ pt:
77
77
  title: Questionário fechado
78
78
  submit: Enviar
79
79
  tos_agreement: Ao participar você aceita seus Termos de Serviço
80
+ user_answers_serializer:
81
+ created_at: Respondido em
82
+ id: ID da resposta
@@ -77,3 +77,6 @@ sv:
77
77
  title: Frågeformuläret stängt
78
78
  submit: Lämna
79
79
  tos_agreement: Genom att acceptera accepterar du användarvillkoren
80
+ user_answers_serializer:
81
+ created_at: Besvarat
82
+ id: Svar-ID
@@ -33,7 +33,7 @@ tr:
33
33
  title: Başlık
34
34
  form:
35
35
  add_question: Soru ekle
36
- already_answered_warning: Anket bazı kullanıcılar tarafından zaten yanıtlanmıştır, bu nedenden dolayı sorularını değiştiremezsiniz.
36
+ already_answered_warning: Form, bazı kullanıcılar tarafından zaten yanıtlandı, bu nedenle sorularını değiştiremezsiniz.
37
37
  question:
38
38
  add_answer_option: Cevap seçeneği ekle
39
39
  any: herhangi
@@ -44,8 +44,8 @@ tr:
44
44
  statement: Beyan
45
45
  up: yukarı
46
46
  update:
47
- invalid: Anketi kaydederken hatalar oluştu.
48
- success: Ayarlar başarıyla kaydedildi
47
+ invalid: Formu kaydederken bir sorun oluştu.
48
+ success: Formlar başarıyla kaydedildi.
49
49
  errors:
50
50
  answer:
51
51
  body: Vücut boş olamaz
@@ -57,23 +57,26 @@ tr:
57
57
  sorting: sınıflandırma
58
58
  questionnaires:
59
59
  answer:
60
- invalid: Anketi cevaplarken hatalar oldu.
61
- success: Anket başarıyla cevaplandı.
60
+ invalid: Formu yanıtlarken bir sorun oluştu.
61
+ success: Form başarıyla cevaplandı.
62
62
  question:
63
63
  max_choices: 'Maksimum seçenek: %{n}'
64
64
  show:
65
65
  answer_questionnaire:
66
- anonymous_user_message: Anketi cevaplamak için <a href="%{sign_in_link}">Hesabınızla giriş yapın</a>yada<a href="%{sign_up_link}">Kaydol</a>
67
- title: Anketi cevapla
66
+ anonymous_user_message: <a href="%{sign_in_link}">Formu yanıtlamak için</a> veya <a href="%{sign_up_link}">hesabınızla giriş yapın</a>.
67
+ title: Formu cevapla
68
68
  are_you_sure: Bu işlem geri alınamaz ve cevaplarınızı düzenleyemezsiniz. Emin misiniz?
69
69
  questionnaire_answered:
70
- body: Bu anketi zaten cevapladınız.
70
+ body: Bu formu zaten cevapladınız.
71
71
  title: Zaten cevaplandı
72
72
  questionnaire_closed:
73
- body: Anket kapandığı için cevaplayamazsınız.
74
- title: Anket kapatıldı
73
+ body: Form kapalı ve cevaplanamıyor.
74
+ title: Form kapatıldı
75
75
  questionnaire_for_private_users:
76
- body: Anket sadece özel kullanıcılar için kullanılabilir.
77
- title: Anket kapatıldı
76
+ body: Form yalnızca özel kullanıcılar tarafından kullanılabilir
77
+ title: Form kapatıldı
78
78
  submit: Gönder
79
79
  tos_agreement: Katılarak Hizmet Şartlarını kabul etmiş olursunuz.
80
+ user_answers_serializer:
81
+ created_at: Yanıtlandı
82
+ id: Cevap kimliği
@@ -6,8 +6,12 @@ module Decidim
6
6
  class Engine < ::Rails::Engine
7
7
  isolate_namespace Decidim::Forms
8
8
 
9
+ initializer "decidim_forms.add_cells_view_paths" do
10
+ Cell::ViewModel.view_paths << File.expand_path("#{Decidim::Forms::Engine.root}/app/cells")
11
+ end
12
+
9
13
  initializer "decidim_forms.assets" do |app|
10
- app.config.assets.precompile += %w(decidim_forms_manifest.js)
14
+ app.config.assets.precompile += %w(decidim_forms_manifest.js decidim_forms_manifest.css)
11
15
  end
12
16
  end
13
17
  end
@@ -10,9 +10,13 @@ shared_examples_for "has questionnaire" do
10
10
  expect(page).to have_i18n_content(questionnaire.title, upcase: true)
11
11
  expect(page).to have_i18n_content(questionnaire.description)
12
12
 
13
- expect(page).to have_no_i18n_content(question.body)
13
+ expect(page).not_to have_css(".form.answer-questionnaire")
14
+
15
+ within ".questionnaire-question_readonly" do
16
+ expect(page).to have_i18n_content(question.body)
17
+ end
14
18
 
15
- expect(page).to have_content("Sign in with your account or sign up to answer the questionnaire.")
19
+ expect(page).to have_content("Sign in with your account or sign up to answer the form.")
16
20
  end
17
21
  end
18
22
 
@@ -39,7 +43,7 @@ shared_examples_for "has questionnaire" do
39
43
 
40
44
  visit questionnaire_public_path
41
45
 
42
- expect(page).to have_content("You have already answered this questionnaire.")
46
+ expect(page).to have_content("You have already answered this form.")
43
47
  expect(page).to have_no_i18n_content(question.body)
44
48
  end
45
49
 
@@ -130,7 +134,7 @@ shared_examples_for "has questionnaire" do
130
134
 
131
135
  it "submits the form and shows errors" do
132
136
  within ".alert.flash" do
133
- expect(page).to have_content("error")
137
+ expect(page).to have_content("problem")
134
138
  end
135
139
 
136
140
  expect(page).to have_content("can't be blank")
@@ -176,7 +180,7 @@ shared_examples_for "has questionnaire" do
176
180
 
177
181
  it "submits the form and shows errors" do
178
182
  within ".alert.flash" do
179
- expect(page).to have_content("error")
183
+ expect(page).to have_content("problem")
180
184
  end
181
185
 
182
186
  expect(page).to have_content("can't be blank")
@@ -266,7 +270,7 @@ shared_examples_for "has questionnaire" do
266
270
  accept_confirm { click_button "Submit" }
267
271
 
268
272
  within ".alert.flash" do
269
- expect(page).to have_content("There's been errors when answering")
273
+ expect(page).to have_content("There was a problem answering")
270
274
  end
271
275
 
272
276
  expect(page).to have_field("questionnaire_answers_0_choices_2_custom_body", with: "Cacatua")
@@ -312,7 +316,7 @@ shared_examples_for "has questionnaire" do
312
316
  accept_confirm { click_button "Submit" }
313
317
 
314
318
  within ".alert.flash" do
315
- expect(page).to have_content("There's been errors when answering")
319
+ expect(page).to have_content("There was a problem answering")
316
320
  end
317
321
 
318
322
  expect(page).to have_field("questionnaire_answers_0_choices_2_custom_body", with: "Cacatua")
@@ -361,7 +365,7 @@ shared_examples_for "has questionnaire" do
361
365
 
362
366
  visit questionnaire_public_path
363
367
 
364
- expect(page).to have_content("You have already answered this questionnaire.")
368
+ expect(page).to have_content("You have already answered this form.")
365
369
  expect(page).to have_no_i18n_content(question.body)
366
370
  end
367
371
  end
@@ -390,7 +394,7 @@ shared_examples_for "has questionnaire" do
390
394
 
391
395
  visit questionnaire_public_path
392
396
 
393
- expect(page).to have_content("You have already answered this questionnaire.")
397
+ expect(page).to have_content("You have already answered this form.")
394
398
  expect(page).to have_no_i18n_content(question.body)
395
399
  end
396
400
 
@@ -410,7 +414,7 @@ shared_examples_for "has questionnaire" do
410
414
  accept_confirm { click_button "Submit" }
411
415
 
412
416
  within ".alert.flash" do
413
- expect(page).to have_content("There's been errors")
417
+ expect(page).to have_content("There was a problem answering")
414
418
  end
415
419
 
416
420
  expect(page).to have_content("are too many")
@@ -447,7 +451,7 @@ shared_examples_for "has questionnaire" do
447
451
 
448
452
  visit questionnaire_public_path
449
453
 
450
- expect(page).to have_content("You have already answered this questionnaire.")
454
+ expect(page).to have_content("You have already answered this form.")
451
455
  expect(page).to have_no_i18n_content(question.body)
452
456
  end
453
457
  end
@@ -514,7 +518,7 @@ shared_examples_for "has questionnaire" do
514
518
  accept_confirm { click_button "Submit" }
515
519
 
516
520
  within ".alert.flash" do
517
- expect(page).to have_content("error")
521
+ expect(page).to have_content("problem")
518
522
  end
519
523
 
520
524
  expect(page).to have_content("are not complete")
@@ -343,7 +343,7 @@ shared_examples_for "manage questionnaires" do
343
343
  click_button "Save"
344
344
  end
345
345
 
346
- expect(page).to have_admin_callout("There's been errors")
346
+ expect(page).to have_admin_callout("There was a problem saving")
347
347
  expect(page).to have_content("can't be blank", count: 3) # emtpy question, 2 empty default answer options
348
348
 
349
349
  expect(page).to have_selector("input[value='']")
@@ -15,7 +15,11 @@ module Decidim
15
15
  # Public: Exports a hash with the serialized data for the user answers.
16
16
  def serialize
17
17
  @answers.each_with_index.inject({}) do |serialized, (answer, idx)|
18
- serialized.update("#{idx + 1}. #{translated_attribute(answer.question.body)}" => normalize_body(answer))
18
+ serialized.update(
19
+ answer_translated_attribute_name(:id) => answer.id,
20
+ answer_translated_attribute_name(:created_at) => answer.created_at.to_s(:db),
21
+ "#{idx + 1}. #{translated_attribute(answer.question.body)}" => normalize_body(answer)
22
+ )
19
23
  end
20
24
  end
21
25
 
@@ -30,6 +34,10 @@ module Decidim
30
34
  choice.try(:custom_body) || choice.try(:body)
31
35
  end
32
36
  end
37
+
38
+ def answer_translated_attribute_name(attribute)
39
+ I18n.t(attribute.to_sym, scope: "decidim.forms.user_answers_serializer")
40
+ end
33
41
  end
34
42
  end
35
43
  end
@@ -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.16.1"
7
+ "0.17.0"
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-forms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.1
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -19,42 +19,42 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.16.1
22
+ version: 0.17.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.16.1
29
+ version: 0.17.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: decidim-admin
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - '='
35
35
  - !ruby/object:Gem::Version
36
- version: 0.16.1
36
+ version: 0.17.0
37
37
  type: :development
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - '='
42
42
  - !ruby/object:Gem::Version
43
- version: 0.16.1
43
+ version: 0.17.0
44
44
  - !ruby/object:Gem::Dependency
45
45
  name: decidim-dev
46
46
  requirement: !ruby/object:Gem::Requirement
47
47
  requirements:
48
48
  - - '='
49
49
  - !ruby/object:Gem::Version
50
- version: 0.16.1
50
+ version: 0.17.0
51
51
  type: :development
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
54
54
  requirements:
55
55
  - - '='
56
56
  - !ruby/object:Gem::Version
57
- version: 0.16.1
57
+ version: 0.17.0
58
58
  description: A forms gem for decidim.
59
59
  email:
60
60
  - josepjaume@gmail.com
@@ -68,6 +68,7 @@ files:
68
68
  - README.md
69
69
  - Rakefile
70
70
  - app/assets/config/admin/decidim_forms_manifest.js
71
+ - app/assets/config/decidim_forms_manifest.css
71
72
  - app/assets/config/decidim_forms_manifest.js
72
73
  - app/assets/images/decidim/surveys/icon.svg
73
74
  - app/assets/javascripts/decidim/forms/admin/auto_buttons_by_min_items.component.js.es6
@@ -76,6 +77,11 @@ files:
76
77
  - app/assets/javascripts/decidim/forms/autosortable_checkboxes.component.js.es6
77
78
  - app/assets/javascripts/decidim/forms/forms.js.es6
78
79
  - app/assets/javascripts/decidim/forms/option_attached_inputs.component.js.es6
80
+ - app/assets/stylesheets/decidim/forms/forms.scss
81
+ - app/cells/decidim/forms/answer_readonly/show.erb
82
+ - app/cells/decidim/forms/answer_readonly_cell.rb
83
+ - app/cells/decidim/forms/question_readonly/show.erb
84
+ - app/cells/decidim/forms/question_readonly_cell.rb
79
85
  - app/commands/decidim/forms/admin/update_questionnaire.rb
80
86
  - app/commands/decidim/forms/answer_questionnaire.rb
81
87
  - app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb
@@ -104,6 +110,7 @@ files:
104
110
  - config/locales/ar-SA.yml
105
111
  - config/locales/ca.yml
106
112
  - config/locales/cs-CZ.yml
113
+ - config/locales/cs.yml
107
114
  - config/locales/de.yml
108
115
  - config/locales/en.yml
109
116
  - config/locales/es-MX.yml
@@ -111,6 +118,7 @@ files:
111
118
  - config/locales/es.yml
112
119
  - config/locales/eu.yml
113
120
  - config/locales/fi-pl.yml
121
+ - config/locales/fi-plain.yml
114
122
  - config/locales/fi.yml
115
123
  - config/locales/fr.yml
116
124
  - config/locales/gl.yml
@@ -153,7 +161,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
153
161
  requirements:
154
162
  - - ">="
155
163
  - !ruby/object:Gem::Version
156
- version: '2.3'
164
+ version: '2.5'
157
165
  required_rubygems_version: !ruby/object:Gem::Requirement
158
166
  requirements:
159
167
  - - ">="