Sha256: 3d40edc6e470fab982ff3e045107793569d7b060d31c19c40f8c19aa270fe8f4
Contents?: true
Size: 1.57 KB
Versions: 10
Compression:
Stored size: 1.57 KB
Contents
<% if question.choices.empty? -%> <% answer = user.first_answer_for(question) -%> <% fields_for "user[answers_attributes][#{user.answers.index(answer)}]", answer do |builder| -%> <%= builder.hidden_field :id %> <%= builder.hidden_field :question_id %> <div class="text_field" id="<%=h question.prompt.parameterize %>"> <%= builder.label :data, question.prompt %> <%= builder.text_field :data %> </div> <% end -%> <% elsif question.multiple? -%> <div class="checkboxes" id="<%=h question.prompt.parameterize %>"> <%= label_tag question.prompt %> <ul> <% question.choices.each do |choice| -%> <% answer = user.answer_for_choice(choice) -%> <% fields_for "user[answers_attributes][#{user.answers.index(answer)}]", answer do |builder| -%> <%= builder.hidden_field :id %> <%= builder.hidden_field :question_id %> <li> <%= builder.check_box :data, {}, choice.value, '' %> <%= builder.label :data, choice.value %> </li> <% end -%> <% end -%> </ul> </div> <% else -%> <% answer = user.first_answer_for(question) -%> <% fields_for "user[answers_attributes][#{user.answers.index(answer)}]", answer do |builder| -%> <%= builder.hidden_field :id %> <%= builder.hidden_field :question_id %> <div class="select_field" id="<%=h question.prompt.parameterize %>"> <%= builder.label :data, question.prompt %> <%= builder.collection_select :data, question.choices, :value, :value, :include_blank => true %> </div> <% end -%> <% end -%>
Version data entries
10 entries across 10 versions & 1 rubygems