survey/app/views/admin/surveys_answers/_answer.html.erb

22 lines
772 B
Plaintext

<tr id="<%= dom_id answer %>" class="with_action">
<td>
<%= check_box_tag 'to_delete[]', answer.id, false, :class => "checkbox_in_list" %>
</td>
<% @survey.survey_questions.each do |question| %>
<td>
<% qid = question.id %>
<% case question.type %>
<% when ::SurveyQuestion::Check %>
<%= ( answer[qid] || [] ).join(', ') %>
<% when ::SurveyQuestion::Radiogroup %>
<% options = Hash[question.survey_question_options.collect{|o| [ o.id.to_s, o.name ] }] %>
<%= ( answer[qid] || {} ).map{|key, value| ( options[key] || key ) + ': ' + value}.join('; ') unless answer[qid].blank? %>
<% else %>
<%= answer[qid] %>
<% end %>
</td>
<% end %>
<td>
<%= answer.created_at %>
</td>
</tr>