decidim-forms 0.28.0 → 0.28.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/forms/question_readonly/show.erb +1 -1
- data/app/cells/decidim/forms/question_readonly/title_and_description.erb +1 -1
- data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +1 -1
- data/app/packs/entrypoints/decidim_forms_admin.js +1 -1
- data/app/views/decidim/forms/admin/questionnaires/answers/index.html.erb +2 -2
- data/app/views/decidim/forms/admin/questionnaires/answers/show.html.erb +2 -2
- data/app/views/decidim/forms/admin/questionnaires/edit.html.erb +2 -2
- data/config/locales/ar.yml +2 -0
- data/config/locales/fi-plain.yml +1 -0
- data/config/locales/fi.yml +1 -0
- data/config/locales/he-IL.yml +1 -0
- data/config/locales/hu.yml +3 -3
- data/config/locales/ja.yml +1 -0
- data/config/locales/pl.yml +7 -0
- data/config/locales/ro-RO.yml +13 -12
- data/decidim-forms.gemspec +41 -0
- data/lib/decidim/forms/test/factories.rb +53 -39
- data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +2 -2
- data/lib/decidim/forms/version.rb +1 -1
- metadata +16 -15
- data/config/environment.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5244aeaa5204a39ca62c1366ee3880c55e2831021d9b95a1b75e49aedd2f9e5b
|
4
|
+
data.tar.gz: 23c281eae9fb57675382065e720c6cc3341d5f514899ef7ee24f156d02f2ff4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbdc3090e52ddc62d50e7f29f490446abe0a5c06c3409130c6dc6e6d1238bcefb3ab53eeb40b28fe31d34f5f0dde50c381ca0ec98836749dd8cfca2675f85548
|
7
|
+
data.tar.gz: baa7e9651c87cb6e75c4ee42728c4e13960ad6465e2c96db120f457bf642809a7b40cbb9181ccbb3ea2c6effebcb122b4b98506c560d7042db2258dcc9157d88
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<li class="answer-questionnaire__question" data-question-readonly>
|
2
2
|
<p class="answer-questionnaire__question-label" data-answer-idx="<%= position %>">
|
3
|
-
<%=
|
3
|
+
<%= decidim_escape_translated(model.body) %>
|
4
4
|
</p>
|
5
5
|
|
6
6
|
<p class="answer-questionnaire__question-description">
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<li class="answer-questionnaire__question" data-question-readonly>
|
2
2
|
<div class="answer-questionnaire__step-heading">
|
3
|
-
<h3 class="h3"><%=
|
3
|
+
<h3 class="h3"><%= decidim_escape_translated(model.body) %></h3>
|
4
4
|
<p class="answer-questionnaire__question-description">
|
5
5
|
<em><%= t(model.question_type, scope: "decidim.forms.question_types") %></em>
|
6
6
|
</p>
|
@@ -20,7 +20,7 @@ module Decidim
|
|
20
20
|
helper_method :questionnaire_for, :questionnaire, :blank_question, :blank_answer_option, :blank_matrix_row,
|
21
21
|
:blank_display_condition, :question_types, :display_condition_types, :update_url, :public_url, :answer_options_url, :edit_questionnaire_title
|
22
22
|
|
23
|
-
if defined?
|
23
|
+
if defined?(Decidim::Templates::Admin::Concerns::Templatable)
|
24
24
|
include Decidim::Templates::Admin::Concerns::Templatable
|
25
25
|
helper Decidim::DatalistSelectHelper
|
26
26
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
<div class="card" id="answers">
|
2
2
|
<div class="item_show__header">
|
3
|
-
<
|
3
|
+
<h1 class="item_show__header-title">
|
4
4
|
<%= t ".title", total: @total %>
|
5
5
|
<%= link_to t("actions.back", scope: "decidim.forms.admin.questionnaires"), questionnaire_url, class: "button button__sm button__secondary new" %>
|
6
|
-
</
|
6
|
+
</h1>
|
7
7
|
</div>
|
8
8
|
<div class="table-scroll">
|
9
9
|
<table class="table-list">
|
@@ -1,13 +1,13 @@
|
|
1
1
|
<div class="card" id="answers">
|
2
2
|
<div class="item_show__header">
|
3
|
-
<
|
3
|
+
<h1 class="item_show__header-title">
|
4
4
|
<%= t ".title", number: current_idx %>
|
5
5
|
|
6
6
|
<%= link_to t("actions.next", scope: "decidim.forms.admin.questionnaires.answers").html_safe, next_url, rel: "next", class: "button button__sm button__secondary next" unless last? %>
|
7
7
|
<%= link_to t("actions.previous", scope: "decidim.forms.admin.questionnaires.answers").html_safe, prev_url, rel: "prev", class: "button button__sm button__secondary prev" unless first? %>
|
8
8
|
<%= link_to t("actions.export", scope: "decidim.forms.admin.questionnaires.answers"), questionnaire_export_response_url(@participant.session_token), class: "button button__sm button__secondary export" %>
|
9
9
|
<%= link_to t("actions.back", scope: "decidim.forms.admin.questionnaires.answers"), questionnaire_participants_url, class: "button button__sm button__secondary back" %>
|
10
|
-
</
|
10
|
+
</h1>
|
11
11
|
</div>
|
12
12
|
<div class="card-section">
|
13
13
|
<div class="table">
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<% else %>
|
6
6
|
|
7
7
|
<div class="item_show__header">
|
8
|
-
<
|
8
|
+
<h1 class="item_show__header-title">
|
9
9
|
<%= edit_questionnaire_title %>
|
10
10
|
|
11
11
|
<% unless template? questionnaire.questionnaire_for %>
|
@@ -21,7 +21,7 @@
|
|
21
21
|
<button class="button button__sm button__secondary whitespace-nowrap" disabled><%= t("empty", scope: "decidim.forms.admin.questionnaires.answers") %></button>
|
22
22
|
<% end %>
|
23
23
|
<% end %>
|
24
|
-
</
|
24
|
+
</h1>
|
25
25
|
</div>
|
26
26
|
|
27
27
|
<div class="item__edit item__edit-1col">
|
data/config/locales/ar.yml
CHANGED
data/config/locales/fi-plain.yml
CHANGED
@@ -162,6 +162,7 @@ fi-pl:
|
|
162
162
|
sign_up_description: Luo tili tähän palveluun vastataksesi kyselyyn
|
163
163
|
title: Vastaa kyselyyn
|
164
164
|
current_step: Vaihe %{step}
|
165
|
+
empty: Tälle lomakkeelle ei ole vielä määritetty kysymyksiä.
|
165
166
|
of_total_steps: / %{total_steps}
|
166
167
|
questionnaire_answered:
|
167
168
|
body: Olet jo vastannut tähän kyselyyn.
|
data/config/locales/fi.yml
CHANGED
@@ -162,6 +162,7 @@ fi:
|
|
162
162
|
sign_up_description: Luo tili tähän palveluun vastataksesi kyselyyn
|
163
163
|
title: Vastaa kyselylomakkeeseen
|
164
164
|
current_step: Vaihe %{step}
|
165
|
+
empty: Tälle lomakkeelle ei ole vielä määritetty kysymyksiä.
|
165
166
|
of_total_steps: / %{total_steps}
|
166
167
|
questionnaire_answered:
|
167
168
|
body: Olet jo vastannut tähän kyselylomakkeeseen.
|
@@ -0,0 +1 @@
|
|
1
|
+
he:
|
data/config/locales/hu.yml
CHANGED
@@ -28,7 +28,7 @@ hu:
|
|
28
28
|
answer_option: Válasz opció
|
29
29
|
free_text: Szabadszöveg
|
30
30
|
remove: Eltávolít
|
31
|
-
statement:
|
31
|
+
statement: Állítás
|
32
32
|
edit:
|
33
33
|
save: Mentés
|
34
34
|
form:
|
@@ -39,7 +39,7 @@ hu:
|
|
39
39
|
expand: Minden kérdés kibontása
|
40
40
|
matrix_row:
|
41
41
|
remove: Eltávolít
|
42
|
-
statement:
|
42
|
+
statement: Állítás
|
43
43
|
question:
|
44
44
|
add_answer_option: Válasz opció hozzáadása
|
45
45
|
any: Bármilyen
|
@@ -49,7 +49,7 @@ hu:
|
|
49
49
|
expand: Kibontás
|
50
50
|
question: Kérdés
|
51
51
|
remove: Eltávolít
|
52
|
-
statement:
|
52
|
+
statement: Állítás
|
53
53
|
up: Fel
|
54
54
|
title_and_description:
|
55
55
|
collapse: Összecsuk
|
data/config/locales/ja.yml
CHANGED
data/config/locales/pl.yml
CHANGED
@@ -46,6 +46,7 @@ pl:
|
|
46
46
|
back: Powrót do odpowiedzi
|
47
47
|
export: Eksportuj
|
48
48
|
next: Następne ›
|
49
|
+
previous: "‹ Poprzedni"
|
49
50
|
show: Pokaż odpowiedzi
|
50
51
|
empty: Brak odpowiedzi
|
51
52
|
export:
|
@@ -123,11 +124,17 @@ pl:
|
|
123
124
|
update:
|
124
125
|
invalid: Podczas zapisywania formularza wystąpił błąd.
|
125
126
|
success: Formularz został zapisany.
|
127
|
+
admin_log:
|
128
|
+
questionnaire:
|
129
|
+
update: "%{user_name} zaktualizował(a) kwestionariusz %{resource_name}"
|
126
130
|
errors:
|
127
131
|
answer:
|
128
132
|
body: Treść nie może być pusta
|
129
133
|
images:
|
130
134
|
dimensions: "%{width} × %{height} px"
|
135
|
+
processors:
|
136
|
+
resize_and_pad: Rozmiar obrazu zostanie zmieniony i dopasowany do wymiarów %{dimensions}.
|
137
|
+
resize_to_fit: Rozmiar obrazu zostanie zmieniony i dopasowany do wymiarów %{dimensions}.
|
131
138
|
question_types:
|
132
139
|
files: Pliki
|
133
140
|
long_answer: Długa odpowiedź
|
data/config/locales/ro-RO.yml
CHANGED
@@ -39,7 +39,7 @@ ro:
|
|
39
39
|
answer_option:
|
40
40
|
answer_option: Opțiune de răspuns
|
41
41
|
free_text: Text liber
|
42
|
-
remove:
|
42
|
+
remove: Eliminați
|
43
43
|
statement: Declarație
|
44
44
|
answers:
|
45
45
|
actions:
|
@@ -55,7 +55,7 @@ ro:
|
|
55
55
|
export_response:
|
56
56
|
title: survey_user_answers_%{token}
|
57
57
|
index:
|
58
|
-
title: "%{total} total
|
58
|
+
title: "%{total} răspunsuri în total"
|
59
59
|
show:
|
60
60
|
title: 'Răspuns #%{number}'
|
61
61
|
display_condition:
|
@@ -73,21 +73,21 @@ ro:
|
|
73
73
|
mandatory: Această condiție trebuie îndeplinită întotdeauna indiferent de stadiul altor condiții
|
74
74
|
remove: Elimină
|
75
75
|
save_warning: Ține minte să salvezi chestionarul înainte de configurarea condiţiilor de afişare
|
76
|
-
select_answer_option:
|
76
|
+
select_answer_option: Selectați opțiunea de răspuns
|
77
77
|
select_condition_question: Selectează o întrebare
|
78
|
-
select_condition_type:
|
78
|
+
select_condition_type: Selectați un tip de condiție
|
79
79
|
edit:
|
80
80
|
save: Salvează
|
81
|
-
title:
|
81
|
+
title: Editare chestionar
|
82
82
|
form:
|
83
83
|
add_question: Adaugă întrebare
|
84
84
|
add_separator: Adaugă separator
|
85
|
-
add_title_and_description:
|
86
|
-
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: Adaugați 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 puteți modifica întrebările.
|
87
87
|
collapse: Restrânge toate întrebările
|
88
88
|
expand: Extinde toate întrebările
|
89
89
|
preview: Previzualizează
|
90
|
-
title:
|
90
|
+
title: Actualizați chestionarul pentru %{questionnaire_for}
|
91
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.
|
92
92
|
matrix_row:
|
93
93
|
matrix_row: Rând
|
@@ -97,14 +97,14 @@ ro:
|
|
97
97
|
add_answer_option: Adaugă opțiune de răspuns
|
98
98
|
add_display_condition: Adaugă condiție de afișare
|
99
99
|
add_display_condition_info: Salvează formularul pentru a configura condițiile de afișare
|
100
|
-
add_matrix_row:
|
100
|
+
add_matrix_row: Adaugați rând
|
101
101
|
any: Oricare
|
102
|
-
collapse:
|
102
|
+
collapse: Restrângeți
|
103
103
|
description: Descriere
|
104
104
|
down: Mergi în jos
|
105
|
-
expand:
|
105
|
+
expand: Extindeți
|
106
106
|
question: Întrebare
|
107
|
-
remove:
|
107
|
+
remove: Eliminați
|
108
108
|
statement: Declarație
|
109
109
|
up: Mergi în sus
|
110
110
|
separator:
|
@@ -162,6 +162,7 @@ ro:
|
|
162
162
|
sign_up_description: Creați un cont de participant pentru a participa la sondaj
|
163
163
|
title: Completează chestionarul
|
164
164
|
current_step: Pasul %{step}
|
165
|
+
empty: Nicio întrebare configurată pentru acest formular încă.
|
165
166
|
of_total_steps: din %{total_steps}
|
166
167
|
questionnaire_answered:
|
167
168
|
body: Ai completat deja la acest chestionar.
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.push File.expand_path("lib", __dir__)
|
4
|
+
|
5
|
+
# Maintain your gem's version:
|
6
|
+
require "decidim/forms/version"
|
7
|
+
|
8
|
+
# Describe your gem and declare its dependencies:
|
9
|
+
Gem::Specification.new do |s|
|
10
|
+
s.version = Decidim::Forms.version
|
11
|
+
s.authors = ["Josep Jaume Rey Peroy", "Marc Riera Casals", "Oriol Gual Oliva", "Rubén González Valero"]
|
12
|
+
s.email = ["josepjaume@gmail.com", "mrc2407@gmail.com", "oriolgual@gmail.com", "rbngzlv@gmail.com"]
|
13
|
+
s.license = "AGPL-3.0"
|
14
|
+
s.homepage = "https://decidim.org"
|
15
|
+
s.metadata = {
|
16
|
+
"bug_tracker_uri" => "https://github.com/decidim/decidim/issues",
|
17
|
+
"documentation_uri" => "https://docs.decidim.org/",
|
18
|
+
"funding_uri" => "https://opencollective.com/decidim",
|
19
|
+
"homepage_uri" => "https://decidim.org",
|
20
|
+
"source_code_uri" => "https://github.com/decidim/decidim"
|
21
|
+
}
|
22
|
+
s.required_ruby_version = "~> 3.1.0"
|
23
|
+
|
24
|
+
s.name = "decidim-forms"
|
25
|
+
s.summary = "Decidim forms"
|
26
|
+
s.description = "A forms gem for decidim."
|
27
|
+
|
28
|
+
s.files = Dir.chdir(__dir__) do
|
29
|
+
`git ls-files -z`.split("\x0").select do |f|
|
30
|
+
(File.expand_path(f) == __FILE__) ||
|
31
|
+
f.start_with?(*%w(app/ config/ db/ lib/ Rakefile README.md))
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
s.add_dependency "decidim-core", Decidim::Forms.version
|
36
|
+
s.add_dependency "wicked_pdf", "~> 2.1"
|
37
|
+
s.add_dependency "wkhtmltopdf-binary", "~> 0.12"
|
38
|
+
|
39
|
+
s.add_development_dependency "decidim-admin", Decidim::Forms.version
|
40
|
+
s.add_development_dependency "decidim-dev", Decidim::Forms.version
|
41
|
+
end
|
@@ -5,53 +5,54 @@ require "decidim/participatory_processes/test/factories"
|
|
5
5
|
|
6
6
|
FactoryBot.define do
|
7
7
|
factory :questionnaire, class: "Decidim::Forms::Questionnaire" do
|
8
|
-
|
9
|
-
|
10
|
-
Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
11
|
-
generate_localized_title
|
12
|
-
end
|
8
|
+
transient do
|
9
|
+
skip_injection { false }
|
13
10
|
end
|
14
|
-
|
15
|
-
|
11
|
+
title { generate_localized_title(:questionnaire_title, skip_injection:) }
|
12
|
+
description { generate_localized_description(:questionnaire_description, skip_injection:) }
|
13
|
+
tos { generate_localized_title(:questionnaire_tos, skip_injection:) }
|
14
|
+
questionnaire_for { build(:participatory_process, skip_injection:) }
|
16
15
|
salt { SecureRandom.hex(32) }
|
17
16
|
|
18
17
|
trait :with_questions do
|
19
18
|
questions do
|
20
19
|
position = 0
|
21
20
|
qs = %w(short_answer long_answer).collect do |text_question_type|
|
22
|
-
q = build(:questionnaire_question, question_type: text_question_type, position:)
|
21
|
+
q = build(:questionnaire_question, question_type: text_question_type, position:, skip_injection:)
|
23
22
|
position += 1
|
24
23
|
q
|
25
24
|
end
|
26
|
-
qs << build(:questionnaire_question, :with_answer_options, question_type: :single_option, position:)
|
25
|
+
qs << build(:questionnaire_question, :with_answer_options, question_type: :single_option, position:, skip_injection:)
|
27
26
|
qs
|
28
27
|
end
|
29
28
|
end
|
30
29
|
|
31
30
|
trait :with_all_questions do
|
32
|
-
after(:build) do |
|
31
|
+
after(:build) do |questionnaire, evaluator|
|
33
32
|
position = 0
|
34
33
|
%w(short_answer long_answer).collect do |text_question_type|
|
35
34
|
q = create(:questionnaire_question,
|
36
35
|
question_type: text_question_type,
|
37
36
|
position:,
|
38
|
-
questionnaire
|
37
|
+
questionnaire:,
|
38
|
+
skip_injection: evaluator.skip_injection)
|
39
39
|
position += 1
|
40
|
-
|
40
|
+
questionnaire.questions << q
|
41
41
|
end
|
42
42
|
|
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
46
|
position:,
|
47
|
-
questionnaire
|
47
|
+
questionnaire:,
|
48
|
+
skip_injection: evaluator.skip_injection)
|
48
49
|
q.display_conditions.build(
|
49
|
-
condition_question:
|
50
|
+
condition_question: questionnaire.questions[q.position - 1],
|
50
51
|
question: q,
|
51
52
|
condition_type: :answered,
|
52
53
|
mandatory: true
|
53
54
|
)
|
54
|
-
|
55
|
+
questionnaire.questions << q
|
55
56
|
position += 1
|
56
57
|
end
|
57
58
|
|
@@ -60,14 +61,15 @@ FactoryBot.define do
|
|
60
61
|
question_type: matrix_question_type,
|
61
62
|
position:,
|
62
63
|
body: generate_localized_title,
|
63
|
-
questionnaire
|
64
|
+
questionnaire:,
|
65
|
+
skip_injection: evaluator.skip_injection)
|
64
66
|
q.display_conditions.build(
|
65
|
-
condition_question:
|
67
|
+
condition_question: questionnaire.questions[q.position - 1],
|
66
68
|
question: q,
|
67
69
|
condition_type: :answered,
|
68
70
|
mandatory: true
|
69
71
|
)
|
70
|
-
|
72
|
+
questionnaire.questions << q
|
71
73
|
position += 1
|
72
74
|
end
|
73
75
|
end
|
@@ -82,16 +84,13 @@ FactoryBot.define do
|
|
82
84
|
|
83
85
|
factory :questionnaire_question, class: "Decidim::Forms::Question" do
|
84
86
|
transient do
|
87
|
+
skip_injection { false }
|
85
88
|
options { [] }
|
86
89
|
rows { [] }
|
87
90
|
end
|
88
91
|
|
89
|
-
body { generate_localized_title }
|
90
|
-
description
|
91
|
-
Decidim::Faker::Localized.wrapped("<p>", "</p>") do
|
92
|
-
generate_localized_title
|
93
|
-
end
|
94
|
-
end
|
92
|
+
body { generate_localized_title(:questionnaire_question_body, skip_injection:) }
|
93
|
+
description { generate_localized_description(:questionnaire_question_description, skip_injection:) }
|
95
94
|
mandatory { false }
|
96
95
|
position { 0 }
|
97
96
|
question_type { Decidim::Forms::Question::TYPES.first }
|
@@ -119,13 +118,13 @@ FactoryBot.define do
|
|
119
118
|
|
120
119
|
trait :with_answer_options do
|
121
120
|
answer_options do
|
122
|
-
Array.new(3).collect { build(:answer_option) }
|
121
|
+
Array.new(3).collect { build(:answer_option, skip_injection:) }
|
123
122
|
end
|
124
123
|
end
|
125
124
|
|
126
125
|
trait :conditioned do
|
127
126
|
display_conditions do
|
128
|
-
Array.new(3).collect { build(:display_condition) }
|
127
|
+
Array.new(3).collect { build(:display_condition, skip_injection:) }
|
129
128
|
end
|
130
129
|
end
|
131
130
|
|
@@ -139,22 +138,28 @@ FactoryBot.define do
|
|
139
138
|
end
|
140
139
|
|
141
140
|
factory :answer, class: "Decidim::Forms::Answer" do
|
141
|
+
transient do
|
142
|
+
skip_injection { false }
|
143
|
+
end
|
142
144
|
body { "hola" }
|
143
145
|
questionnaire
|
144
|
-
question { create(:questionnaire_question, questionnaire:) }
|
145
|
-
user { create(:user, organization: questionnaire.questionnaire_for.organization) }
|
146
|
+
question { create(:questionnaire_question, questionnaire:, skip_injection:) }
|
147
|
+
user { create(:user, organization: questionnaire.questionnaire_for.organization, skip_injection:) }
|
146
148
|
session_token { Digest::MD5.hexdigest(user.id.to_s) }
|
147
149
|
|
148
150
|
trait :with_attachments do
|
149
|
-
after(:create) do |answer,
|
150
|
-
create :attachment, :with_image, attached_to: answer
|
151
|
-
create :attachment, :with_pdf, attached_to: answer
|
151
|
+
after(:create) do |answer, evaluator|
|
152
|
+
create :attachment, :with_image, attached_to: answer, skip_injection: evaluator.skip_injection
|
153
|
+
create :attachment, :with_pdf, attached_to: answer, skip_injection: evaluator.skip_injection
|
152
154
|
end
|
153
155
|
end
|
154
156
|
end
|
155
157
|
|
156
158
|
factory :answer_option, class: "Decidim::Forms::AnswerOption" do
|
157
|
-
|
159
|
+
transient do
|
160
|
+
skip_injection { false }
|
161
|
+
end
|
162
|
+
question { create(:questionnaire_question, skip_injection:) }
|
158
163
|
body { generate_localized_title }
|
159
164
|
free_text { false }
|
160
165
|
|
@@ -168,31 +173,40 @@ FactoryBot.define do
|
|
168
173
|
end
|
169
174
|
|
170
175
|
factory :answer_choice, class: "Decidim::Forms::AnswerChoice" do
|
176
|
+
transient do
|
177
|
+
skip_injection { false }
|
178
|
+
end
|
171
179
|
answer
|
172
|
-
answer_option { create(:answer_option, question: answer.question) }
|
173
|
-
matrix_row { create(:question_matrix_row, question: answer.question) }
|
180
|
+
answer_option { create(:answer_option, question: answer.question, skip_injection:) }
|
181
|
+
matrix_row { create(:question_matrix_row, question: answer.question, skip_injection:) }
|
174
182
|
end
|
175
183
|
|
176
184
|
factory :question_matrix_row, class: "Decidim::Forms::QuestionMatrixRow" do
|
177
|
-
|
185
|
+
transient do
|
186
|
+
skip_injection { false }
|
187
|
+
end
|
188
|
+
question { create(:questionnaire_question, skip_injection:) }
|
178
189
|
body { generate_localized_title }
|
179
190
|
position { 0 }
|
180
191
|
end
|
181
192
|
|
182
193
|
factory :display_condition, class: "Decidim::Forms::DisplayCondition" do
|
183
|
-
|
184
|
-
|
194
|
+
transient do
|
195
|
+
skip_injection { false }
|
196
|
+
end
|
197
|
+
condition_question { create(:questionnaire_question, skip_injection:) }
|
198
|
+
question { create(:questionnaire_question, position: 1, skip_injection:) }
|
185
199
|
condition_type { :answered }
|
186
200
|
mandatory { true }
|
187
201
|
|
188
202
|
trait :equal do
|
189
203
|
condition_type { :equal }
|
190
|
-
answer_option { create(:answer_option, question: condition_question) }
|
204
|
+
answer_option { create(:answer_option, question: condition_question, skip_injection:) }
|
191
205
|
end
|
192
206
|
|
193
207
|
trait :match do
|
194
208
|
condition_type { :match }
|
195
|
-
condition_value { generate_localized_title }
|
209
|
+
condition_value { generate_localized_title(:condition_value, skip_injection:) }
|
196
210
|
end
|
197
211
|
end
|
198
212
|
end
|
@@ -8,7 +8,7 @@ shared_examples_for "has questionnaire" do
|
|
8
8
|
visit questionnaire_public_path
|
9
9
|
|
10
10
|
expect(page).to have_i18n_content(questionnaire.title)
|
11
|
-
expect(page).to have_i18n_content(questionnaire.description)
|
11
|
+
expect(page).to have_i18n_content(questionnaire.description, strip_tags: true)
|
12
12
|
|
13
13
|
expect(page).not_to have_css(".form.answer-questionnaire")
|
14
14
|
|
@@ -39,7 +39,7 @@ shared_examples_for "has questionnaire" do
|
|
39
39
|
visit questionnaire_public_path
|
40
40
|
|
41
41
|
expect(page).to have_i18n_content(questionnaire.title)
|
42
|
-
expect(page).to have_i18n_content(questionnaire.description)
|
42
|
+
expect(page).to have_i18n_content(questionnaire.description, strip_tags: true)
|
43
43
|
|
44
44
|
fill_in question.body["en"], with: "My first answer"
|
45
45
|
|
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-forms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.28.
|
4
|
+
version: 0.28.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
8
8
|
- Marc Riera Casals
|
9
9
|
- Oriol Gual Oliva
|
10
10
|
- Rubén González Valero
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2024-04-30 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: decidim-core
|
@@ -19,14 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.28.
|
22
|
+
version: 0.28.1
|
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.28.
|
29
|
+
version: 0.28.1
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: wicked_pdf
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -61,28 +61,28 @@ dependencies:
|
|
61
61
|
requirements:
|
62
62
|
- - '='
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 0.28.
|
64
|
+
version: 0.28.1
|
65
65
|
type: :development
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - '='
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: 0.28.
|
71
|
+
version: 0.28.1
|
72
72
|
- !ruby/object:Gem::Dependency
|
73
73
|
name: decidim-dev
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
75
75
|
requirements:
|
76
76
|
- - '='
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version: 0.28.
|
78
|
+
version: 0.28.1
|
79
79
|
type: :development
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: !ruby/object:Gem::Requirement
|
82
82
|
requirements:
|
83
83
|
- - '='
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.28.
|
85
|
+
version: 0.28.1
|
86
86
|
description: A forms gem for decidim.
|
87
87
|
email:
|
88
88
|
- josepjaume@gmail.com
|
@@ -188,7 +188,6 @@ files:
|
|
188
188
|
- app/views/decidim/forms/questionnaires/show.html.erb
|
189
189
|
- app/views/layouts/decidim/forms/admin/questionnaires/questionnaire_answers.html.erb
|
190
190
|
- config/assets.rb
|
191
|
-
- config/environment.rb
|
192
191
|
- config/initializers/wicked_pdf.rb
|
193
192
|
- config/locales/am-ET.yml
|
194
193
|
- config/locales/ar-SA.yml
|
@@ -222,6 +221,7 @@ files:
|
|
222
221
|
- config/locales/ga-IE.yml
|
223
222
|
- config/locales/gl.yml
|
224
223
|
- config/locales/gn-PY.yml
|
224
|
+
- config/locales/he-IL.yml
|
225
225
|
- config/locales/hr-HR.yml
|
226
226
|
- config/locales/hr.yml
|
227
227
|
- config/locales/hu.yml
|
@@ -282,6 +282,7 @@ files:
|
|
282
282
|
- db/migrate/20201110152921_add_salt_to_decidim_forms_questionnaires.rb
|
283
283
|
- db/migrate/20210208094442_add_max_characters_to_decidim_forms_questions.rb
|
284
284
|
- db/migrate/20210616153042_set_position_to_question_matrix_rows.rb
|
285
|
+
- decidim-forms.gemspec
|
285
286
|
- lib/decidim/api/answer_option_type.rb
|
286
287
|
- lib/decidim/api/question_type.rb
|
287
288
|
- lib/decidim/api/questionnaire_entity_interface.rb
|
@@ -314,23 +315,23 @@ metadata:
|
|
314
315
|
funding_uri: https://opencollective.com/decidim
|
315
316
|
homepage_uri: https://decidim.org
|
316
317
|
source_code_uri: https://github.com/decidim/decidim
|
317
|
-
post_install_message:
|
318
|
+
post_install_message:
|
318
319
|
rdoc_options: []
|
319
320
|
require_paths:
|
320
321
|
- lib
|
321
322
|
required_ruby_version: !ruby/object:Gem::Requirement
|
322
323
|
requirements:
|
323
|
-
- - "
|
324
|
+
- - "~>"
|
324
325
|
- !ruby/object:Gem::Version
|
325
|
-
version:
|
326
|
+
version: 3.1.0
|
326
327
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
327
328
|
requirements:
|
328
329
|
- - ">="
|
329
330
|
- !ruby/object:Gem::Version
|
330
331
|
version: '0'
|
331
332
|
requirements: []
|
332
|
-
rubygems_version: 3.
|
333
|
-
signing_key:
|
333
|
+
rubygems_version: 3.5.9
|
334
|
+
signing_key:
|
334
335
|
specification_version: 4
|
335
336
|
summary: Decidim forms
|
336
337
|
test_files: []
|
data/config/environment.rb
DELETED