<% answer.question.answer_options.each_with_index do |answer_option, idx| %> <% end %> <% answer.question.matrix_rows.by_position.each_with_index do |row, row_idx| %> <% answer.question.answer_options.each_with_index do |answer_option, idx| %> <% choice = answer.selected_choices.find { |choice| choice.answer_option_id == answer_option.id && choice.matrix_row_id == row.id } %> <% choice_id = "#{field_id}_matrix_row_#{row_idx}_choice_#{idx}" %> <% end %> <% end %>
<%= translated_attribute(answer_option.body) %>
<%= translated_attribute row.body %>
<%= check_box_tag "questionnaire[responses][#{answer_idx}][choices][][body]", translated_attribute(answer_option.body), choice.present?, "aria-label": translated_attribute(answer_option.body), id: "#{choice_id}_body", disabled: %> <%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][][answer_option_id]", answer_option.id, id: "#{choice_id}_answer_option", disabled: true %> <%= hidden_field_tag "questionnaire[responses][#{answer_idx}][choices][][matrix_row_id]", row.id, id: "#{choice_id}_matrix_row", disabled: true %> <% if answer_option.free_text %> <%= text_field_tag "questionnaire[responses][#{answer_idx}][choices][][custom_body]", choice.try(:custom_body), id: "#{choice_id}_custom_body", disabled: true, maxlength: %> <% end %>