Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course

This commit is contained in:
huang 2015-11-20 18:02:04 +08:00
commit d1e0e0fd30
3 changed files with 14 additions and 15 deletions

View File

@ -114,6 +114,7 @@ class ExerciseController < ApplicationController
end
def destroy
@is_teacher = User.current.allowed_to?(:as_teacher,@course) || User.current.admin?
if @exercise && @exercise.destroy
if @is_teacher
exercises = Exercise.where("course_id =?", @course.id)

View File

@ -20,10 +20,8 @@
<% if exercise.exercise_status == 1 %>
<li><a href="javascript:" class="pollsbtn btn_pu fl ml5" onclick="exercise_submit(<%= exercise.id%>,<%= exercise.exercise_name.length %>);">发布试卷</a></li>
<% elsif exercise.exercise_status == 2%>
<% else %>
<li><a href="javascript:" class="pollsbtn btn_de fl ml5" onclick="republish_exercise(<%= exercise.id%>);">取消发布</a></li>
<% else%>
<li class="pollsbtn fl ml10 pollsbtn_grey" style="margin-left: 5px;" >发布试卷</li>
<% end%>
<%= link_to(l(:button_delete), exercise,:method => :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "polls_de fr ml5 mr10") %>
@ -34,17 +32,17 @@
<li class="polls_de_grey fr ml5" title="未发布的试卷才能进行编辑">编辑</li>
<% end%>
<% if exercise.exercise_status == 2 %>
<li><a class="polls_de fr ml5" onclick="" href="javascript:">关闭</a></li>
<% else %>
<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>
<% end%>
<%# if exercise.exercise_status == 2 %>
<!--<li><a class="polls_de fr ml5" onclick="" href="javascript:">关闭</a></li>-->
<%# else %>
<!--<li class="polls_de_grey fr ml5" title="发布的问卷才能进行关闭">关闭</li>-->
<%# end%>
<% if exercise.exercise_status == 1%>
<li class="polls_de_grey fr ml5">导出</li>
<% elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %>
<li><%= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%></li>
<% end%>
<%# if exercise.exercise_status == 1%>
<!--<li class="polls_de_grey fr ml5">导出</li>-->
<%# elsif exercise.exercise_status == 2 || exercise.exercise_status == 3 %>
<!--<li><%#= link_to "导出", export_exercise_exercise_path(exercise.id,:format => "xls"), :class => "polls_de fr ml5"%></li>-->
<%# end%>
<li class="polls_date fr"><%= format_date exercise.created_at.to_date%></li>

View File

@ -83,9 +83,9 @@
function add_poll_question(doc,quest_type,quest_id)
{
var title = $.trim($("#poll_questions_title").val());
var score = $.trim($("#questions_score").val());
var score = $.trim($("#question_score").val());
if(title.length == 0 || score.length == 0){
alert("题目标题/分数+不能为空");
alert("题目标题/分数不能为空");
}else{
doc.parent().parent().parent().submit();}
}