Sha256: 37089e055f30b3c6dcf26d20f8fe137bbf5ac6cffb329a8b910bf4bd8089c161

Contents?: true

Size: 1.39 KB

Versions: 5

Compression:

Stored size: 1.39 KB

Contents

<% @prev_question_id == nil %>
<%= f.fields_for(:answers) do |answer| %>
  
  <% question = answer.object.question %>
  <%= answer.hidden_field(:question_id, value: question.id) %>

  <% if question.rhetorical?  # aka, it does not need to be answered %>
    <% case(question.type.to_sym) %>
    <% when :FormSection %>
      <%= render 'questions/form_section', answer: answer, question: question %>
    <% end %>

  <% else %>
    <% if question.supports_multiple_answers? && (@prev_question_id == question.id) %>
      <% # Don't redisplay the label again for each checklist choice, just display it the first time %>
    <% else %>
      <%= render 'questions/label', answer: answer, question: question %>
      <% @prev_question_id = question.id %>
    <% end %>

    <% case(question.type.to_sym) %>
    <% when :TextQuestion %>
      <%= render 'questions/text_question', answer: answer, question: question %>
    <% when :EssayQuestion %>
      <%= render 'questions/essay_question', answer: answer, question: question %>
    <% when :UploadQuestion %>
      <%= render 'questions/upload_question', answer: answer, question: question %>
    <% when :ChooseOneQuestion %>
      <%= render 'questions/choose_one_question', answer: answer, question: question %>
    <% when :ChecklistQuestion %>
      <%= render 'questions/checklist_question', answer: answer, question: question %>
    <% end %>
  <% end %>
<% end %>

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ask-0.5.4 app/views/answerer/_form.html.erb
ask-0.5.3 app/views/answerer/_form.html.erb
ask-0.5.2 app/views/answerer/_form.html.erb
ask-0.5.1 app/views/answerer/_form.html.erb
ask-0.5.0 app/views/answerer/_form.html.erb