survey/app/views/admin/surveys/answer_set.html.erb

104 lines
2.1 KiB
Plaintext
Raw Normal View History

<% content_for :page_specific_css do %>
<style>
.answer-set .title{
margin-bottom: 15px;
}
.answer-set .title i{
margin-right: 10px;
}
.answer-set .set{
height: 100%;
width: 100%;
padding: 15px 0px;
}
.set {
color: #7E7D7D;
}
.set .qa{
padding: 15px 10px;
margin-bottom: 10px;
background-color: #fff;
}
.set .qa .init{
margin-right: 5px;
width: 30px;
border-right: 3px solid #7E7D7D;
display: inline-block;
font-weight: bold;
vertical-align: top;
}
.set .question{
font-size: 16px;
border-bottom: 1px solid #cecece;
padding-bottom: 5px;
}
.set .answer{
font-size: 16px;
padding-top: 5px;
word-break: break-all;
}
.set .radiogroup{
display: inline-block;
}
</style>
<% end %>
<div class="answer-set">
<div class="title">
<h3><%= @survey.title %></h3>
<% if !@user.nil? %>
<h5><i class="icon icons-user"></i><%= @user.name %></h5>
<% end %>
</div>
<div class="set">
<% @survey.survey_questions.each_with_index do |sq, index| %>
<div class="qa">
<div class="question">
<span class="init">Q<%= (index + 1).to_s %></span> <%= sq.title %>
</div>
<div class="answer">
<span class="init">A</span>
<% case sq.type %>
<% when SurveyQuestion::Radio, SurveyQuestion::Select %>
<%= @survey_answer[sq.id.to_s] rescue "" %>
<% when SurveyQuestion::Check %>
<%= @survey_answer[sq.id.to_s].join(", ") rescue "" %>
<% when SurveyQuestion::Radiogroup %>
<div class="radiogroup">
<% sq.survey_question_options.each do |sqo| %>
<% if !@survey_answer[sq.id.to_s].nil? %>
<%= sqo.name %> : <%= @survey_answer[sq.id.to_s][sqo.id.to_s] %> <br />
<% end %>
<% end %>
</div>
<% when SurveyQuestion::Oneline, SurveyQuestion::Multiline %>
<%= @survey_answer[sq.id.to_s] rescue "" %>
<% end %>
</div>
</div>
<% end %>
</div>
<% if can_edit_or_delete?(@survey) %>
<div class="action">
<a href="/admin/surveys/<%= @survey.id.to_s %>/answer_sets" class="btn btn-primary">Back to answer sets</a>
</div>
<% end %>
</div>