decidim-forms 0.30.2 → 0.31.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -10
- data/app/cells/decidim/forms/matrix_readonly/show.erb +1 -1
- data/app/cells/decidim/forms/matrix_readonly_cell.rb +3 -3
- data/app/cells/decidim/forms/question_readonly/show.erb +5 -5
- data/app/cells/decidim/forms/question_readonly/title_and_description.erb +3 -3
- data/app/cells/decidim/forms/response_readonly_cell.rb +9 -0
- data/app/cells/decidim/forms/step_navigation/show.erb +3 -3
- data/app/cells/decidim/forms/step_navigation_cell.rb +3 -3
- data/app/commands/decidim/forms/admin/update_questions.rb +6 -6
- data/app/commands/decidim/forms/{answer_questionnaire.rb → response_questionnaire.rb} +35 -35
- data/app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb +12 -12
- data/app/controllers/decidim/forms/admin/concerns/{has_questionnaire_answers.rb → has_questionnaire_responses.rb} +23 -19
- data/app/controllers/decidim/forms/concerns/has_questionnaire.rb +38 -33
- data/app/forms/decidim/forms/admin/display_condition_form.rb +14 -14
- data/app/forms/decidim/forms/admin/question_form.rb +3 -3
- data/app/forms/decidim/forms/admin/{answer_option_form.rb → response_option_form.rb} +3 -3
- data/app/forms/decidim/forms/questionnaire_form.rb +8 -9
- data/app/forms/decidim/forms/{answer_choice_form.rb → response_choice_form.rb} +5 -5
- data/app/forms/decidim/forms/{answer_form.rb → response_form.rb} +9 -9
- data/app/helpers/decidim/forms/admin/application_helper.rb +2 -2
- data/app/helpers/decidim/forms/admin/concerns/{has_questionnaire_answers_pagination_helper.rb → has_questionnaire_responses_pagination_helper.rb} +4 -4
- data/app/helpers/decidim/forms/admin/concerns/{has_questionnaire_answers_url_helper.rb → has_questionnaire_responses_url_helper.rb} +5 -5
- data/app/helpers/decidim/forms/admin/questionnaire_responses_helper.rb +32 -0
- data/app/helpers/decidim/forms/application_helper.rb +1 -2
- data/app/jobs/decidim/forms/{export_questionnaire_answers_job.rb → export_questionnaire_responses_job.rb} +5 -5
- data/app/models/decidim/forms/display_condition.rb +20 -20
- data/app/models/decidim/forms/question.rb +14 -13
- data/app/models/decidim/forms/question_matrix_row.rb +1 -1
- data/app/models/decidim/forms/questionnaire.rb +11 -6
- data/app/models/decidim/forms/{answer.rb → response.rb} +9 -9
- data/app/models/decidim/forms/response_choice.rb +22 -0
- data/app/models/decidim/forms/{answer_option.rb → response_option.rb} +5 -5
- data/app/packs/entrypoints/decidim_forms_admin.js +3 -3
- data/app/packs/src/decidim/forms/admin/collapsible_questions.js +12 -10
- data/app/packs/src/decidim/forms/admin/forms.js +35 -35
- data/app/packs/src/decidim/forms/admin/{publish_answers_buttons.js → publish_responses_buttons.js} +12 -12
- data/app/packs/src/decidim/forms/display_conditions.component.js +12 -12
- data/app/packs/src/decidim/forms/forms.js +4 -4
- data/app/packs/stylesheets/decidim/forms/forms.scss +2 -2
- data/app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb +13 -13
- data/app/presenters/decidim/forms/admin/{questionnaire_answer_presenter.rb → questionnaire_response_presenter.rb} +15 -15
- data/app/presenters/decidim/forms/admin_log/question_presenter.rb +3 -3
- data/app/presenters/decidim/forms/{answer_option_presenter.rb → response_option_presenter.rb} +2 -2
- data/app/queries/decidim/forms/questionnaire_participant.rb +5 -5
- data/app/queries/decidim/forms/questionnaire_participants.rb +6 -6
- data/app/queries/decidim/forms/questionnaire_user_responses.rb +32 -0
- data/app/views/decidim/forms/admin/questionnaires/_display_condition.html.erb +9 -9
- data/app/views/decidim/forms/admin/questionnaires/_form.html.erb +2 -2
- data/app/views/decidim/forms/admin/questionnaires/_matrix_row.html.erb +3 -3
- data/app/views/decidim/forms/admin/questionnaires/_question.html.erb +16 -16
- data/app/views/decidim/forms/admin/questionnaires/_questions_form.html.erb +11 -10
- data/app/views/decidim/forms/admin/questionnaires/{_answer_option.html.erb → _response_option.html.erb} +7 -7
- data/app/views/decidim/forms/admin/questionnaires/_response_option_template.html.erb +7 -0
- data/app/views/decidim/forms/admin/questionnaires/_separator.html.erb +10 -7
- data/app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb +7 -7
- data/app/views/decidim/forms/admin/questionnaires/edit.html.erb +1 -1
- data/app/views/decidim/forms/admin/questionnaires/edit_questions.html.erb +8 -8
- data/app/views/decidim/forms/admin/questionnaires/responses/index.html.erb +80 -0
- data/app/views/decidim/forms/admin/questionnaires/responses/show.html.erb +43 -0
- data/app/views/decidim/forms/questionnaires/_questionnaire.html.erb +22 -26
- data/app/views/decidim/forms/questionnaires/_questionnaire_readonly.html.erb +8 -3
- data/app/views/decidim/forms/questionnaires/_response.html.erb +61 -0
- data/app/views/decidim/forms/questionnaires/edit.html.erb +2 -2
- data/app/views/decidim/forms/questionnaires/responses/_files.html.erb +1 -0
- data/app/views/decidim/forms/questionnaires/responses/_long_response.html.erb +3 -0
- data/app/views/decidim/forms/questionnaires/{answers → responses}/_matrix_multiple.html.erb +16 -15
- data/app/views/decidim/forms/questionnaires/{answers → responses}/_matrix_single.html.erb +17 -16
- data/app/views/decidim/forms/questionnaires/responses/_multiple_option.html.erb +26 -0
- data/app/views/decidim/forms/questionnaires/responses/_separator.html.erb +1 -0
- data/app/views/decidim/forms/questionnaires/responses/_short_response.html.erb +3 -0
- data/app/views/decidim/forms/questionnaires/responses/_single_option.html.erb +33 -0
- data/app/views/decidim/forms/questionnaires/responses/_sorting.html.erb +26 -0
- data/app/views/decidim/forms/questionnaires/responses/_title_and_description.html.erb +1 -0
- data/app/views/decidim/forms/questionnaires/show.html.erb +10 -10
- data/config/assets.rb +2 -2
- data/config/locales/ar.yml +0 -22
- data/config/locales/bg.yml +3 -36
- data/config/locales/ca-IT.yml +73 -73
- data/config/locales/ca.yml +73 -73
- data/config/locales/cs.yml +72 -75
- data/config/locales/de.yml +72 -72
- data/config/locales/el.yml +3 -36
- data/config/locales/en.yml +83 -83
- data/config/locales/es-MX.yml +75 -75
- data/config/locales/es-PY.yml +75 -75
- data/config/locales/es.yml +73 -73
- data/config/locales/eu.yml +71 -71
- data/config/locales/fi-plain.yml +71 -71
- data/config/locales/fi.yml +69 -69
- data/config/locales/fr-CA.yml +70 -67
- data/config/locales/fr.yml +70 -67
- data/config/locales/ga-IE.yml +0 -7
- data/config/locales/gl.yml +0 -22
- data/config/locales/hu.yml +0 -22
- data/config/locales/id-ID.yml +0 -22
- data/config/locales/it.yml +3 -40
- data/config/locales/ja.yml +80 -80
- data/config/locales/lb.yml +3 -36
- data/config/locales/lt.yml +3 -36
- data/config/locales/lv.yml +0 -22
- data/config/locales/nl.yml +3 -36
- data/config/locales/no.yml +3 -36
- data/config/locales/pl.yml +3 -36
- data/config/locales/pt-BR.yml +3 -36
- data/config/locales/pt.yml +3 -36
- data/config/locales/ro-RO.yml +22 -51
- data/config/locales/ru.yml +0 -9
- data/config/locales/sk.yml +0 -22
- data/config/locales/sl.yml +0 -5
- data/config/locales/sv.yml +82 -54
- data/config/locales/tr-TR.yml +3 -36
- data/config/locales/zh-CN.yml +3 -36
- data/config/locales/zh-TW.yml +3 -36
- data/db/migrate/20190315203056_add_session_token_to_decidim_forms_answers.rb +1 -1
- data/db/migrate/20250314150250_rename_answer_to_response_in_decidim_forms.rb +30 -0
- data/db/migrate/20250319130003_change_question_types_in_questions.rb +14 -0
- data/lib/decidim/api/question_matrix_row_type.rb +13 -0
- data/lib/decidim/api/question_type.rb +4 -3
- data/lib/decidim/api/questionnaire_type.rb +1 -0
- data/lib/decidim/api/response_option_type.rb +13 -0
- data/lib/decidim/exporters/form_pdf.rb +33 -33
- data/lib/decidim/forms/api.rb +2 -1
- data/lib/decidim/forms/{download_your_data_user_answers_serializer.rb → download_your_data_user_responses_serializer.rb} +3 -3
- data/lib/decidim/forms/engine.rb +2 -2
- data/lib/decidim/forms/test/factories.rb +24 -24
- data/lib/decidim/forms/test/shared_examples/has_questionnaire.rb +176 -176
- data/lib/decidim/forms/test/shared_examples/manage_questionnaire_responses.rb +159 -0
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb +19 -19
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb +44 -44
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb +10 -10
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb +18 -18
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +4 -4
- data/lib/decidim/forms/test.rb +1 -1
- data/lib/decidim/forms/user_responses_serializer.rb +110 -0
- data/lib/decidim/forms/version.rb +1 -1
- data/lib/decidim/forms.rb +2 -2
- metadata +48 -45
- data/app/cells/decidim/forms/answer_readonly_cell.rb +0 -9
- data/app/helpers/decidim/forms/admin/questionnaire_answers_helper.rb +0 -30
- data/app/models/decidim/forms/answer_choice.rb +0 -22
- data/app/queries/decidim/forms/questionnaire_user_answers.rb +0 -32
- data/app/views/decidim/forms/admin/questionnaires/_answer_option_template.html.erb +0 -7
- data/app/views/decidim/forms/admin/questionnaires/answers/index.html.erb +0 -49
- data/app/views/decidim/forms/admin/questionnaires/answers/show.html.erb +0 -43
- data/app/views/decidim/forms/questionnaires/_answer.html.erb +0 -61
- data/app/views/decidim/forms/questionnaires/answers/_files.html.erb +0 -1
- data/app/views/decidim/forms/questionnaires/answers/_long_answer.html.erb +0 -3
- data/app/views/decidim/forms/questionnaires/answers/_multiple_option.html.erb +0 -25
- data/app/views/decidim/forms/questionnaires/answers/_separator.html.erb +0 -1
- data/app/views/decidim/forms/questionnaires/answers/_short_answer.html.erb +0 -3
- data/app/views/decidim/forms/questionnaires/answers/_single_option.html.erb +0 -32
- data/app/views/decidim/forms/questionnaires/answers/_sorting.html.erb +0 -26
- data/app/views/decidim/forms/questionnaires/answers/_title_and_description.html.erb +0 -1
- data/lib/decidim/api/answer_option_type.rb +0 -13
- data/lib/decidim/forms/test/shared_examples/manage_questionnaire_answers.rb +0 -149
- data/lib/decidim/forms/user_answers_serializer.rb +0 -105
- /data/app/cells/decidim/forms/{answer_readonly → response_readonly}/show.erb +0 -0
@@ -17,12 +17,12 @@ FactoryBot.define do
|
|
17
17
|
trait :with_questions do
|
18
18
|
questions do
|
19
19
|
position = 0
|
20
|
-
qs = %w(
|
20
|
+
qs = %w(short_response long_response).collect do |text_question_type|
|
21
21
|
q = build(:questionnaire_question, question_type: text_question_type, position:, skip_injection:)
|
22
22
|
position += 1
|
23
23
|
q
|
24
24
|
end
|
25
|
-
qs << build(:questionnaire_question, :
|
25
|
+
qs << build(:questionnaire_question, :with_response_options, question_type: :single_option, position:, skip_injection:)
|
26
26
|
qs
|
27
27
|
end
|
28
28
|
end
|
@@ -30,7 +30,7 @@ FactoryBot.define do
|
|
30
30
|
trait :with_all_questions do
|
31
31
|
after(:build) do |questionnaire, evaluator|
|
32
32
|
position = 0
|
33
|
-
%w(
|
33
|
+
%w(short_response long_response).collect do |text_question_type|
|
34
34
|
q = create(:questionnaire_question,
|
35
35
|
question_type: text_question_type,
|
36
36
|
position:,
|
@@ -41,7 +41,7 @@ FactoryBot.define do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
%w(single_option multiple_option).each do |option_question_type|
|
44
|
-
q = create(:questionnaire_question, :
|
44
|
+
q = create(:questionnaire_question, :with_response_options,
|
45
45
|
question_type: option_question_type,
|
46
46
|
position:,
|
47
47
|
questionnaire:,
|
@@ -49,7 +49,7 @@ FactoryBot.define do
|
|
49
49
|
q.display_conditions.build(
|
50
50
|
condition_question: questionnaire.questions[q.position - 1],
|
51
51
|
question: q,
|
52
|
-
condition_type: :
|
52
|
+
condition_type: :responded,
|
53
53
|
mandatory: true
|
54
54
|
)
|
55
55
|
questionnaire.questions << q
|
@@ -57,7 +57,7 @@ FactoryBot.define do
|
|
57
57
|
end
|
58
58
|
|
59
59
|
%w(matrix_single matrix_multiple).collect do |matrix_question_type|
|
60
|
-
q = build(:questionnaire_question, :
|
60
|
+
q = build(:questionnaire_question, :with_response_options,
|
61
61
|
question_type: matrix_question_type,
|
62
62
|
position:,
|
63
63
|
body: generate_localized_title,
|
@@ -66,7 +66,7 @@ FactoryBot.define do
|
|
66
66
|
q.display_conditions.build(
|
67
67
|
condition_question: questionnaire.questions[q.position - 1],
|
68
68
|
question: q,
|
69
|
-
condition_type: :
|
69
|
+
condition_type: :responded,
|
70
70
|
mandatory: true
|
71
71
|
)
|
72
72
|
questionnaire.questions << q
|
@@ -97,9 +97,9 @@ FactoryBot.define do
|
|
97
97
|
questionnaire
|
98
98
|
|
99
99
|
before(:create) do |question, evaluator|
|
100
|
-
if question.
|
100
|
+
if question.response_options.empty?
|
101
101
|
evaluator.options.each do |option|
|
102
|
-
question.
|
102
|
+
question.response_options.build(
|
103
103
|
body: option["body"],
|
104
104
|
free_text: option["free_text"]
|
105
105
|
)
|
@@ -116,9 +116,9 @@ FactoryBot.define do
|
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
119
|
-
trait :
|
120
|
-
|
121
|
-
Array.new(3).collect { build(:
|
119
|
+
trait :with_response_options do
|
120
|
+
response_options do
|
121
|
+
Array.new(3).collect { build(:response_option, skip_injection:) }
|
122
122
|
end
|
123
123
|
end
|
124
124
|
|
@@ -137,7 +137,7 @@ FactoryBot.define do
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
factory :
|
140
|
+
factory :response, class: "Decidim::Forms::Response" do
|
141
141
|
transient do
|
142
142
|
skip_injection { false }
|
143
143
|
end
|
@@ -145,17 +145,17 @@ FactoryBot.define do
|
|
145
145
|
questionnaire
|
146
146
|
question { create(:questionnaire_question, questionnaire:, skip_injection:) }
|
147
147
|
user { create(:user, organization: questionnaire.questionnaire_for.organization, skip_injection:) }
|
148
|
-
session_token { Digest::
|
148
|
+
session_token { Digest::SHA256.hexdigest(user.id.to_s) }
|
149
149
|
|
150
150
|
trait :with_attachments do
|
151
|
-
after(:create) do |
|
152
|
-
create(:attachment, :with_image, attached_to:
|
153
|
-
create(:attachment, :with_pdf, attached_to:
|
151
|
+
after(:create) do |response, evaluator|
|
152
|
+
create(:attachment, :with_image, attached_to: response, skip_injection: evaluator.skip_injection)
|
153
|
+
create(:attachment, :with_pdf, attached_to: response, skip_injection: evaluator.skip_injection)
|
154
154
|
end
|
155
155
|
end
|
156
156
|
end
|
157
157
|
|
158
|
-
factory :
|
158
|
+
factory :response_option, class: "Decidim::Forms::ResponseOption" do
|
159
159
|
transient do
|
160
160
|
skip_injection { false }
|
161
161
|
end
|
@@ -172,13 +172,13 @@ FactoryBot.define do
|
|
172
172
|
end
|
173
173
|
end
|
174
174
|
|
175
|
-
factory :
|
175
|
+
factory :response_choice, class: "Decidim::Forms::ResponseChoice" do
|
176
176
|
transient do
|
177
177
|
skip_injection { false }
|
178
178
|
end
|
179
|
-
|
180
|
-
|
181
|
-
matrix_row { create(:question_matrix_row, question:
|
179
|
+
response
|
180
|
+
response_option { create(:response_option, question: response.question, skip_injection:) }
|
181
|
+
matrix_row { create(:question_matrix_row, question: response.question, skip_injection:) }
|
182
182
|
end
|
183
183
|
|
184
184
|
factory :question_matrix_row, class: "Decidim::Forms::QuestionMatrixRow" do
|
@@ -196,12 +196,12 @@ FactoryBot.define do
|
|
196
196
|
end
|
197
197
|
condition_question { create(:questionnaire_question, skip_injection:) }
|
198
198
|
question { create(:questionnaire_question, position: 1, skip_injection:) }
|
199
|
-
condition_type { :
|
199
|
+
condition_type { :responded }
|
200
200
|
mandatory { true }
|
201
201
|
|
202
202
|
trait :equal do
|
203
203
|
condition_type { :equal }
|
204
|
-
|
204
|
+
response_option { create(:response_option, question: condition_question, skip_injection:) }
|
205
205
|
end
|
206
206
|
|
207
207
|
trait :match do
|