decidim-forms 0.27.8 → 0.28.0.rc4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/app/cells/decidim/forms/answer_readonly/show.erb +1 -1
- data/app/cells/decidim/forms/matrix_readonly/show.erb +1 -1
- data/app/cells/decidim/forms/question_readonly/show.erb +8 -8
- data/app/cells/decidim/forms/question_readonly/title_and_description.erb +8 -0
- data/app/cells/decidim/forms/question_readonly_cell.rb +7 -0
- data/app/cells/decidim/forms/step_navigation/show.erb +13 -26
- data/app/cells/decidim/forms/step_navigation_cell.rb +7 -0
- data/app/commands/decidim/forms/answer_questionnaire.rb +31 -11
- data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +4 -4
- data/app/controllers/decidim/forms/admin/concerns/has_questionnaire_answers.rb +1 -1
- data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +3 -3
- data/app/forms/decidim/forms/answer_form.rb +7 -3
- data/app/forms/decidim/forms/questionnaire_form.rb +1 -1
- data/app/helpers/decidim/forms/admin/application_helper.rb +1 -1
- data/app/helpers/decidim/forms/admin/concerns/has_questionnaire_answers_url_helper.rb +2 -2
- data/app/models/decidim/forms/answer.rb +1 -1
- data/app/models/decidim/forms/display_condition.rb +2 -2
- data/app/models/decidim/forms/question.rb +0 -4
- data/app/models/decidim/forms/questionnaire.rb +1 -1
- data/app/packs/entrypoints/decidim_forms.js +4 -0
- data/app/packs/src/decidim/forms/admin/collapsible_questions.js +12 -6
- data/app/packs/src/decidim/forms/admin/forms.js +7 -7
- data/app/packs/src/decidim/forms/display_conditions.component.js +3 -3
- data/app/packs/src/decidim/forms/forms.js +15 -9
- data/app/packs/src/decidim/forms/option_attached_inputs.component.js +1 -1
- data/app/packs/stylesheets/decidim/forms/forms.scss +82 -52
- data/app/packs/stylesheets/decidim/forms/questionnaire-answers-pdf.scss +13 -13
- data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +2 -2
- data/app/presenters/decidim/forms/admin_log/questionnaire_presenter.rb +2 -2
- data/app/presenters/decidim/forms/answer_option_presenter.rb +1 -1
- data/app/queries/decidim/forms/questionnaire_participants.rb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_answer_option.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_answer_option_template.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_display_condition.html.erb +2 -2
- data/app/views/decidim/forms/admin/questionnaires/_display_condition_template.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_form.html.erb +52 -74
- data/app/views/decidim/forms/admin/questionnaires/_matrix_row.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_matrix_row_template.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +147 -135
- data/app/views/decidim/forms/admin/questionnaires/_separator.html.erb +15 -13
- data/app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb +69 -63
- data/app/views/decidim/forms/admin/questionnaires/answers/export/_answer.html.erb +4 -4
- data/app/views/decidim/forms/admin/questionnaires/answers/export/pdf.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/answers/index.html.erb +41 -45
- data/app/views/decidim/forms/admin/questionnaires/answers/show.html.erb +13 -18
- data/app/views/decidim/forms/admin/questionnaires/edit.html.erb +33 -6
- data/app/views/decidim/forms/questionnaires/_answer.html.erb +31 -27
- data/app/views/decidim/forms/questionnaires/_questionnaire.html.erb +78 -0
- data/app/views/decidim/forms/questionnaires/_questionnaire_readonly.html.erb +11 -0
- data/app/views/decidim/forms/questionnaires/answers/_files.html.erb +1 -1
- data/app/views/decidim/forms/questionnaires/answers/_long_answer.html.erb +3 -1
- data/app/views/decidim/forms/questionnaires/answers/_matrix_multiple.html.erb +44 -41
- data/app/views/decidim/forms/questionnaires/answers/_matrix_single.html.erb +44 -41
- data/app/views/decidim/forms/questionnaires/answers/_multiple_option.html.erb +7 -6
- data/app/views/decidim/forms/questionnaires/answers/_separator.html.erb +1 -1
- data/app/views/decidim/forms/questionnaires/answers/_short_answer.html.erb +3 -1
- data/app/views/decidim/forms/questionnaires/answers/_single_option.html.erb +13 -12
- data/app/views/decidim/forms/questionnaires/answers/_sorting.html.erb +9 -12
- data/app/views/decidim/forms/questionnaires/answers/_title_and_description.html.erb +1 -1
- data/app/views/decidim/forms/questionnaires/show.html.erb +35 -144
- data/config/initializers/wicked_pdf.rb +1 -1
- data/config/locales/ar.yml +0 -6
- data/config/locales/bg.yml +0 -177
- data/config/locales/ca.yml +7 -2
- data/config/locales/cs.yml +8 -3
- data/config/locales/de.yml +9 -4
- data/config/locales/el.yml +7 -2
- data/config/locales/en.yml +8 -3
- data/config/locales/es-MX.yml +7 -2
- data/config/locales/es-PY.yml +7 -2
- data/config/locales/es.yml +7 -2
- data/config/locales/eu.yml +8 -3
- data/config/locales/fi-plain.yml +7 -2
- data/config/locales/fi.yml +7 -2
- data/config/locales/fr-CA.yml +8 -3
- data/config/locales/fr.yml +8 -3
- data/config/locales/gl.yml +0 -4
- data/config/locales/hu.yml +3 -9
- data/config/locales/id-ID.yml +0 -4
- data/config/locales/it.yml +0 -6
- data/config/locales/ja.yml +6 -1
- data/config/locales/lb.yml +0 -6
- data/config/locales/lt.yml +7 -2
- data/config/locales/lv.yml +0 -6
- data/config/locales/nl.yml +0 -6
- data/config/locales/no.yml +0 -6
- data/config/locales/pl.yml +6 -8
- data/config/locales/pt-BR.yml +0 -25
- data/config/locales/pt.yml +0 -6
- data/config/locales/ro-RO.yml +19 -14
- data/config/locales/ru.yml +0 -3
- data/config/locales/sk.yml +0 -6
- data/config/locales/sv.yml +3 -6
- data/config/locales/tr-TR.yml +0 -6
- data/config/locales/zh-CN.yml +0 -6
- data/config/locales/zh-TW.yml +7 -2
- data/lib/decidim/forms/engine.rb +8 -0
- data/lib/decidim/forms/test/factories.rb +37 -51
- data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +129 -239
- data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +18 -18
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +14 -14
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +60 -78
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +6 -6
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +25 -25
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +9 -9
- data/lib/decidim/forms/user_answers_serializer.rb +1 -1
- data/lib/decidim/forms/version.rb +1 -1
- metadata +23 -18
- data/app/packs/src/decidim/forms/autosortable_checkboxes.component.js +0 -83
- data/config/locales/he-IL.yml +0 -1
- data/decidim-forms.gemspec +0 -34
data/config/locales/ro-RO.yml
CHANGED
@@ -24,7 +24,7 @@ ro:
|
|
24
24
|
missing: nu sunt completate
|
25
25
|
too_many: sunt prea multe
|
26
26
|
questionnaire:
|
27
|
-
request_invalid: A apărut o eroare la procesarea cererii. Te rugăm să încerci din nou
|
27
|
+
request_invalid: A apărut o eroare la procesarea cererii. Te rugăm să încerci din nou.
|
28
28
|
decidim:
|
29
29
|
forms:
|
30
30
|
admin:
|
@@ -39,12 +39,14 @@ ro:
|
|
39
39
|
answer_option:
|
40
40
|
answer_option: Opțiune de răspuns
|
41
41
|
free_text: Text liber
|
42
|
-
remove:
|
42
|
+
remove: Elimină
|
43
43
|
statement: Declarație
|
44
44
|
answers:
|
45
45
|
actions:
|
46
46
|
back: Înapoi la răspunsuri
|
47
47
|
export: Exportă
|
48
|
+
next: Următoarea ›
|
49
|
+
previous: "‹ Anterioara"
|
48
50
|
show: Afişează răspunsurile
|
49
51
|
empty: Niciun răspuns încă
|
50
52
|
export:
|
@@ -53,7 +55,7 @@ ro:
|
|
53
55
|
export_response:
|
54
56
|
title: survey_user_answers_%{token}
|
55
57
|
index:
|
56
|
-
title: "%{total} răspunsuri
|
58
|
+
title: "%{total} total răspunsuri"
|
57
59
|
show:
|
58
60
|
title: 'Răspuns #%{number}'
|
59
61
|
display_condition:
|
@@ -71,21 +73,21 @@ ro:
|
|
71
73
|
mandatory: Această condiție trebuie îndeplinită întotdeauna indiferent de stadiul altor condiții
|
72
74
|
remove: Elimină
|
73
75
|
save_warning: Ține minte să salvezi chestionarul înainte de configurarea condiţiilor de afişare
|
74
|
-
select_answer_option:
|
76
|
+
select_answer_option: Selectează opțiunea de răspuns
|
75
77
|
select_condition_question: Selectează o întrebare
|
76
|
-
select_condition_type:
|
78
|
+
select_condition_type: Selectează un tip de condiție
|
77
79
|
edit:
|
78
80
|
save: Salvează
|
79
|
-
title:
|
81
|
+
title: Editează chestionarul
|
80
82
|
form:
|
81
83
|
add_question: Adaugă întrebare
|
82
84
|
add_separator: Adaugă separator
|
83
|
-
add_title_and_description:
|
84
|
-
already_answered_warning: Au fost înregistrare deja câteva răspunsuri de la utilizatori pentru acest chestionar. De aceea, nu mai
|
85
|
+
add_title_and_description: Adaugă titlu și descriere
|
86
|
+
already_answered_warning: Au fost înregistrare deja câteva răspunsuri de la utilizatori pentru acest chestionar. De aceea, nu mai poți modifica întrebările.
|
85
87
|
collapse: Restrânge toate întrebările
|
86
88
|
expand: Extinde toate întrebările
|
87
89
|
preview: Previzualizează
|
88
|
-
title:
|
90
|
+
title: Editează chestionarul pentru %{questionnaire_for}
|
89
91
|
unpublished_warning: Chestionarul nu este publicat. Poți modifica întrebările, dar această acțiune va duce la stergerea automată a răspunsurilor curente.
|
90
92
|
matrix_row:
|
91
93
|
matrix_row: Rând
|
@@ -95,14 +97,14 @@ ro:
|
|
95
97
|
add_answer_option: Adaugă opțiune de răspuns
|
96
98
|
add_display_condition: Adaugă condiție de afișare
|
97
99
|
add_display_condition_info: Salvează formularul pentru a configura condițiile de afișare
|
98
|
-
add_matrix_row:
|
100
|
+
add_matrix_row: Adaugă rând
|
99
101
|
any: Oricare
|
100
|
-
collapse:
|
102
|
+
collapse: Restrânge
|
101
103
|
description: Descriere
|
102
104
|
down: Mergi în jos
|
103
|
-
expand:
|
105
|
+
expand: Extinde
|
104
106
|
question: Întrebare
|
105
|
-
remove:
|
107
|
+
remove: Elimină
|
106
108
|
statement: Declarație
|
107
109
|
up: Mergi în sus
|
108
110
|
separator:
|
@@ -154,7 +156,10 @@ ro:
|
|
154
156
|
max_choices: 'Număr maxim de alegeri: %{n}'
|
155
157
|
show:
|
156
158
|
answer_questionnaire:
|
157
|
-
|
159
|
+
already_have_an_account?: Ai deja un cont?
|
160
|
+
are_you_new?: Utilizator nou?
|
161
|
+
sign_in_description: Autentifică-te pentru a participa la sondaj
|
162
|
+
sign_up_description: Creați un cont de participant pentru a participa la sondaj
|
158
163
|
title: Completează chestionarul
|
159
164
|
current_step: Pasul %{step}
|
160
165
|
of_total_steps: din %{total_steps}
|
data/config/locales/ru.yml
CHANGED
data/config/locales/sk.yml
CHANGED
@@ -16,8 +16,6 @@ sk:
|
|
16
16
|
choices:
|
17
17
|
missing: nie je kompletné
|
18
18
|
too_many: je príliš veľa
|
19
|
-
questionnaire:
|
20
|
-
request_invalid: Počas požiadavku sa vyskytla chyba, skúste to znova.
|
21
19
|
decidim:
|
22
20
|
forms:
|
23
21
|
admin:
|
@@ -50,9 +48,6 @@ sk:
|
|
50
48
|
up: Hore
|
51
49
|
update:
|
52
50
|
invalid: Vyskytol sa problém s ukladaním formulára.
|
53
|
-
errors:
|
54
|
-
answer:
|
55
|
-
body: Telo nemôže byť prázdne
|
56
51
|
question_types:
|
57
52
|
long_answer: Dlhá odpoveď
|
58
53
|
multiple_option: Viacero možností
|
@@ -67,7 +62,6 @@ sk:
|
|
67
62
|
max_choices: 'Maximum možností: %{n}'
|
68
63
|
show:
|
69
64
|
answer_questionnaire:
|
70
|
-
anonymous_user_message: <a href="%{sign_in_link}">Prihláste sa so svojím účtom</a> alebo <a href="%{sign_up_link}"> sa zaregistrujte</a>, aby ste mohli odpovedať.
|
71
65
|
title: Odpovedať na formulár
|
72
66
|
questionnaire_answered:
|
73
67
|
body: Na tento formulár už ste dopovedali.
|
data/config/locales/sv.yml
CHANGED
@@ -23,8 +23,6 @@ sv:
|
|
23
23
|
choices:
|
24
24
|
missing: är inte fullständiga
|
25
25
|
too_many: är för många
|
26
|
-
questionnaire:
|
27
|
-
request_invalid: Ett fel uppstod när begäran skulle hanteras. Försök igen
|
28
26
|
decidim:
|
29
27
|
forms:
|
30
28
|
admin:
|
@@ -45,6 +43,8 @@ sv:
|
|
45
43
|
actions:
|
46
44
|
back: Tillbaka till svar
|
47
45
|
export: Exportera
|
46
|
+
next: Nästa ›
|
47
|
+
previous: "‹ Föregående"
|
48
48
|
show: Visa svar
|
49
49
|
empty: Inga svar ännu
|
50
50
|
export:
|
@@ -122,9 +122,6 @@ sv:
|
|
122
122
|
update:
|
123
123
|
invalid: Det gick inte att spara formuläret.
|
124
124
|
success: Formuläret har sparats.
|
125
|
-
errors:
|
126
|
-
answer:
|
127
|
-
body: Kroppen kan inte vara to
|
128
125
|
images:
|
129
126
|
dimensions: "%{width} x %{height} px"
|
130
127
|
question_types:
|
@@ -146,7 +143,7 @@ sv:
|
|
146
143
|
max_choices: 'Högst antal val: %{n}'
|
147
144
|
show:
|
148
145
|
answer_questionnaire:
|
149
|
-
|
146
|
+
are_you_new?: Ny användare?
|
150
147
|
title: Besvara formuläret
|
151
148
|
current_step: Steg %{step}
|
152
149
|
of_total_steps: av %{total_steps}
|
data/config/locales/tr-TR.yml
CHANGED
@@ -18,8 +18,6 @@ tr:
|
|
18
18
|
choices:
|
19
19
|
missing: tamamlanmadı
|
20
20
|
too_many: çok fazla
|
21
|
-
questionnaire:
|
22
|
-
request_invalid: İsteği işlerken bir hata oluştu. Lütfen tekrar deneyin
|
23
21
|
decidim:
|
24
22
|
forms:
|
25
23
|
admin:
|
@@ -107,9 +105,6 @@ tr:
|
|
107
105
|
update:
|
108
106
|
invalid: Formu kaydederken bir sorun oluştu.
|
109
107
|
success: Başarıyla kaydedildi.
|
110
|
-
errors:
|
111
|
-
answer:
|
112
|
-
body: Vücut boş olamaz
|
113
108
|
images:
|
114
109
|
dimensions: "%{width} x %{height} px"
|
115
110
|
question_types:
|
@@ -129,7 +124,6 @@ tr:
|
|
129
124
|
max_choices: 'Maksimum seçenek: %{n}'
|
130
125
|
show:
|
131
126
|
answer_questionnaire:
|
132
|
-
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>.
|
133
127
|
title: Formu cevapla
|
134
128
|
current_step: '%{step} adım'
|
135
129
|
of_total_steps: '%{total_steps}'
|
data/config/locales/zh-CN.yml
CHANGED
@@ -18,8 +18,6 @@ zh-CN:
|
|
18
18
|
choices:
|
19
19
|
missing: 不完成
|
20
20
|
too_many: 太多了
|
21
|
-
questionnaire:
|
22
|
-
request_invalid: 处理请求时出错。请再试一次
|
23
21
|
decidim:
|
24
22
|
forms:
|
25
23
|
admin:
|
@@ -106,9 +104,6 @@ zh-CN:
|
|
106
104
|
update:
|
107
105
|
invalid: 保存表单时出错。
|
108
106
|
success: 表单保存成功。
|
109
|
-
errors:
|
110
|
-
answer:
|
111
|
-
body: 主体不能为空
|
112
107
|
images:
|
113
108
|
dimensions: "%{width} x %{height} px"
|
114
109
|
question_types:
|
@@ -128,7 +123,6 @@ zh-CN:
|
|
128
123
|
max_choices: '最大选择数: %{n}'
|
129
124
|
show:
|
130
125
|
answer_questionnaire:
|
131
|
-
anonymous_user_message: <a href="%{sign_in_link}">使用您的帐户</a> 或 <a href="%{sign_up_link}">注册</a> 以回答表单。
|
132
126
|
title: 回答表单
|
133
127
|
current_step: 步骤 %{step}
|
134
128
|
of_total_steps: '%{total_steps}'
|
data/config/locales/zh-TW.yml
CHANGED
@@ -24,7 +24,7 @@ zh-TW:
|
|
24
24
|
missing: 尚未完成
|
25
25
|
too_many: 太多了
|
26
26
|
questionnaire:
|
27
|
-
request_invalid:
|
27
|
+
request_invalid: 處理請求時發生錯誤。請再試一次。
|
28
28
|
decidim:
|
29
29
|
forms:
|
30
30
|
admin:
|
@@ -45,6 +45,8 @@ zh-TW:
|
|
45
45
|
actions:
|
46
46
|
back: 返回回覆
|
47
47
|
export: 匯出
|
48
|
+
next: 下一個 ›
|
49
|
+
previous: "‹ 上一篇"
|
48
50
|
show: 顯示答案
|
49
51
|
empty: 目前尚未回答
|
50
52
|
export:
|
@@ -154,7 +156,10 @@ zh-TW:
|
|
154
156
|
max_choices: '最多選擇數量: %{n}'
|
155
157
|
show:
|
156
158
|
answer_questionnaire:
|
157
|
-
|
159
|
+
already_have_an_account?: 已經有帳號了嗎?
|
160
|
+
are_you_new?: 新用戶?
|
161
|
+
sign_in_description: 登入以填寫問卷
|
162
|
+
sign_up_description: 建立參與者帳號以填寫問卷
|
158
163
|
title: 回答表單
|
159
164
|
current_step: 步驟%{step}
|
160
165
|
of_total_steps: 的%{total_steps}
|
data/lib/decidim/forms/engine.rb
CHANGED
@@ -15,6 +15,14 @@ module Decidim
|
|
15
15
|
initializer "decidim_forms.webpacker.assets_path" do
|
16
16
|
Decidim.register_assets_path File.expand_path("app/packs", root)
|
17
17
|
end
|
18
|
+
|
19
|
+
initializer "decidim_forms.authorization_transfer" do
|
20
|
+
config.to_prepare do
|
21
|
+
Decidim::AuthorizationTransfer.register(:forms) do |transfer|
|
22
|
+
transfer.move_records(Decidim::Forms::Answer, :decidim_user_id)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
18
26
|
end
|
19
27
|
end
|
20
28
|
end
|
@@ -5,37 +5,37 @@ require "decidim/participatory_processes/test/factories"
|
|
5
5
|
|
6
6
|
FactoryBot.define do
|
7
7
|
factory :questionnaire, class: "Decidim::Forms::Questionnaire" do
|
8
|
-
|
9
|
-
|
8
|
+
title { generate_localized_title }
|
9
|
+
description do
|
10
|
+
Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
11
|
+
generate_localized_title
|
12
|
+
end
|
10
13
|
end
|
11
|
-
|
12
|
-
|
13
|
-
tos { generate_localized_title(:questionnaire_tos, skip_injection: skip_injection) }
|
14
|
-
questionnaire_for { build(:participatory_process, skip_injection: skip_injection) }
|
14
|
+
tos { generate_localized_title }
|
15
|
+
questionnaire_for { build(:participatory_process) }
|
15
16
|
salt { SecureRandom.hex(32) }
|
16
17
|
|
17
18
|
trait :with_questions do
|
18
19
|
questions do
|
19
20
|
position = 0
|
20
21
|
qs = %w(short_answer long_answer).collect do |text_question_type|
|
21
|
-
q = build(:questionnaire_question, question_type: text_question_type, position:
|
22
|
+
q = build(:questionnaire_question, question_type: text_question_type, position:)
|
22
23
|
position += 1
|
23
24
|
q
|
24
25
|
end
|
25
|
-
qs << build(:questionnaire_question, :with_answer_options, question_type: :single_option, position:
|
26
|
+
qs << build(:questionnaire_question, :with_answer_options, question_type: :single_option, position:)
|
26
27
|
qs
|
27
28
|
end
|
28
29
|
end
|
29
30
|
|
30
31
|
trait :with_all_questions do
|
31
|
-
after(:build) do |questionaire,
|
32
|
+
after(:build) do |questionaire, _evaluator|
|
32
33
|
position = 0
|
33
34
|
%w(short_answer long_answer).collect do |text_question_type|
|
34
35
|
q = create(:questionnaire_question,
|
35
36
|
question_type: text_question_type,
|
36
|
-
position
|
37
|
-
questionnaire: questionaire
|
38
|
-
skip_injection: evaluator.skip_injection)
|
37
|
+
position:,
|
38
|
+
questionnaire: questionaire)
|
39
39
|
position += 1
|
40
40
|
questionaire.questions << q
|
41
41
|
end
|
@@ -43,9 +43,8 @@ FactoryBot.define do
|
|
43
43
|
%w(single_option multiple_option).each do |option_question_type|
|
44
44
|
q = create(:questionnaire_question, :with_answer_options,
|
45
45
|
question_type: option_question_type,
|
46
|
-
position
|
47
|
-
questionnaire: questionaire
|
48
|
-
skip_injection: evaluator.skip_injection)
|
46
|
+
position:,
|
47
|
+
questionnaire: questionaire)
|
49
48
|
q.display_conditions.build(
|
50
49
|
condition_question: questionaire.questions[q.position - 1],
|
51
50
|
question: q,
|
@@ -59,10 +58,9 @@ FactoryBot.define do
|
|
59
58
|
%w(matrix_single matrix_multiple).collect do |matrix_question_type|
|
60
59
|
q = build(:questionnaire_question, :with_answer_options,
|
61
60
|
question_type: matrix_question_type,
|
62
|
-
position
|
61
|
+
position:,
|
63
62
|
body: generate_localized_title,
|
64
|
-
questionnaire: questionaire
|
65
|
-
skip_injection: evaluator.skip_injection)
|
63
|
+
questionnaire: questionaire)
|
66
64
|
q.display_conditions.build(
|
67
65
|
condition_question: questionaire.questions[q.position - 1],
|
68
66
|
question: q,
|
@@ -84,13 +82,16 @@ FactoryBot.define do
|
|
84
82
|
|
85
83
|
factory :questionnaire_question, class: "Decidim::Forms::Question" do
|
86
84
|
transient do
|
87
|
-
skip_injection { false }
|
88
85
|
options { [] }
|
89
86
|
rows { [] }
|
90
87
|
end
|
91
88
|
|
92
|
-
body { generate_localized_title
|
93
|
-
description
|
89
|
+
body { generate_localized_title }
|
90
|
+
description do
|
91
|
+
Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
92
|
+
generate_localized_title
|
93
|
+
end
|
94
|
+
end
|
94
95
|
mandatory { false }
|
95
96
|
position { 0 }
|
96
97
|
question_type { Decidim::Forms::Question::TYPES.first }
|
@@ -118,13 +119,13 @@ FactoryBot.define do
|
|
118
119
|
|
119
120
|
trait :with_answer_options do
|
120
121
|
answer_options do
|
121
|
-
Array.new(3).collect { build(:answer_option
|
122
|
+
Array.new(3).collect { build(:answer_option) }
|
122
123
|
end
|
123
124
|
end
|
124
125
|
|
125
126
|
trait :conditioned do
|
126
127
|
display_conditions do
|
127
|
-
Array.new(3).collect { build(:display_condition
|
128
|
+
Array.new(3).collect { build(:display_condition) }
|
128
129
|
end
|
129
130
|
end
|
130
131
|
|
@@ -138,28 +139,22 @@ FactoryBot.define do
|
|
138
139
|
end
|
139
140
|
|
140
141
|
factory :answer, class: "Decidim::Forms::Answer" do
|
141
|
-
transient do
|
142
|
-
skip_injection { false }
|
143
|
-
end
|
144
142
|
body { "hola" }
|
145
143
|
questionnaire
|
146
|
-
question { create(:questionnaire_question, questionnaire:
|
147
|
-
user { create(:user, organization: questionnaire.questionnaire_for.organization
|
144
|
+
question { create(:questionnaire_question, questionnaire:) }
|
145
|
+
user { create(:user, organization: questionnaire.questionnaire_for.organization) }
|
148
146
|
session_token { Digest::MD5.hexdigest(user.id.to_s) }
|
149
147
|
|
150
148
|
trait :with_attachments do
|
151
|
-
after(:create) do |answer,
|
152
|
-
create :attachment, :with_image, attached_to: answer
|
153
|
-
create :attachment, :with_pdf, attached_to: answer
|
149
|
+
after(:create) do |answer, _evaluator|
|
150
|
+
create :attachment, :with_image, attached_to: answer
|
151
|
+
create :attachment, :with_pdf, attached_to: answer
|
154
152
|
end
|
155
153
|
end
|
156
154
|
end
|
157
155
|
|
158
156
|
factory :answer_option, class: "Decidim::Forms::AnswerOption" do
|
159
|
-
|
160
|
-
skip_injection { false }
|
161
|
-
end
|
162
|
-
question { create(:questionnaire_question, skip_injection: skip_injection) }
|
157
|
+
question { create(:questionnaire_question) }
|
163
158
|
body { generate_localized_title }
|
164
159
|
free_text { false }
|
165
160
|
|
@@ -173,40 +168,31 @@ FactoryBot.define do
|
|
173
168
|
end
|
174
169
|
|
175
170
|
factory :answer_choice, class: "Decidim::Forms::AnswerChoice" do
|
176
|
-
transient do
|
177
|
-
skip_injection { false }
|
178
|
-
end
|
179
171
|
answer
|
180
|
-
answer_option { create(:answer_option, question: answer.question
|
181
|
-
matrix_row { create(:question_matrix_row, question: answer.question
|
172
|
+
answer_option { create(:answer_option, question: answer.question) }
|
173
|
+
matrix_row { create(:question_matrix_row, question: answer.question) }
|
182
174
|
end
|
183
175
|
|
184
176
|
factory :question_matrix_row, class: "Decidim::Forms::QuestionMatrixRow" do
|
185
|
-
|
186
|
-
skip_injection { false }
|
187
|
-
end
|
188
|
-
question { create(:questionnaire_question, skip_injection: skip_injection) }
|
177
|
+
question { create(:questionnaire_question) }
|
189
178
|
body { generate_localized_title }
|
190
179
|
position { 0 }
|
191
180
|
end
|
192
181
|
|
193
182
|
factory :display_condition, class: "Decidim::Forms::DisplayCondition" do
|
194
|
-
|
195
|
-
|
196
|
-
end
|
197
|
-
condition_question { create(:questionnaire_question, skip_injection: skip_injection) }
|
198
|
-
question { create(:questionnaire_question, position: 1, skip_injection: skip_injection) }
|
183
|
+
condition_question { create(:questionnaire_question) }
|
184
|
+
question { create(:questionnaire_question, position: 1) }
|
199
185
|
condition_type { :answered }
|
200
186
|
mandatory { true }
|
201
187
|
|
202
188
|
trait :equal do
|
203
189
|
condition_type { :equal }
|
204
|
-
answer_option { create(:answer_option, question: condition_question
|
190
|
+
answer_option { create(:answer_option, question: condition_question) }
|
205
191
|
end
|
206
192
|
|
207
193
|
trait :match do
|
208
194
|
condition_type { :match }
|
209
|
-
condition_value { generate_localized_title
|
195
|
+
condition_value { generate_localized_title }
|
210
196
|
end
|
211
197
|
end
|
212
198
|
end
|