Sha256: 8c2e5fb6375d5ec764139b64d5f9997138600beecb22ca5b5537f78dbacaf06a
Contents?: true
Size: 1.44 KB
Versions: 2
Compression:
Stored size: 1.44 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"> <%= builder.label :data, question.prompt %> <%= builder.text_field :data %> </div> <% end -%> <% elsif question.multiple? -%> <div class="checkboxes"> <%= 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"> <%= builder.label :data, question.prompt %> <%= builder.collection_select :data, question.choices, :value, :value, :include_blank => true %> </div> <% end -%> <% end -%>
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
census-0.2.0 | app/views/census/_question_fields.html.erb |
census-0.1.0 | app/views/census/_question_fields.html.erb |