decidim-forms 0.30.9 → 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 +15 -15
- 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 +18 -16
- 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 -11
- 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 +47 -66
- 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 +8 -29
- 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_response_presenter.rb +89 -0
- 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 +25 -15
- data/app/views/decidim/forms/admin/questionnaires/_questions_form.html.erb +14 -21
- data/app/views/decidim/forms/admin/questionnaires/_response_option.html.erb +45 -0
- data/app/views/decidim/forms/admin/questionnaires/_response_option_template.html.erb +7 -0
- data/app/views/decidim/forms/admin/questionnaires/_separator.html.erb +15 -5
- data/app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb +15 -5
- 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 +24 -22
- 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 +2 -22
- data/config/locales/bg.yml +10 -36
- data/config/locales/ca-IT.yml +82 -76
- data/config/locales/ca.yml +82 -76
- data/config/locales/cs.yml +79 -76
- data/config/locales/de.yml +80 -74
- data/config/locales/el.yml +10 -36
- data/config/locales/en.yml +90 -84
- data/config/locales/es-MX.yml +82 -76
- data/config/locales/es-PY.yml +82 -76
- data/config/locales/es.yml +80 -74
- data/config/locales/eu.yml +83 -77
- data/config/locales/fi-plain.yml +78 -72
- data/config/locales/fi.yml +76 -70
- data/config/locales/fr-CA.yml +72 -70
- data/config/locales/fr.yml +72 -70
- data/config/locales/ga-IE.yml +4 -7
- data/config/locales/gl.yml +4 -22
- data/config/locales/hu.yml +4 -22
- data/config/locales/id-ID.yml +2 -22
- data/config/locales/it.yml +8 -40
- data/config/locales/ja.yml +87 -81
- data/config/locales/lb.yml +8 -36
- data/config/locales/lt.yml +10 -36
- data/config/locales/lv.yml +4 -22
- data/config/locales/nl.yml +10 -36
- data/config/locales/no.yml +10 -36
- data/config/locales/pl.yml +10 -36
- data/config/locales/pt-BR.yml +10 -120
- data/config/locales/pt.yml +8 -36
- data/config/locales/ro-RO.yml +30 -52
- data/config/locales/ru.yml +2 -9
- data/config/locales/sk.yml +3 -183
- data/config/locales/sl.yml +0 -5
- data/config/locales/sv.yml +77 -70
- data/config/locales/tr-TR.yml +8 -36
- data/config/locales/val-ES.yml +2 -0
- data/config/locales/zh-CN.yml +8 -36
- data/config/locales/zh-TW.yml +10 -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 +35 -43
- 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 +178 -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 -90
- 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 +43 -140
- data/lib/decidim/forms/test/shared_examples/manage_questionnaires.rb +4 -6
- 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 -46
- 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/presenters/decidim/forms/admin/questionnaire_answer_presenter.rb +0 -112
- data/app/queries/decidim/forms/questionnaire_user_answers.rb +0 -32
- data/app/views/decidim/forms/admin/questionnaires/_answer_option.html.erb +0 -45
- 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 -60
- 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/test/shared_examples/manage_questionnaires/draggable_behavior.rb +0 -47
- data/lib/decidim/forms/user_answers_serializer.rb +0 -105
- /data/app/cells/decidim/forms/{answer_readonly → response_readonly}/show.erb +0 -0
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.
|
|
4
|
+
version: 0.31.0.rc1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Josep Jaume Rey Peroy
|
|
@@ -11,7 +11,7 @@ authors:
|
|
|
11
11
|
autorequire:
|
|
12
12
|
bindir: bin
|
|
13
13
|
cert_chain: []
|
|
14
|
-
date:
|
|
14
|
+
date: 2025-09-25 00:00:00.000000000 Z
|
|
15
15
|
dependencies:
|
|
16
16
|
- !ruby/object:Gem::Dependency
|
|
17
17
|
name: decidim-core
|
|
@@ -19,42 +19,42 @@ dependencies:
|
|
|
19
19
|
requirements:
|
|
20
20
|
- - '='
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: 0.
|
|
22
|
+
version: 0.31.0.rc1
|
|
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.
|
|
29
|
+
version: 0.31.0.rc1
|
|
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.
|
|
36
|
+
version: 0.31.0.rc1
|
|
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.
|
|
43
|
+
version: 0.31.0.rc1
|
|
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.
|
|
50
|
+
version: 0.31.0.rc1
|
|
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.
|
|
57
|
+
version: 0.31.0.rc1
|
|
58
58
|
description: A forms gem for decidim.
|
|
59
59
|
email:
|
|
60
60
|
- josepjaume@gmail.com
|
|
@@ -67,45 +67,45 @@ extra_rdoc_files: []
|
|
|
67
67
|
files:
|
|
68
68
|
- README.md
|
|
69
69
|
- Rakefile
|
|
70
|
-
- app/cells/decidim/forms/answer_readonly/show.erb
|
|
71
|
-
- app/cells/decidim/forms/answer_readonly_cell.rb
|
|
72
70
|
- app/cells/decidim/forms/matrix_readonly/show.erb
|
|
73
71
|
- app/cells/decidim/forms/matrix_readonly_cell.rb
|
|
74
72
|
- app/cells/decidim/forms/question_readonly/show.erb
|
|
75
73
|
- app/cells/decidim/forms/question_readonly/title_and_description.erb
|
|
76
74
|
- app/cells/decidim/forms/question_readonly_cell.rb
|
|
75
|
+
- app/cells/decidim/forms/response_readonly/show.erb
|
|
76
|
+
- app/cells/decidim/forms/response_readonly_cell.rb
|
|
77
77
|
- app/cells/decidim/forms/step_navigation/show.erb
|
|
78
78
|
- app/cells/decidim/forms/step_navigation_cell.rb
|
|
79
79
|
- app/commands/decidim/forms/admin/update_questionnaire.rb
|
|
80
80
|
- app/commands/decidim/forms/admin/update_questions.rb
|
|
81
|
-
- app/commands/decidim/forms/
|
|
81
|
+
- app/commands/decidim/forms/response_questionnaire.rb
|
|
82
82
|
- app/controllers/decidim/forms/admin/concerns/has_questionnaire.rb
|
|
83
|
-
- app/controllers/decidim/forms/admin/concerns/
|
|
83
|
+
- app/controllers/decidim/forms/admin/concerns/has_questionnaire_responses.rb
|
|
84
84
|
- app/controllers/decidim/forms/concerns/has_questionnaire.rb
|
|
85
|
-
- app/forms/decidim/forms/admin/answer_option_form.rb
|
|
86
85
|
- app/forms/decidim/forms/admin/display_condition_form.rb
|
|
87
86
|
- app/forms/decidim/forms/admin/question_form.rb
|
|
88
87
|
- app/forms/decidim/forms/admin/question_matrix_row_form.rb
|
|
89
88
|
- app/forms/decidim/forms/admin/questionnaire_form.rb
|
|
90
89
|
- app/forms/decidim/forms/admin/questions_form.rb
|
|
91
|
-
- app/forms/decidim/forms/
|
|
92
|
-
- app/forms/decidim/forms/answer_form.rb
|
|
90
|
+
- app/forms/decidim/forms/admin/response_option_form.rb
|
|
93
91
|
- app/forms/decidim/forms/questionnaire_form.rb
|
|
92
|
+
- app/forms/decidim/forms/response_choice_form.rb
|
|
93
|
+
- app/forms/decidim/forms/response_form.rb
|
|
94
94
|
- app/helpers/decidim/forms/admin/application_helper.rb
|
|
95
|
-
- app/helpers/decidim/forms/admin/concerns/
|
|
96
|
-
- app/helpers/decidim/forms/admin/concerns/
|
|
97
|
-
- app/helpers/decidim/forms/admin/
|
|
95
|
+
- app/helpers/decidim/forms/admin/concerns/has_questionnaire_responses_pagination_helper.rb
|
|
96
|
+
- app/helpers/decidim/forms/admin/concerns/has_questionnaire_responses_url_helper.rb
|
|
97
|
+
- app/helpers/decidim/forms/admin/questionnaire_responses_helper.rb
|
|
98
98
|
- app/helpers/decidim/forms/application_helper.rb
|
|
99
|
-
- app/jobs/decidim/forms/
|
|
99
|
+
- app/jobs/decidim/forms/export_questionnaire_responses_job.rb
|
|
100
100
|
- app/models/concerns/decidim/forms/has_questionnaire.rb
|
|
101
|
-
- app/models/decidim/forms/answer.rb
|
|
102
|
-
- app/models/decidim/forms/answer_choice.rb
|
|
103
|
-
- app/models/decidim/forms/answer_option.rb
|
|
104
101
|
- app/models/decidim/forms/application_record.rb
|
|
105
102
|
- app/models/decidim/forms/display_condition.rb
|
|
106
103
|
- app/models/decidim/forms/question.rb
|
|
107
104
|
- app/models/decidim/forms/question_matrix_row.rb
|
|
108
105
|
- app/models/decidim/forms/questionnaire.rb
|
|
106
|
+
- app/models/decidim/forms/response.rb
|
|
107
|
+
- app/models/decidim/forms/response_choice.rb
|
|
108
|
+
- app/models/decidim/forms/response_option.rb
|
|
109
109
|
- app/packs/entrypoints/decidim_forms.js
|
|
110
110
|
- app/packs/entrypoints/decidim_forms_admin.js
|
|
111
111
|
- app/packs/images/decidim/surveys/decidim_surveys.svg
|
|
@@ -115,23 +115,21 @@ files:
|
|
|
115
115
|
- app/packs/src/decidim/forms/admin/collapsible_questions.js
|
|
116
116
|
- app/packs/src/decidim/forms/admin/forms.js
|
|
117
117
|
- app/packs/src/decidim/forms/admin/live_text_update.component.js
|
|
118
|
-
- app/packs/src/decidim/forms/admin/
|
|
118
|
+
- app/packs/src/decidim/forms/admin/publish_responses_buttons.js
|
|
119
119
|
- app/packs/src/decidim/forms/display_conditions.component.js
|
|
120
120
|
- app/packs/src/decidim/forms/forms.js
|
|
121
121
|
- app/packs/src/decidim/forms/max_choices_alert.component.js
|
|
122
122
|
- app/packs/src/decidim/forms/option_attached_inputs.component.js
|
|
123
123
|
- app/packs/stylesheets/decidim/forms/forms.scss
|
|
124
|
-
- app/presenters/decidim/forms/admin/questionnaire_answer_presenter.rb
|
|
125
124
|
- app/presenters/decidim/forms/admin/questionnaire_participant_presenter.rb
|
|
125
|
+
- app/presenters/decidim/forms/admin/questionnaire_response_presenter.rb
|
|
126
126
|
- app/presenters/decidim/forms/admin_log/question_presenter.rb
|
|
127
127
|
- app/presenters/decidim/forms/admin_log/questionnaire_presenter.rb
|
|
128
|
-
- app/presenters/decidim/forms/answer_option_presenter.rb
|
|
129
128
|
- app/presenters/decidim/forms/question_presenter.rb
|
|
129
|
+
- app/presenters/decidim/forms/response_option_presenter.rb
|
|
130
130
|
- app/queries/decidim/forms/questionnaire_participant.rb
|
|
131
131
|
- app/queries/decidim/forms/questionnaire_participants.rb
|
|
132
|
-
- app/queries/decidim/forms/
|
|
133
|
-
- app/views/decidim/forms/admin/questionnaires/_answer_option.html.erb
|
|
134
|
-
- app/views/decidim/forms/admin/questionnaires/_answer_option_template.html.erb
|
|
132
|
+
- app/queries/decidim/forms/questionnaire_user_responses.rb
|
|
135
133
|
- app/views/decidim/forms/admin/questionnaires/_display_condition.html.erb
|
|
136
134
|
- app/views/decidim/forms/admin/questionnaires/_display_condition_template.html.erb
|
|
137
135
|
- app/views/decidim/forms/admin/questionnaires/_form.html.erb
|
|
@@ -139,26 +137,28 @@ files:
|
|
|
139
137
|
- app/views/decidim/forms/admin/questionnaires/_matrix_row_template.html.erb
|
|
140
138
|
- app/views/decidim/forms/admin/questionnaires/_question.html.erb
|
|
141
139
|
- app/views/decidim/forms/admin/questionnaires/_questions_form.html.erb
|
|
140
|
+
- app/views/decidim/forms/admin/questionnaires/_response_option.html.erb
|
|
141
|
+
- app/views/decidim/forms/admin/questionnaires/_response_option_template.html.erb
|
|
142
142
|
- app/views/decidim/forms/admin/questionnaires/_separator.html.erb
|
|
143
143
|
- app/views/decidim/forms/admin/questionnaires/_title_and_description.html.erb
|
|
144
|
-
- app/views/decidim/forms/admin/questionnaires/answers/index.html.erb
|
|
145
|
-
- app/views/decidim/forms/admin/questionnaires/answers/show.html.erb
|
|
146
144
|
- app/views/decidim/forms/admin/questionnaires/edit.html.erb
|
|
147
145
|
- app/views/decidim/forms/admin/questionnaires/edit_questions.html.erb
|
|
148
|
-
- app/views/decidim/forms/questionnaires/
|
|
146
|
+
- app/views/decidim/forms/admin/questionnaires/responses/index.html.erb
|
|
147
|
+
- app/views/decidim/forms/admin/questionnaires/responses/show.html.erb
|
|
149
148
|
- app/views/decidim/forms/questionnaires/_questionnaire.html.erb
|
|
150
149
|
- app/views/decidim/forms/questionnaires/_questionnaire_readonly.html.erb
|
|
151
|
-
- app/views/decidim/forms/questionnaires/
|
|
152
|
-
- app/views/decidim/forms/questionnaires/answers/_long_answer.html.erb
|
|
153
|
-
- app/views/decidim/forms/questionnaires/answers/_matrix_multiple.html.erb
|
|
154
|
-
- app/views/decidim/forms/questionnaires/answers/_matrix_single.html.erb
|
|
155
|
-
- app/views/decidim/forms/questionnaires/answers/_multiple_option.html.erb
|
|
156
|
-
- app/views/decidim/forms/questionnaires/answers/_separator.html.erb
|
|
157
|
-
- app/views/decidim/forms/questionnaires/answers/_short_answer.html.erb
|
|
158
|
-
- app/views/decidim/forms/questionnaires/answers/_single_option.html.erb
|
|
159
|
-
- app/views/decidim/forms/questionnaires/answers/_sorting.html.erb
|
|
160
|
-
- app/views/decidim/forms/questionnaires/answers/_title_and_description.html.erb
|
|
150
|
+
- app/views/decidim/forms/questionnaires/_response.html.erb
|
|
161
151
|
- app/views/decidim/forms/questionnaires/edit.html.erb
|
|
152
|
+
- app/views/decidim/forms/questionnaires/responses/_files.html.erb
|
|
153
|
+
- app/views/decidim/forms/questionnaires/responses/_long_response.html.erb
|
|
154
|
+
- app/views/decidim/forms/questionnaires/responses/_matrix_multiple.html.erb
|
|
155
|
+
- app/views/decidim/forms/questionnaires/responses/_matrix_single.html.erb
|
|
156
|
+
- app/views/decidim/forms/questionnaires/responses/_multiple_option.html.erb
|
|
157
|
+
- app/views/decidim/forms/questionnaires/responses/_separator.html.erb
|
|
158
|
+
- app/views/decidim/forms/questionnaires/responses/_short_response.html.erb
|
|
159
|
+
- app/views/decidim/forms/questionnaires/responses/_single_option.html.erb
|
|
160
|
+
- app/views/decidim/forms/questionnaires/responses/_sorting.html.erb
|
|
161
|
+
- app/views/decidim/forms/questionnaires/responses/_title_and_description.html.erb
|
|
162
162
|
- app/views/decidim/forms/questionnaires/show.html.erb
|
|
163
163
|
- config/assets.rb
|
|
164
164
|
- config/locales/am-ET.yml
|
|
@@ -262,29 +262,31 @@ files:
|
|
|
262
262
|
- db/migrate/20240416111953_add_display_conditions_counter_cache_to_questions.rb
|
|
263
263
|
- db/migrate/20240416113926_add_display_conditions_for_other_questions_counter_cache_to_questions.rb
|
|
264
264
|
- db/migrate/20241122142230_add_survey_answers_published_at_to_questions.rb
|
|
265
|
+
- db/migrate/20250314150250_rename_answer_to_response_in_decidim_forms.rb
|
|
266
|
+
- db/migrate/20250319130003_change_question_types_in_questions.rb
|
|
265
267
|
- decidim-forms.gemspec
|
|
266
|
-
- lib/decidim/api/
|
|
268
|
+
- lib/decidim/api/question_matrix_row_type.rb
|
|
267
269
|
- lib/decidim/api/question_type.rb
|
|
268
270
|
- lib/decidim/api/questionnaire_entity_interface.rb
|
|
269
271
|
- lib/decidim/api/questionnaire_type.rb
|
|
272
|
+
- lib/decidim/api/response_option_type.rb
|
|
270
273
|
- lib/decidim/exporters/form_pdf.rb
|
|
271
274
|
- lib/decidim/forms.rb
|
|
272
275
|
- lib/decidim/forms/admin.rb
|
|
273
276
|
- lib/decidim/forms/admin_engine.rb
|
|
274
277
|
- lib/decidim/forms/api.rb
|
|
275
|
-
- lib/decidim/forms/
|
|
278
|
+
- lib/decidim/forms/download_your_data_user_responses_serializer.rb
|
|
276
279
|
- lib/decidim/forms/engine.rb
|
|
277
280
|
- lib/decidim/forms/test.rb
|
|
278
281
|
- lib/decidim/forms/test/factories.rb
|
|
279
282
|
- lib/decidim/forms/test/shared_examples/has_questionnaire.rb
|
|
280
|
-
- lib/decidim/forms/test/shared_examples/
|
|
283
|
+
- lib/decidim/forms/test/shared_examples/manage_questionnaire_responses.rb
|
|
281
284
|
- lib/decidim/forms/test/shared_examples/manage_questionnaires.rb
|
|
282
285
|
- lib/decidim/forms/test/shared_examples/manage_questionnaires/add_display_conditions.rb
|
|
283
286
|
- lib/decidim/forms/test/shared_examples/manage_questionnaires/add_questions.rb
|
|
284
|
-
- lib/decidim/forms/test/shared_examples/manage_questionnaires/draggable_behavior.rb
|
|
285
287
|
- lib/decidim/forms/test/shared_examples/manage_questionnaires/update_display_conditions.rb
|
|
286
288
|
- lib/decidim/forms/test/shared_examples/manage_questionnaires/update_questions.rb
|
|
287
|
-
- lib/decidim/forms/
|
|
289
|
+
- lib/decidim/forms/user_responses_serializer.rb
|
|
288
290
|
- lib/decidim/forms/version.rb
|
|
289
291
|
homepage: https://decidim.org
|
|
290
292
|
licenses:
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Forms
|
|
5
|
-
module Admin
|
|
6
|
-
# Custom helpers for questionnaire answers
|
|
7
|
-
#
|
|
8
|
-
module QuestionnaireAnswersHelper
|
|
9
|
-
def first_table_th(answer)
|
|
10
|
-
if answer.first_short_answer
|
|
11
|
-
@first_short_answer = answer.first_short_answer
|
|
12
|
-
return translated_attribute @first_short_answer.question.body
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
t("session_token", scope: "decidim.forms.user_answers_serializer")
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def first_table_td(answer)
|
|
19
|
-
return answer.first_short_answer&.body if @first_short_answer
|
|
20
|
-
|
|
21
|
-
answer.session_token
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def display_percentage(number)
|
|
25
|
-
number_to_percentage(number, precision: 0, strip_insignificant_zeros: true, locale: I18n.locale)
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Forms
|
|
5
|
-
class AnswerChoice < Forms::ApplicationRecord
|
|
6
|
-
belongs_to :answer,
|
|
7
|
-
class_name: "Answer",
|
|
8
|
-
foreign_key: "decidim_answer_id"
|
|
9
|
-
|
|
10
|
-
belongs_to :answer_option,
|
|
11
|
-
class_name: "AnswerOption",
|
|
12
|
-
foreign_key: "decidim_answer_option_id"
|
|
13
|
-
|
|
14
|
-
belongs_to :matrix_row,
|
|
15
|
-
class_name: "QuestionMatrixRow",
|
|
16
|
-
foreign_key: "decidim_question_matrix_row_id",
|
|
17
|
-
optional: true
|
|
18
|
-
|
|
19
|
-
validates :matrix_row, presence: true, if: -> { answer.question.matrix? }
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Forms
|
|
5
|
-
module Admin
|
|
6
|
-
#
|
|
7
|
-
# Presenter for questionnaire answer
|
|
8
|
-
#
|
|
9
|
-
class QuestionnaireAnswerPresenter < SimpleDelegator
|
|
10
|
-
delegate :content_tag, :safe_join, :link_to, :number_to_human_size, to: :view_context
|
|
11
|
-
|
|
12
|
-
include Decidim::TranslatableAttributes
|
|
13
|
-
|
|
14
|
-
def answer
|
|
15
|
-
__getobj__.fetch(:answer)
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def view_context
|
|
19
|
-
__getobj__.fetch(:view_context, ActionController::Base.new.view_context)
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def question
|
|
23
|
-
translated_attribute(answer.question.body)
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
def body
|
|
27
|
-
return answer.body if answer.body.present?
|
|
28
|
-
return attachments if answer.attachments.any?
|
|
29
|
-
return "-" if answer.choices.empty?
|
|
30
|
-
|
|
31
|
-
choices = build_choices
|
|
32
|
-
|
|
33
|
-
render_choices_list(choices)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
private
|
|
37
|
-
|
|
38
|
-
def build_choices
|
|
39
|
-
answer.choices.map do |choice|
|
|
40
|
-
matrix_row_body = matrix_row_body_for(choice)
|
|
41
|
-
{
|
|
42
|
-
answer_option_body: choice.try(:answer_option).try(:translated_body),
|
|
43
|
-
choice_body: body_or_custom_body(choice),
|
|
44
|
-
matrix_row_body:
|
|
45
|
-
}
|
|
46
|
-
end
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def matrix_row_body_for(choice)
|
|
50
|
-
return unless answer.question.matrix?
|
|
51
|
-
return unless choice.matrix_row&.body
|
|
52
|
-
|
|
53
|
-
translated_attribute(choice.matrix_row.body)
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
def render_choices_list(choices)
|
|
57
|
-
content_tag(:ul) do
|
|
58
|
-
if answer.question.question_type == "single_option"
|
|
59
|
-
choice(choices.first)
|
|
60
|
-
else
|
|
61
|
-
safe_join(choices.map { |c| choice(c) })
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def attachments
|
|
67
|
-
content_tag(:ul) do
|
|
68
|
-
safe_join(answer.attachments.map { |a| pretty_attachment(a) })
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
|
|
72
|
-
def pretty_attachment(attachment)
|
|
73
|
-
# rubocop:disable Style/StringConcatenation
|
|
74
|
-
# Interpolating strings that are `html_safe` is problematic with Rails.
|
|
75
|
-
content_tag :li do
|
|
76
|
-
link_to(attachment.url, target: "_blank", rel: "noopener noreferrer") do
|
|
77
|
-
content_tag(:span) do
|
|
78
|
-
translated_attribute(attachment.title).presence ||
|
|
79
|
-
I18n.t("download_attachment", scope: "decidim.forms.questionnaire_answer_presenter")
|
|
80
|
-
end + " " + content_tag(:small) do
|
|
81
|
-
"#{attachment.file_type} #{number_to_human_size(attachment.file_size)}"
|
|
82
|
-
end
|
|
83
|
-
end
|
|
84
|
-
end
|
|
85
|
-
# rubocop:enable Style/StringConcatenation
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def choice(choice_hash)
|
|
89
|
-
content_tag :li do
|
|
90
|
-
if choice_hash[:matrix_row_body].present?
|
|
91
|
-
content_tag(:strong, choice_hash[:matrix_row_body]) + ": " + render_body_for(choice_hash) # rubocop:disable Style/StringConcatenation
|
|
92
|
-
else
|
|
93
|
-
render_body_for choice_hash
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
def render_body_for(choice_hash)
|
|
99
|
-
return choice_hash[:answer_option_body] if choice_hash[:choice_body].blank?
|
|
100
|
-
|
|
101
|
-
"#{choice_hash[:answer_option_body]} (#{choice_hash[:choice_body]})"
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
def body_or_custom_body(choice)
|
|
105
|
-
return choice.custom_body if choice.try(:custom_body).present?
|
|
106
|
-
|
|
107
|
-
""
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
end
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Decidim
|
|
4
|
-
module Forms
|
|
5
|
-
# A class used to collect user answers for a questionnaire
|
|
6
|
-
class QuestionnaireUserAnswers < Decidim::Query
|
|
7
|
-
# Syntactic sugar to initialize the class and return the queried objects.
|
|
8
|
-
#
|
|
9
|
-
# questionnaire - a Questionnaire object
|
|
10
|
-
def self.for(questionnaire)
|
|
11
|
-
new(questionnaire).query
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
# Initializes the class.
|
|
15
|
-
#
|
|
16
|
-
# questionnaire = a Questionnaire object
|
|
17
|
-
def initialize(questionnaire)
|
|
18
|
-
@questionnaire = questionnaire
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# Finds and group answers by user for each questionnaire's question.
|
|
22
|
-
def query
|
|
23
|
-
answers = Answer.not_separator
|
|
24
|
-
.not_title_and_description
|
|
25
|
-
.joins(:question)
|
|
26
|
-
.where(questionnaire: @questionnaire)
|
|
27
|
-
|
|
28
|
-
answers.sort_by { |answer| answer.question.position.to_i }.group_by { |a| a.user || a.session_token }.values
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<% answer_option = form.object %>
|
|
2
|
-
|
|
3
|
-
<div class="card questionnaire-question-answer-option">
|
|
4
|
-
<div class="card-divider">
|
|
5
|
-
<h2 class="card-title">
|
|
6
|
-
<span><%= t(".answer_option") %></span>
|
|
7
|
-
<% if editable %>
|
|
8
|
-
<button class="button button__sm button__transparent-secondary small alert remove-answer-option button--title mb-2">
|
|
9
|
-
<%= icon("delete-bin-line") %>
|
|
10
|
-
<%= t(".remove") %>
|
|
11
|
-
</button>
|
|
12
|
-
<% end %>
|
|
13
|
-
</h2>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
16
|
-
<div class="card-section">
|
|
17
|
-
<div class="row column">
|
|
18
|
-
<%=
|
|
19
|
-
form.translated(
|
|
20
|
-
:text_field,
|
|
21
|
-
:body,
|
|
22
|
-
tabs_id: tabs_id_for_question_answer_option(question, answer_option),
|
|
23
|
-
label: t(".statement"),
|
|
24
|
-
disabled: !editable
|
|
25
|
-
)
|
|
26
|
-
%>
|
|
27
|
-
</div>
|
|
28
|
-
|
|
29
|
-
<div class="row column questionnaire-question-answer-option-free-text">
|
|
30
|
-
<%=
|
|
31
|
-
form.check_box(
|
|
32
|
-
:free_text,
|
|
33
|
-
label: t(".free_text"),
|
|
34
|
-
disabled: !questionnaire.questions_editable?
|
|
35
|
-
)
|
|
36
|
-
%>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
|
|
40
|
-
<% if answer_option.persisted? %>
|
|
41
|
-
<%= form.hidden_field :id, disabled: !editable %>
|
|
42
|
-
<% end %>
|
|
43
|
-
|
|
44
|
-
<%= form.hidden_field :deleted, disabled: !editable %>
|
|
45
|
-
</div>
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<% question = form.object %>
|
|
2
|
-
|
|
3
|
-
<script type="text/template" class="decidim-answer-option-template decidim-template" id="<%= template_id %>">
|
|
4
|
-
<%= fields_for "questions[questions][#{question.to_param}][answer_options][]", blank_answer_option do |answer_option_form| %>
|
|
5
|
-
<%= render "decidim/forms/admin/questionnaires/answer_option", form: answer_option_form, question:, editable: %>
|
|
6
|
-
<% end %>
|
|
7
|
-
</script>
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
<div class="card" id="answers">
|
|
2
|
-
<div class="item_show__header">
|
|
3
|
-
<h1 class="item_show__header-title">
|
|
4
|
-
<%= t ".title", total: @total %>
|
|
5
|
-
<%= link_to t("actions.back", scope: "decidim.forms.admin.questionnaires"), questionnaire_url, class: "button button__sm button__secondary new" %>
|
|
6
|
-
</h1>
|
|
7
|
-
</div>
|
|
8
|
-
<div class="table-scroll">
|
|
9
|
-
<table class="table-list">
|
|
10
|
-
<thead>
|
|
11
|
-
<tr>
|
|
12
|
-
<th>#</th>
|
|
13
|
-
<th><%= first_table_th(@participants.first) %></th>
|
|
14
|
-
<th><%= t("user_status", scope: "decidim.forms.user_answers_serializer") %></th>
|
|
15
|
-
<th><%= t("ip_hash", scope: "decidim.forms.user_answers_serializer") %></th>
|
|
16
|
-
<th><%= t("completion", scope: "decidim.forms.user_answers_serializer") %></th>
|
|
17
|
-
<th><%= t("created_at", scope: "decidim.forms.user_answers_serializer") %></th>
|
|
18
|
-
<th></th>
|
|
19
|
-
</tr>
|
|
20
|
-
</thead>
|
|
21
|
-
<tbody>
|
|
22
|
-
<% @participants.each_with_index do |participant, idx| %>
|
|
23
|
-
<tr>
|
|
24
|
-
<td><%= idx + 1 + page_offset %></td>
|
|
25
|
-
<td>
|
|
26
|
-
<% if allowed_to? :show, :questionnaire_answers %>
|
|
27
|
-
<%= link_to first_table_td(participant), questionnaire_participant_answers_url(participant.session_token) %>
|
|
28
|
-
<% else %>
|
|
29
|
-
<%= first_table_td(participant) %></td>
|
|
30
|
-
<% end %>
|
|
31
|
-
<td><%= participant.status %></td>
|
|
32
|
-
<td><%= participant.ip_hash %></td>
|
|
33
|
-
<td><%= display_percentage(participant.completion) %></td>
|
|
34
|
-
<td><%= l participant.answered_at, format: :short %></td>
|
|
35
|
-
<td class="table-list__actions">
|
|
36
|
-
<% if allowed_to? :show, :questionnaire_answers %>
|
|
37
|
-
<%= icon_link_to "eye-line", questionnaire_participant_answers_url(participant.session_token), t("actions.show", scope: "decidim.forms.admin.questionnaires.answers"), class: "action-icon--eye", target: "_blank", data: { "external-link": false } %>
|
|
38
|
-
<% end %>
|
|
39
|
-
<% if allowed_to? :export_response, :questionnaire_answers %>
|
|
40
|
-
<%= icon_link_to "download-line", questionnaire_export_response_url(participant.session_token), t("actions.export", scope: "decidim.forms.admin.questionnaires.answers"), class: "action-icon--data-transfer-download" %>
|
|
41
|
-
<% end %>
|
|
42
|
-
</td>
|
|
43
|
-
</tr>
|
|
44
|
-
<% end %>
|
|
45
|
-
</tbody>
|
|
46
|
-
</table>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
<%= decidim_paginate @query %>
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
<div class="card" id="answers">
|
|
2
|
-
<div class="item_show__header">
|
|
3
|
-
<h1 class="item_show__header-title">
|
|
4
|
-
<%= t ".title", number: current_idx %>
|
|
5
|
-
|
|
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
|
-
<%= 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
|
-
<%= 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
|
-
<%= link_to t("actions.back", scope: "decidim.forms.admin.questionnaires.answers"), questionnaire_participants_url, class: "button button__sm button__secondary back" %>
|
|
10
|
-
</h1>
|
|
11
|
-
</div>
|
|
12
|
-
<div class="card-section">
|
|
13
|
-
<div class="table">
|
|
14
|
-
<table class="table-list">
|
|
15
|
-
<thead>
|
|
16
|
-
<tr>
|
|
17
|
-
<th><%= t("session_token", scope: "decidim.forms.user_answers_serializer") %></th>
|
|
18
|
-
<th><%= t("user_status", scope: "decidim.forms.user_answers_serializer") %></th>
|
|
19
|
-
<th><%= t("ip_hash", scope: "decidim.forms.user_answers_serializer") %></th>
|
|
20
|
-
<th><%= t("completion", scope: "decidim.forms.user_answers_serializer") %></th>
|
|
21
|
-
<th><%= t("created_at", scope: "decidim.forms.user_answers_serializer") %></th>
|
|
22
|
-
<th></th>
|
|
23
|
-
</tr>
|
|
24
|
-
</thead>
|
|
25
|
-
<tbody>
|
|
26
|
-
<tr>
|
|
27
|
-
<td><%= @participant.session_token %></td>
|
|
28
|
-
<td><%= @participant.status %></td>
|
|
29
|
-
<td><%= @participant.ip_hash %></td>
|
|
30
|
-
<td><%= display_percentage(@participant.completion) %></td>
|
|
31
|
-
<td><%= l @participant.answered_at, format: :short %></td>
|
|
32
|
-
</tr>
|
|
33
|
-
</tbody>
|
|
34
|
-
</table>
|
|
35
|
-
</div>
|
|
36
|
-
<dl class="p-4 [&_ul]:list-disc [&_ul]:pl-4">
|
|
37
|
-
<% @participant.answers.each do |answer| %>
|
|
38
|
-
<dt class="font-semibold"><%= answer.question %></dt>
|
|
39
|
-
<dd><%= answer.body %></dd>
|
|
40
|
-
<% end %>
|
|
41
|
-
</dl>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<% field_id = "questionnaire_responses_#{answer_idx}" %>
|
|
2
|
-
|
|
3
|
-
<% if answer.question.separator? %>
|
|
4
|
-
|
|
5
|
-
<%= render partial: "decidim/forms/questionnaires/answers/#{answer.question.question_type}", locals: { answer:, answer_form:, answer_idx:, field_id:, disabled: } %>
|
|
6
|
-
<%= answer_form.hidden_field :question_id %>
|
|
7
|
-
|
|
8
|
-
<% elsif answer.question.title_and_description? %>
|
|
9
|
-
|
|
10
|
-
<div class="answer-questionnaire__step-heading">
|
|
11
|
-
<h3 class="h3"><%= translated_attribute(answer.question.body) %></h3>
|
|
12
|
-
<% if translated_attribute(answer.question.description).present? %>
|
|
13
|
-
<div>
|
|
14
|
-
<%= decidim_sanitize_editor_admin translated_attribute(answer.question.description) %>
|
|
15
|
-
</div>
|
|
16
|
-
<% end %>
|
|
17
|
-
</div>
|
|
18
|
-
|
|
19
|
-
<%= render partial: "decidim/forms/questionnaires/answers/#{answer.question.question_type}", locals: { answer:, answer_form:, answer_idx:, field_id:, disabled: } %>
|
|
20
|
-
<%= answer_form.hidden_field :question_id %>
|
|
21
|
-
|
|
22
|
-
<% else %>
|
|
23
|
-
|
|
24
|
-
<div class="answer-questionnaire__question">
|
|
25
|
-
<%
|
|
26
|
-
label_options = {
|
|
27
|
-
class: "answer-questionnaire__question-label questionnaire-question"
|
|
28
|
-
}
|
|
29
|
-
label_options[:for] = nil if %w(matrix_single matrix_multiple single_option multiple_option).include?(answer.question.question_type)
|
|
30
|
-
%>
|
|
31
|
-
|
|
32
|
-
<%= label_tag field_id, **label_options do %>
|
|
33
|
-
<%= translated_attribute(answer.question.body) %>
|
|
34
|
-
<% if answer.question.mandatory? %>
|
|
35
|
-
<%= answer_form.send(:required_indicator) %>
|
|
36
|
-
<% end %>
|
|
37
|
-
<% if answer.question.max_choices %>
|
|
38
|
-
<%= " (#{answer.send(:max_choices_label)})" %>
|
|
39
|
-
<% end %>
|
|
40
|
-
<% end %>
|
|
41
|
-
|
|
42
|
-
<% if translated_attribute(answer.question.description).present? %>
|
|
43
|
-
<div class="answer-questionnaire__question-description">
|
|
44
|
-
<%= decidim_sanitize_editor_admin translated_attribute(answer.question.description) %>
|
|
45
|
-
</div>
|
|
46
|
-
<% end %>
|
|
47
|
-
|
|
48
|
-
<% if answer.question.max_choices %>
|
|
49
|
-
<small class="form-error max-choices-alert"><%= t(".max_choices_alert") %></small>
|
|
50
|
-
<% end %>
|
|
51
|
-
|
|
52
|
-
<% %w(short_answer long_answer).exclude?(answer&.question&.question_type) && answer.errors.full_messages.each do |msg| %>
|
|
53
|
-
<small class="form-error is-visible"><%= msg %></small>
|
|
54
|
-
<% end %>
|
|
55
|
-
|
|
56
|
-
<%= render partial: "decidim/forms/questionnaires/answers/#{answer.question.question_type}", locals: { answer:, answer_form:, answer_idx:, field_id:, disabled:, maxlength: (answer.question.max_characters if answer.question.max_characters.positive?) } %>
|
|
57
|
-
<%= answer_form.hidden_field :question_id %>
|
|
58
|
-
</div>
|
|
59
|
-
|
|
60
|
-
<% end %>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<%= answer_form.upload :add_documents, attachments: answer.documents, label: false, multiple: true, id: field_id, disabled:, button_class: "button button__lg button__transparent-secondary w-full" %>
|