Merge branch 'dev_aliyun' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

dev_forum
daiao 5 years ago
commit 667a77feb7

@ -128,7 +128,7 @@ class MessagesController < ApplicationController
def destroy def destroy
begin begin
return normal_status(403, "您没有权限进行该操作") unless @message.author == current_user || current_user.teacher_of_course?(@message.board.course) return normal_status(403, "您没有权限进行该操作") if current_user.course_identity(@message.board.course) >= 5 || @message.author != current_user
@message.destroy! @message.destroy!
rescue Exception => e rescue Exception => e
uid_logger_error(e.message) uid_logger_error(e.message)

@ -349,9 +349,7 @@ module ApplicationHelper
} }
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,options) markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTML,options)
m_t = markdown.render(text) m_t = markdown.render(text)
ss = m_t&.include?("src=\"") ? m_t&.gsub("src=\"","src=\"#{request_url}") : m_t m_t&.include?("src=\"") ? m_t&.gsub("src=\"","src=\"#{request_url}") : m_t
Rails.logger.info("############_____________ss________________##################{ss}")
ss
end end
end end

@ -44,7 +44,6 @@
<span class="mr15">实训题<span class="mlr5"><%= @exercise_ques_shixun_count %></span>题, <span class="mr15">实训题<span class="mlr5"><%= @exercise_ques_shixun_count %></span>题,
共<span class="mlr5"><%= @exercise_ques_shixun_scores %></span>分</span> 共<span class="mlr5"><%= @exercise_ques_shixun_scores %></span>分</span>
<% end %> <% end %>
<% if @exercise_ques_count > 0 %> <% if @exercise_ques_count > 0 %>
<span class="pull-right"> <span class="pull-right">
共<span class="text-orange mlr5"><%= @exercise_ques_scores %></span>分 共<span class="text-orange mlr5"><%= @exercise_ques_scores %></span>分
@ -59,7 +58,7 @@
<div class="mbt10"> <div class="mbt10">
<% @exercise_questions.each do |q| %> <% @exercise_questions.each do |q| %>
<div class="bdc"> <div class="bdc">
<div class="pbt10"> <div class="pbt5">
<div class="pbt5"> <div class="pbt5">
<span class="mr5 text-blue"><%= q.question_number %>、</span> <span class="mr5 text-blue"><%= q.question_number %>、</span>
<span class="text-blue"> <span class="text-blue">
@ -68,45 +67,39 @@
<span class="text-gray mlr5">(<%= q&.question_score %>分)</span> <span class="text-gray mlr5">(<%= q&.question_score %>分)</span>
</div> </div>
<div class="pbt5"> <div class="pbt5">
<img src="http://47.96.87.25:48080/api/attachments/368984" alt="电脑的电路图" title="电脑的电路图">
<img class="myavatar avatar-48" alt="udasker_picture" src="http://images.udask.cn/uploaders/user/picture/2/2_udasker.jpg?v=1556452947">
<% q_markdown = to_markdown(q.question_title) %>
<% if q.question_type == 5 %> <% if q.question_type == 5 %>
<% q_markdown_name = to_markdown(q.shixun_name) %> <span class="ques-title" ><%= to_markdown(q.shixun_name) %></span>
<span class="ques-title" ><%= q_markdown_name %></span>
<div class="mt8 text-gray"> <div class="mt8 text-gray">
<span><%= q_markdown %></span> <span><%= to_markdown(q.question_title) %></span>
</div> </div>
<% else %> <% else %>
<span class="ques-title"><%= q_markdown %></span> <span class="ques-title"><%= to_markdown(q.question_title) %></span>
<% end %> <% end %>
</div> </div>
<div class="pbt5"> <div class="pbt5">
<% if q.question_type == 0 %> <% if q.question_type == 0 %>
<% q.exercise_choices.each_with_index do |s,index| %> <% q.exercise_choices.each do |s| %>
<p class="pbt5"> <div class="pbt5 clearfix">
<span class="choose-radio"></span> <span class="choose-radio pull-left line-24 mt5"></span>
<span class="mr15"><%= convert_to_char((index+1).to_s)%></span> <span class="inline-block pull-left line-24 ml10"><%= to_markdown(s.choice_text) %></span>
<span class="inline-block"><%= to_markdown(s.choice_text) %></span> </div>
</p>
<% end %> <% end %>
<% elsif q.question_type == 1 %> <% elsif q.question_type == 1 %>
<% q.exercise_choices.each_with_index do |s,index| %> <% q.exercise_choices.each do |s| %>
<p class="pbt5"> <div class="pbt5 clearfix">
<span class="choose-checkbox"></span> <span class="choose-checkbox pull-left line-24 mt5"></span>
<span class="mr20"><%= convert_to_char((index+1).to_s)%></span> <span class="inline-block pull-left line-24 ml10"><%= to_markdown(s.choice_text) %></span>
<span class="inline-block"><%= to_markdown(s.choice_text) %></span> </div>
</p>
<% end %> <% end %>
<% elsif q.question_type == 2 %> <% elsif q.question_type == 2 %>
<p class="pbt5"> <div class="pbt5 clearfix">
<% q.exercise_choices.each_with_index do |s,index| %> <% q.exercise_choices.each do |s| %>
<span class="mr15"> <span class="mr15 clearfix">
<span class="choose-radio "></span> <span class="choose-radio "></span>
<span class="mlr5 inline-block"><%= to_markdown(s.choice_text) %></span> <span class="mlr5 inline-block"><%= s.choice_text %></span>
</span> </span>
<% end %> <% end %>
</p> </div>
<% elsif q.question_type == 3 %> <% elsif q.question_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| %>

@ -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;
} }
@ -309,6 +318,13 @@ textarea{
clear:both; clear:both;
zoom:1; zoom:1;
} }
.line-24{
line-height: 24px;
}
.line-24 p{
margin-bottom:0;
}

@ -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