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
@@ -1,17 +1,12 @@
|
|
1
1
|
<div class="card" id="answers">
|
2
|
-
<div class="
|
3
|
-
<h2 class="
|
2
|
+
<div class="item_show__header">
|
3
|
+
<h2 class="item_show__header-title">
|
4
4
|
<%= t ".title", number: current_idx %>
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
</div>
|
11
|
-
<div class="button--title">
|
12
|
-
<%= link_to t("actions.export", scope: "decidim.forms.admin.questionnaires.answers"), questionnaire_export_response_url(@participant.session_token), class: "button tiny button--title export" %>
|
13
|
-
<%= link_to t("actions.back", scope: "decidim.forms.admin.questionnaires.answers"), questionnaire_participants_url, class: "button tiny button--title back" %>
|
14
|
-
</div>
|
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" %>
|
15
10
|
</h2>
|
16
11
|
</div>
|
17
12
|
<div class="card-section">
|
@@ -20,10 +15,10 @@
|
|
20
15
|
<thead>
|
21
16
|
<tr>
|
22
17
|
<th><%= t("session_token", scope: "decidim.forms.user_answers_serializer") %></th>
|
23
|
-
<th><%= t("user_status",
|
24
|
-
<th><%= t("ip_hash",
|
25
|
-
<th><%= t("completion",
|
26
|
-
<th><%= t("created_at",
|
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>
|
27
22
|
<th></th>
|
28
23
|
</tr>
|
29
24
|
</thead>
|
@@ -38,9 +33,9 @@
|
|
38
33
|
</tbody>
|
39
34
|
</table>
|
40
35
|
</div>
|
41
|
-
<dl>
|
36
|
+
<dl class="p-4 [&_ul]:list-disc [&_ul]:pl-4">
|
42
37
|
<% @participant.answers.each do |answer| %>
|
43
|
-
<dt><%= answer.question %></dt>
|
38
|
+
<dt class="font-semibold"><%= answer.question %></dt>
|
44
39
|
<dd><%= answer.body %></dd>
|
45
40
|
<% end %>
|
46
41
|
</dl>
|
@@ -3,11 +3,38 @@
|
|
3
3
|
<% if templates_defined? && choose_template? %>
|
4
4
|
<%= render partial: "decidim/templates/admin/questionnaire_templates/choose", locals: { target: questionnaire, form_title: t("decidim.forms.admin.questionnaires.edit.title") } %>
|
5
5
|
<% else %>
|
6
|
-
<%= decidim_form_for(@form, url: update_url, method: :put, html: { class: "form edit_questionnaire" }) do |form| %>
|
7
|
-
<%= render partial: "decidim/forms/admin/questionnaires/form", object: form %>
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
7
|
+
<div class="item_show__header">
|
8
|
+
<h2 class="item_show__header-title">
|
9
|
+
<%= edit_questionnaire_title %>
|
10
|
+
|
11
|
+
<% unless template? questionnaire.questionnaire_for %>
|
12
|
+
<% if allowed_to? :preview, :questionnaire %>
|
13
|
+
<%= link_to t("preview", scope: "decidim.forms.admin.questionnaires.form"), public_url, class: "button button__sm button__secondary", target: :_blank, data: { "external-link": false } %>
|
14
|
+
<% end %>
|
15
|
+
<% if questionnaire.answers.any? %>
|
16
|
+
<%= export_dropdown(current_component, questionnaire.id) if allowed_to? :export_answers, :questionnaire %>
|
17
|
+
<% if allowed_to? :show, :questionnaire_answers %>
|
18
|
+
<%= link_to t("actions.show", scope: "decidim.forms.admin.questionnaires"), questionnaire_participants_url, class: "button button__sm button__secondary new whitespace-nowrap" %>
|
19
|
+
<% end %>
|
20
|
+
<% else %>
|
21
|
+
<button class="button button__sm button__secondary whitespace-nowrap" disabled><%= t("empty", scope: "decidim.forms.admin.questionnaires.answers") %></button>
|
22
|
+
<% end %>
|
23
|
+
<% end %>
|
24
|
+
</h2>
|
25
|
+
</div>
|
26
|
+
|
27
|
+
<div class="item__edit item__edit-1col">
|
28
|
+
<div class="item__edit-form">
|
29
|
+
<%= decidim_form_for(@form, url: update_url, method: :put, html: { class: "form-defaults form edit_questionnaire" }) do |form| %>
|
30
|
+
<%= render partial: "decidim/forms/admin/questionnaires/form", object: form %>
|
31
|
+
<div class="item__edit-sticky">
|
32
|
+
<div class="item__edit-sticky-container">
|
33
|
+
<%= form.submit t(".save"), class: "button button__sm button__secondary" %>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
<% end %>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
|
13
40
|
<% end %>
|
@@ -1,40 +1,44 @@
|
|
1
1
|
<% field_id = "questionnaire_responses_#{answer_idx}" %>
|
2
2
|
|
3
3
|
<% if answer.question.separator? %>
|
4
|
-
|
4
|
+
|
5
|
+
<%= render partial: "decidim/forms/questionnaires/answers/#{answer.question.question_type}", locals: { answer:, answer_form:, answer_idx:, field_id:, disabled: } %>
|
5
6
|
<%= answer_form.hidden_field :question_id %>
|
7
|
+
|
6
8
|
<% elsif answer.question.title_and_description? %>
|
7
|
-
|
8
|
-
|
9
|
-
<
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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: } %>
|
14
20
|
<%= answer_form.hidden_field :question_id %>
|
21
|
+
|
15
22
|
<% else %>
|
16
|
-
<% case answer.question.question_type %>
|
17
|
-
<% when "single_option", "multiple_option", "sorting" %>
|
18
|
-
<label class="questionnaire-question"><%= answer.label(cleaned_answer_idx) %></label>
|
19
|
-
<% else %>
|
20
|
-
<%= label_tag field_id, answer.label(cleaned_answer_idx), class: "questionnaire-question" %>
|
21
|
-
<% end %>
|
22
23
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
<div class="answer-questionnaire__question">
|
25
|
+
<%= label_tag field_id, answer.label, class: "answer-questionnaire__question-label questionnaire-question", data: { "answer-idx": cleaned_answer_idx } %>
|
26
|
+
<% if translated_attribute(answer.question.description).present? %>
|
27
|
+
<div class="answer-questionnaire__question-description">
|
28
|
+
<%= decidim_sanitize_editor_admin translated_attribute(answer.question.description) %>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
28
31
|
|
29
|
-
|
32
|
+
<% if answer.question.max_choices %>
|
33
|
+
<small class="form-error max-choices-alert"><%= t(".max_choices_alert") %></small>
|
34
|
+
<% end %>
|
30
35
|
|
31
|
-
|
36
|
+
<% answer.errors.full_messages.each do |msg| %>
|
37
|
+
<small class="form-error is-visible"><%= msg %></small>
|
38
|
+
<% end %>
|
32
39
|
|
33
|
-
|
34
|
-
|
35
|
-
|
40
|
+
<%= 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?) } %>
|
41
|
+
<%= answer_form.hidden_field :question_id %>
|
42
|
+
</div>
|
36
43
|
|
37
|
-
<% answer.errors.full_messages.each do |msg| %>
|
38
|
-
<small class="form-error is-visible"><%= msg %></small>
|
39
|
-
<% end %>
|
40
44
|
<% end %>
|
@@ -0,0 +1,78 @@
|
|
1
|
+
<noscript>
|
2
|
+
<%= cell("decidim/announcement", { title: t("decidim.forms.questionnaires.show.questionnaire_js_disabled.title"), body: t("decidim.forms.questionnaires.show.questionnaire_js_disabled.body") }, callout_class: "warning") %>
|
3
|
+
</noscript>
|
4
|
+
|
5
|
+
<% unless current_participatory_space.can_participate?(current_user) %>
|
6
|
+
<%= cell("decidim/announcement", { title: t("decidim.forms.questionnaires.show.questionnaire_for_private_users.title"), body: t("decidim.forms.questionnaires.show.questionnaire_for_private_users.body") }, callout_class: "alert") %>
|
7
|
+
<% end %>
|
8
|
+
|
9
|
+
<%= decidim_form_for(@form, url: update_url, method: :post, html: { multipart: true, class: "form answer-questionnaire" }, data: { "safe-path" => form_path }) do |form| %>
|
10
|
+
<%= form_required_explanation %>
|
11
|
+
|
12
|
+
<%= invisible_captcha %>
|
13
|
+
<% answer_idx = 0 %>
|
14
|
+
<% cleaned_answer_idx = 1 %>
|
15
|
+
<% @form.responses_by_step.each_with_index do |step_answers, step_index| %>
|
16
|
+
<div id="step-<%= step_index %>" class="answer-questionnaire__step" <%= "hidden" if !step_index.zero? %>>
|
17
|
+
|
18
|
+
<% if @form.total_steps > 1 %>
|
19
|
+
<p class="answer-questionnaire__step-counter">
|
20
|
+
<%= t("decidim.forms.questionnaires.show.current_step", step: step_index + 1) %> <%= t("decidim.forms.questionnaires.show.of_total_steps", total_steps: @form.total_steps) %></span>
|
21
|
+
</p>
|
22
|
+
<% end %>
|
23
|
+
|
24
|
+
<% step_answers.each do |answer| %>
|
25
|
+
<div class="answer question" data-max-choices="<%= answer.question.max_choices %>" data-conditioned="<%= answer.question.display_conditions.any? %>" data-question-id="<%= answer.question.id %>">
|
26
|
+
<% answer.question.display_conditions.each do |display_condition| %>
|
27
|
+
<%= content_tag :div, nil, class: "display-condition", data: display_condition.to_html_data %>
|
28
|
+
<% end %>
|
29
|
+
|
30
|
+
<%= fields_for "questionnaire[responses][#{answer_idx}]", answer do |answer_form| %>
|
31
|
+
<%= render(
|
32
|
+
"decidim/forms/questionnaires/answer",
|
33
|
+
answer_form:,
|
34
|
+
answer:,
|
35
|
+
answer_idx:,
|
36
|
+
cleaned_answer_idx:,
|
37
|
+
disabled: !current_participatory_space.can_participate?(current_user)
|
38
|
+
) %>
|
39
|
+
<% end %>
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<% if !(answer.question.separator? || answer.question.title_and_description?) %>
|
43
|
+
<% cleaned_answer_idx += 1 %>
|
44
|
+
<% end %>
|
45
|
+
|
46
|
+
<% answer_idx += 1 %>
|
47
|
+
|
48
|
+
<% end %>
|
49
|
+
|
50
|
+
<div class="answer-questionnaire__footer">
|
51
|
+
<% if step_index + 1 == @form.total_steps %>
|
52
|
+
<% if show_represent_user_group? %>
|
53
|
+
<%= cell("decidim/represent_user_group", form) %>
|
54
|
+
<% end %>
|
55
|
+
|
56
|
+
<% if show_public_participation? %>
|
57
|
+
<%= cell("decidim/public_participation", form) %>
|
58
|
+
<% end %>
|
59
|
+
|
60
|
+
<div class="answer-questionnaire__tos">
|
61
|
+
<%= form.check_box :tos_agreement, label: t("decidim.forms.questionnaires.show.tos_agreement"), id: "questionnaire_tos_agreement", disabled: !current_participatory_space.can_participate?(current_user) %>
|
62
|
+
<div>
|
63
|
+
<%= decidim_sanitize_editor translated_attribute questionnaire.tos %>
|
64
|
+
</div>
|
65
|
+
</div>
|
66
|
+
<% end %>
|
67
|
+
|
68
|
+
<%= cell(
|
69
|
+
"decidim/forms/step_navigation",
|
70
|
+
step_index,
|
71
|
+
total_steps: @form.total_steps,
|
72
|
+
button_disabled: !current_participatory_space.can_participate?(current_user),
|
73
|
+
form:
|
74
|
+
) %>
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
<% end %>
|
78
|
+
<% end %>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= render partial: "decidim/devise/shared/login_boxes", locals: { scope: "decidim.forms.questionnaires.show.answer_questionnaire" } %>
|
2
|
+
|
3
|
+
<div class="answer-questionnaire mt-12">
|
4
|
+
<ol class="answer-questionnaire__step">
|
5
|
+
<%= cell(
|
6
|
+
"decidim/forms/question_readonly",
|
7
|
+
collection: @questionnaire.questions.not_conditioned.not_separator,
|
8
|
+
indexed_items: @questionnaire.questions.not_conditioned.not_separator.not_title_and_description.pluck(:id)
|
9
|
+
) %>
|
10
|
+
</ol>
|
11
|
+
</div>
|
@@ -1 +1 @@
|
|
1
|
-
<%= answer_form.
|
1
|
+
<%= answer_form.upload :add_documents, label: false, multiple: true, id: field_id, disabled:, button_class: "button button__lg button__transparent-secondary w-full" %>
|
@@ -1,44 +1,47 @@
|
|
1
|
-
<
|
2
|
-
<
|
3
|
-
<
|
4
|
-
<
|
5
|
-
|
6
|
-
<td><%= translated_attribute(answer_option.body) %></td>
|
7
|
-
<% end %>
|
8
|
-
</tr>
|
9
|
-
</thead>
|
10
|
-
<tbody>
|
11
|
-
<% answer.question.matrix_rows.by_position.each_with_index do |row, row_idx| %>
|
12
|
-
<tr class="check-box-collection">
|
13
|
-
<td><%= translated_attribute row.body %></td>
|
1
|
+
<div class="answer-questionnaire__multiple-matrix">
|
2
|
+
<table>
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<td></td>
|
14
6
|
<% answer.question.answer_options.each_with_index do |answer_option, idx| %>
|
15
|
-
|
16
|
-
<% choice_id = "#{field_id}_matrix_row_#{row_idx}_choice_#{idx}" %>
|
17
|
-
<td>
|
18
|
-
<div class="collection-input">
|
19
|
-
<%= check_box_tag "questionnaire[responses][#{answer_idx}][choices][][body]",
|
20
|
-
translated_attribute(answer_option.body),
|
21
|
-
choice.present?,
|
22
|
-
id: "#{choice_id}_body", disabled: disabled %>
|
23
|
-
<%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][][answer_option_id]",
|
24
|
-
answer_option.id,
|
25
|
-
id: "#{choice_id}_answer_option",
|
26
|
-
disabled: true %>
|
27
|
-
<%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][][matrix_row_id]",
|
28
|
-
row.id,
|
29
|
-
id: "#{choice_id}_matrix_row",
|
30
|
-
disabled: true %>
|
31
|
-
<% if answer_option.free_text %>
|
32
|
-
<%= text_field_tag "questionnaire[responses][#{answer_idx}][choices][][custom_body]",
|
33
|
-
choice.try(:custom_body),
|
34
|
-
id: "#{choice_id}_custom_body",
|
35
|
-
disabled: true,
|
36
|
-
maxlength: maxlength %>
|
37
|
-
<% end %>
|
38
|
-
</div>
|
39
|
-
</td>
|
7
|
+
<th><%= translated_attribute(answer_option.body) %></th>
|
40
8
|
<% end %>
|
41
9
|
</tr>
|
42
|
-
|
43
|
-
|
44
|
-
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
12
|
+
<% answer.question.matrix_rows.by_position.each_with_index do |row, row_idx| %>
|
13
|
+
<tr class="js-check-box-collection">
|
14
|
+
<td><%= translated_attribute row.body %></td>
|
15
|
+
<% answer.question.answer_options.each_with_index do |answer_option, idx| %>
|
16
|
+
<% choice = answer.selected_choices.find { |choice| choice.answer_option_id == answer_option.id && choice.matrix_row_id == row.id } %>
|
17
|
+
<% choice_id = "#{field_id}_matrix_row_#{row_idx}_choice_#{idx}" %>
|
18
|
+
<td>
|
19
|
+
<div class="js-collection-input">
|
20
|
+
<%= check_box_tag "questionnaire[responses][#{answer_idx}][choices][][body]",
|
21
|
+
translated_attribute(answer_option.body),
|
22
|
+
choice.present?,
|
23
|
+
"aria-label": translated_attribute(answer_option.body),
|
24
|
+
id: "#{choice_id}_body", disabled: %>
|
25
|
+
<%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][][answer_option_id]",
|
26
|
+
answer_option.id,
|
27
|
+
id: "#{choice_id}_answer_option",
|
28
|
+
disabled: true %>
|
29
|
+
<%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][][matrix_row_id]",
|
30
|
+
row.id,
|
31
|
+
id: "#{choice_id}_matrix_row",
|
32
|
+
disabled: true %>
|
33
|
+
<% if answer_option.free_text %>
|
34
|
+
<%= text_field_tag "questionnaire[responses][#{answer_idx}][choices][][custom_body]",
|
35
|
+
choice.try(:custom_body),
|
36
|
+
id: "#{choice_id}_custom_body",
|
37
|
+
disabled: true,
|
38
|
+
maxlength: %>
|
39
|
+
<% end %>
|
40
|
+
</div>
|
41
|
+
</td>
|
42
|
+
<% end %>
|
43
|
+
</tr>
|
44
|
+
<% end %>
|
45
|
+
</tbody>
|
46
|
+
</table>
|
47
|
+
</div>
|
@@ -1,44 +1,47 @@
|
|
1
|
-
<
|
2
|
-
<
|
3
|
-
<
|
4
|
-
<
|
5
|
-
|
6
|
-
<td><%= translated_attribute(answer_option.body) %></td>
|
7
|
-
<% end %>
|
8
|
-
</tr>
|
9
|
-
</thead>
|
10
|
-
<tbody>
|
11
|
-
<% answer.question.matrix_rows.by_position.each_with_index do |row, row_idx| %>
|
12
|
-
<tr class="radio-button-collection">
|
13
|
-
<td><%= translated_attribute row.body %></td>
|
1
|
+
<div class="answer-questionnaire__single-matrix">
|
2
|
+
<table>
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<td></td>
|
14
6
|
<% answer.question.answer_options.each_with_index do |answer_option, idx| %>
|
15
|
-
|
16
|
-
<% choice_id = "#{field_id}_matrix_row_#{row_idx}_choice_#{idx}" %>
|
17
|
-
<td>
|
18
|
-
<div class="collection-input">
|
19
|
-
<%= radio_button_tag "questionnaire[responses][#{answer_idx}][choices][#{row_idx}][body]",
|
20
|
-
translated_attribute(answer_option.body),
|
21
|
-
answer_option.id == choice.try(:answer_option_id),
|
22
|
-
id: "#{choice_id}_body", disabled: disabled %>
|
23
|
-
<%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][#{row_idx}][answer_option_id]",
|
24
|
-
answer_option.id,
|
25
|
-
id: "#{choice_id}_answer_option",
|
26
|
-
disabled: true %>
|
27
|
-
<%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][#{row_idx}][matrix_row_id]",
|
28
|
-
row.id,
|
29
|
-
id: "#{choice_id}_matrix_row",
|
30
|
-
disabled: true %>
|
31
|
-
<% if answer_option.free_text %>
|
32
|
-
<%= text_field_tag "questionnaire[responses][#{answer_idx}][choices][#{row_idx}][custom_body]",
|
33
|
-
choice.try(:custom_body),
|
34
|
-
id: "#{choice_id}_custom_body",
|
35
|
-
disabled: true,
|
36
|
-
maxlength: maxlength %>
|
37
|
-
<% end %>
|
38
|
-
</div>
|
39
|
-
</td>
|
7
|
+
<th><%= translated_attribute(answer_option.body) %></th>
|
40
8
|
<% end %>
|
41
9
|
</tr>
|
42
|
-
|
43
|
-
|
44
|
-
|
10
|
+
</thead>
|
11
|
+
<tbody>
|
12
|
+
<% answer.question.matrix_rows.by_position.each_with_index do |row, row_idx| %>
|
13
|
+
<tr class="js-radio-button-collection">
|
14
|
+
<td><%= translated_attribute row.body %></td>
|
15
|
+
<% answer.question.answer_options.each_with_index do |answer_option, idx| %>
|
16
|
+
<% choice = answer.choices.find { |choice| choice.answer_option_id == answer_option.id && choice.matrix_row_id == row.id } %>
|
17
|
+
<% choice_id = "#{field_id}_matrix_row_#{row_idx}_choice_#{idx}" %>
|
18
|
+
<td>
|
19
|
+
<div class="js-collection-input">
|
20
|
+
<%= radio_button_tag "questionnaire[responses][#{answer_idx}][choices][#{row_idx}][body]",
|
21
|
+
translated_attribute(answer_option.body),
|
22
|
+
answer_option.id == choice.try(:answer_option_id),
|
23
|
+
"aria-label": translated_attribute(answer_option.body),
|
24
|
+
id: "#{choice_id}_body", disabled: %>
|
25
|
+
<%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][#{row_idx}][answer_option_id]",
|
26
|
+
answer_option.id,
|
27
|
+
id: "#{choice_id}_answer_option",
|
28
|
+
disabled: true %>
|
29
|
+
<%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][#{row_idx}][matrix_row_id]",
|
30
|
+
row.id,
|
31
|
+
id: "#{choice_id}_matrix_row",
|
32
|
+
disabled: true %>
|
33
|
+
<% if answer_option.free_text %>
|
34
|
+
<%= text_field_tag "questionnaire[responses][#{answer_idx}][choices][#{row_idx}][custom_body]",
|
35
|
+
choice.try(:custom_body),
|
36
|
+
id: "#{choice_id}_custom_body",
|
37
|
+
disabled: true,
|
38
|
+
maxlength: %>
|
39
|
+
<% end %>
|
40
|
+
</div>
|
41
|
+
</td>
|
42
|
+
<% end %>
|
43
|
+
</tr>
|
44
|
+
<% end %>
|
45
|
+
</tbody>
|
46
|
+
</table>
|
47
|
+
</div>
|
@@ -1,12 +1,12 @@
|
|
1
|
-
<div class="check-box-collection">
|
1
|
+
<div class="answer-questionnaire__single-option js-check-box-collection">
|
2
2
|
<% answer.question.answer_options.each_with_index do |answer_option, idx| %>
|
3
3
|
<% choice = answer.selected_choices.find { |choice| choice.answer_option_id == answer_option.id } %>
|
4
4
|
|
5
|
-
<div class="collection-input">
|
5
|
+
<div class="js-collection-input">
|
6
6
|
<%= label_tag do %>
|
7
7
|
<%= check_box_tag "questionnaire[responses][#{answer_idx}][choices][#{idx}][body]",
|
8
8
|
translated_attribute(answer_option.body),
|
9
|
-
choice.present?, disabled:
|
9
|
+
choice.present?, disabled: %>
|
10
10
|
|
11
11
|
<%= translated_attribute(answer_option.body) %>
|
12
12
|
|
@@ -15,9 +15,10 @@
|
|
15
15
|
|
16
16
|
<% if answer_option.free_text %>
|
17
17
|
<%= text_field_tag "questionnaire[responses][#{answer_idx}][choices][#{idx}][custom_body]",
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
choice.try(:custom_body),
|
19
|
+
disabled: true,
|
20
|
+
maxlength:,
|
21
|
+
class: "w-full" %>
|
21
22
|
<% end %>
|
22
23
|
</div>
|
23
24
|
<% end %>
|
@@ -1 +1 @@
|
|
1
|
-
<%= answer_form.hidden_field :body, value: "separator", id: field_id, disabled:
|
1
|
+
<%= answer_form.hidden_field :body, value: "separator", id: field_id, disabled: %>
|
@@ -1,30 +1,31 @@
|
|
1
|
-
<div class="radio-button-collection">
|
1
|
+
<div class="answer-questionnaire__single-option js-radio-button-collection">
|
2
2
|
<% choice = answer.choices.first %>
|
3
3
|
|
4
4
|
<% answer.question.answer_options.each_with_index do |answer_option, idx| %>
|
5
5
|
<% choice_id = "#{field_id}_choices_#{idx}" %>
|
6
6
|
|
7
|
-
<div class="collection-input">
|
7
|
+
<div class="js-collection-input">
|
8
8
|
<%= label_tag "#{choice_id}_body" do %>
|
9
9
|
<%= radio_button_tag "questionnaire[responses][#{answer_idx}][choices][][body]",
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
translated_attribute(answer_option.body),
|
11
|
+
answer_option.id == choice.try(:answer_option_id),
|
12
|
+
id: "#{choice_id}_body", disabled: %>
|
13
13
|
|
14
14
|
<%= translated_attribute(answer_option.body) %>
|
15
15
|
|
16
16
|
<%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][][answer_option_id]",
|
17
|
-
|
18
|
-
|
19
|
-
|
17
|
+
answer_option.id,
|
18
|
+
id: "#{choice_id}_answer_option",
|
19
|
+
disabled: true %>
|
20
20
|
<% end %>
|
21
21
|
|
22
22
|
<% if answer_option.free_text %>
|
23
23
|
<%= text_field_tag "questionnaire[responses][#{answer_idx}][choices][][custom_body]",
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
24
|
+
choice.try(:custom_body),
|
25
|
+
id: "#{choice_id}_custom_body",
|
26
|
+
disabled: true,
|
27
|
+
maxlength:,
|
28
|
+
class: "w-full" %>
|
28
29
|
<% end %>
|
29
30
|
</div>
|
30
31
|
<% end %>
|
@@ -1,23 +1,20 @@
|
|
1
|
-
<div class="sortable-check-box-collection">
|
1
|
+
<div class="answer-questionnaire__sorting-container js-sortable-check-box-collection">
|
2
2
|
<% answer.question.answer_options.each_with_index do |answer_option, idx| %>
|
3
3
|
<% choice = answer.selected_choices.find { |choice| choice.answer_option_id == answer_option.id } %>
|
4
4
|
|
5
|
-
<div class="collection-input">
|
6
|
-
|
7
|
-
|
5
|
+
<div class="answer-questionnaire__sorting js-collection-input" role="button">
|
6
|
+
|
7
|
+
<%#= check_box_tag "questionnaire[responses][#{answer_idx}][choices][#{idx}][body]",
|
8
8
|
translated_attribute(answer_option.body),
|
9
9
|
choice.present?, disabled: disabled %>
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
<%= translated_attribute(answer_option.body) %>
|
11
|
+
<%= translated_attribute(answer_option.body) %>
|
14
12
|
|
15
|
-
|
16
|
-
choice.try(:position),
|
17
|
-
disabled: true %>
|
13
|
+
<%= icon "drag-move-2-line" %>
|
18
14
|
|
19
|
-
|
20
|
-
|
15
|
+
<%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][#{idx}][position]", choice.try(:position) %>
|
16
|
+
<%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][#{idx}][body]", translated_attribute(answer_option.body) %>
|
17
|
+
<%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][#{idx}][answer_option_id]", answer_option.id %>
|
21
18
|
</div>
|
22
19
|
<% end %>
|
23
20
|
</div>
|
@@ -1 +1 @@
|
|
1
|
-
<%= answer_form.hidden_field :body, value: "title-and-description", id: field_id, disabled:
|
1
|
+
<%= answer_form.hidden_field :body, value: "title-and-description", id: field_id, disabled: %>
|