% field_id = "questionnaire_responses_#{answer_idx}" %>
<% if answer.question.separator? %>
<%= render partial: "decidim/forms/questionnaires/answers/#{answer.question.question_type}", locals: { answer: answer, answer_form: answer_form, answer_idx: answer_idx, field_id: field_id, disabled: disabled } %>
<%= answer_form.hidden_field :question_id %>
<% elsif answer.question.title_and_description? %>
<%= label_tag field_id, translated_attribute(answer.question.body), class: "questionnaire-title_and_description" %>
<% if translated_attribute(answer.question.description).present? %>
<%= decidim_sanitize_editor_admin translated_attribute(answer.question.description) %>
<% end %>
<%= render partial: "decidim/forms/questionnaires/answers/#{answer.question.question_type}", locals: { answer: answer, answer_form: answer_form, answer_idx: answer_idx, field_id: field_id, disabled: disabled } %>
<%= answer_form.hidden_field :question_id %>
<% else %>
<% case answer.question.question_type %>
<% when "single_option", "multiple_option", "sorting" %>
<% else %>
<%= label_tag field_id, answer.label(cleaned_answer_idx), class: "questionnaire-question" %>
<% end %>
<% if translated_attribute(answer.question.description).present? %>
<%= decidim_sanitize_editor_admin translated_attribute(answer.question.description) %>
<% end %>
<%= render partial: "decidim/forms/questionnaires/answers/#{answer.question.question_type}", locals: { answer: answer, answer_form: answer_form, answer_idx: answer_idx, field_id: field_id, disabled: disabled, maxlength: (answer.question.max_characters if answer.question.max_characters.positive?) } %>
<%= answer_form.hidden_field :question_id %>
<% if answer.question.max_choices %>
<%= t(".max_choices_alert") %>
<% end %>
<% answer.errors.full_messages.each do |msg| %>
<%= msg %>
<% end %>
<% end %>