dev_forum
SylorHuang 6 years ago
parent e365005af1
commit 81950469b4

@ -80,15 +80,15 @@
<% if q.question_type == 0 %> <% if q.question_type == 0 %>
<% q.exercise_choices.each do |s| %> <% q.exercise_choices.each do |s| %>
<div class="pbt5 clearfix"> <div class="pbt5 clearfix">
<span class="choose-radio pull-left line-24"></span> <span class="choose-radio pull-left line-24 mt5"></span>
<span class="inline-block pull-left line-24"><%= to_markdown(s.choice_text) %></span> <span class="inline-block pull-left line-24 ml10"><%= to_markdown(s.choice_text) %></span>
</div> </div>
<% end %> <% end %>
<% elsif q.question_type == 1 %> <% elsif q.question_type == 1 %>
<% q.exercise_choices.each do |s| %> <% q.exercise_choices.each do |s| %>
<div class="pbt5 clearfix"> <div class="pbt5 clearfix">
<span class="choose-checkbox pull-left line-24"></span> <span class="choose-checkbox pull-left line-24 mt5"></span>
<span class="inline-block pull-left line-24"><%= to_markdown(s.choice_text) %></span> <span class="inline-block pull-left line-24 ml10"><%= to_markdown(s.choice_text) %></span>
</div> </div>
<% end %> <% end %>
<% elsif q.question_type == 2 %> <% elsif q.question_type == 2 %>

@ -44,6 +44,9 @@ p{
.mbt10{ .mbt10{
margin: 10px 0; margin: 10px 0;
} }
.mt5{
margin-top:5px;
}
.pull-right{ .pull-right{
float:right; float:right;
} }
@ -82,9 +85,15 @@ p{
.ml20{ .ml20{
margin-left:20px; margin-left:20px;
} }
.ml10{
margin-left:10px;
}
.mr3{ .mr3{
margin-right:3px; margin-right:3px;
} }
.mr8{
margin-right:8px;
}
.mr15{ .mr15{
margin-right:15px; margin-right:15px;
} }
@ -318,3 +327,4 @@ textarea{

@ -167,41 +167,39 @@
<% end %> <% end %>
</div> </div>
<div class="pbt5"> <div class="pbt5">
<% q_title = q.question_title&.html_safe %> <% if q.question_type == 5 %>
<% if q_type == 5 %> <span class="ques-title" ><%= to_markdown(q.shixun_name) %></span>
<% q_name = q.shixun_name&.html_safe %>
<span class="ques-title"><%= q_name&.include?("src=\"") ? q_name&.gsub("src=\"","src=\"#{@request_url}") : q_name %></span>
<div class="mt8 text-gray"> <div class="mt8 text-gray">
<span><%= q_title&.include?("src=\"") ? q_title&.gsub("src=\"","src=\"#{@request_url}") : q_title %></span> <span><%= to_markdown(q.question_title) %></span>
</div> </div>
<% else %> <% else %>
<span class="ques-title"><%= q_title&.include?("src=\"") ? q_title&.gsub("src=\"","src=\"#{@request_url}") : q_title %></span> <span class="ques-title"><%= to_markdown(q.question_title) %></span>
<% end %> <% end %>
</div> </div>
</div> </div>
<div class="pbt5"> <div class="pbt5">
<% if q_type == 0 %> <% if q_type == 0 %>
<% q.exercise_choices.each_with_index do |s,index| %> <% q.exercise_choices.each do |s| %>
<% check_answer = (user_answer.present? && (s.id == user_answer.first.exercise_choice_id)) ? "choose-answer" : '' %> <% check_answer = (user_answer.present? && (s.id == user_answer.first.exercise_choice_id)) ? "choose-answer" : '' %>
<p class="pbt5"> <div class="pbt5 clearfix">
<span class="choose-radio <%= check_answer %>"></span> <span class="choose-radio <%= check_answer %> pull-left line-24 mt5"></span>
<span class="mr15"><%= convert_to_char((index+1).to_s)%></span><%= s.choice_text%> <span class="inline-block pull-left line-24 ml10"><%= to_markdown(s.choice_text) %></span>
</p> </div>
<% end %> <% end %>
<% elsif q_type == 1 %> <% elsif q_type == 1 %>
<% q.exercise_choices.each_with_index do |s,index| %> <% q.exercise_choices.each do |s| %>
<% check_answer = (user_answer.present? && (user_answer.pluck(:exercise_choice_id).include?(s.id))) ? true : false %> <% check_answer = (user_answer.present? && (user_answer.pluck(:exercise_choice_id).include?(s.id))) ? true : false %>
<p class="pbt5"> <div class="pbt5 clearfix">
<% if check_answer %> <% if check_answer %>
<span class="choose-checkbox choose-answer-multi" ></span> <span class="choose-checkbox choose-answer-multi pull-left line-24 mt5" ></span>
<% else %> <% else %>
<span class="choose-checkbox"></span> <span class="choose-checkbox pull-left line-24 mt5"></span>
<% end %> <% end %>
<span class="mr15"><%= convert_to_char((index+1).to_s)%></span><%= s.choice_text%> <span class="inline-block pull-left line-24 ml10"><%= to_markdown(s.choice_text) %></span>
</p> </div>
<% end %> <% end %>
<% elsif q_type == 2 %> <% elsif q_type == 2 %>
<p class="pbt5"> <div class="pbt5 clearfix">
<% q.exercise_choices.each do |s| %> <% q.exercise_choices.each do |s| %>
<% if user_answer.present? && (s.id == user_answer.first.exercise_choice_id) %> <% if user_answer.present? && (s.id == user_answer.first.exercise_choice_id) %>
<% check_answer = 'choose-answer' %> <% check_answer = 'choose-answer' %>
@ -213,7 +211,7 @@
<span class="mlr5"><%= s.choice_text %></span> <span class="mlr5"><%= s.choice_text %></span>
</span> </span>
<% end %> <% end %>
</p> </div>
<% elsif q_type == 3 %> <% elsif q_type == 3 %>
<% st_counts = q.exercise_standard_answers.pluck(:exercise_choice_id).uniq %> <% st_counts = q.exercise_standard_answers.pluck(:exercise_choice_id).uniq %>
<% st_counts.each_with_index do |s,index| %> <% st_counts.each_with_index do |s,index| %>
@ -224,13 +222,13 @@
<% end %> <% end %>
<p class="pbt10 flex-nowrap"> <p class="pbt10 flex-nowrap">
<span class="pull-left line-34">答案(填空<%= index+1 %></span> <span class="pull-left line-34">答案(填空<%= index+1 %></span>
<span class="null-answer"><%= check_answer&.html_safe %></span> <span class="null-answer"><%= to_markdown(check_answer) %></span>
</p> </p>
<% end %> <% end %>
<% elsif q_type == 4 %> <% elsif q_type == 4 %>
<% check_answer = (user_answer.present? ? user_answer.first.answer_text : '--') %> <% check_answer = (user_answer.present? ? user_answer.first.answer_text : '--') %>
<p class="flex-nowrap"> <p class="flex-nowrap">
<span class="null-answer main-height"><%= check_answer&.html_safe %></span> <span class="null-answer main-height"><%= to_markdown(check_answer) %></span>
</p> </p>
<% else %> <% else %>
<div class="mbt10"> <div class="mbt10">

Loading…
Cancel
Save