在线测试试卷保存后应该支持发布

This commit is contained in:
cxt 2017-03-07 10:17:14 +08:00
parent 6f3f54b1a8
commit 8f856da568
4 changed files with 16 additions and 6 deletions

View File

@ -23,6 +23,7 @@
<li><a href="<%= edit_exercise_path(exercise.id) %>" class="postOptionLink" title="编辑试卷">编&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;辑</a></li> <li><a href="<%= edit_exercise_path(exercise.id) %>" class="postOptionLink" title="编辑试卷">编&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;辑</a></li>
<% end%> <% end%>
<li><a href="<%= exercise_path(exercise.id) %>" class="postOptionLink" title="查看试卷">查&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;看</a></li> <li><a href="<%= exercise_path(exercise.id) %>" class="postOptionLink" title="查看试卷">查&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;看</a></li>
<li><a href="javascript:void(0)" onclick="send_exercise_to_course();" class="postOptionLink" title="发送到班级">发&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;送</a></li>
<% if exercise.exercise_status == 1 %> <% if exercise.exercise_status == 1 %>
<% end_time_status = exercise.end_time.nil? ? 1 : (exercise.end_time <= Time.now ? 2 : 3) %> <% end_time_status = exercise.end_time.nil? ? 1 : (exercise.end_time <= Time.now ? 2 : 3) %>
<li><a href="javascript:" class="postOptionLink" onclick="exercise_submit(<%=end_time_status %>,<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></li> <li><a href="javascript:" class="postOptionLink" onclick="exercise_submit(<%=end_time_status %>,<%= exercise.id%>,<%= exercise.exercise_name.length %>,<%=index.to_i %>);">发布试卷</a></li>
@ -101,4 +102,11 @@
</div> </div>
<% end%> <% end%>
<% end%> <% end%>
<script>
function send_exercise_to_course(){
var htmlvalue = "<%= escape_javascript(render :partial => 'exercise/send_to_course', :locals => {:exercise => exercise}) %>";
pop_box_new(htmlvalue, 450, 325);
}
</script>

View File

@ -153,12 +153,14 @@
<%= render :partial => 'exercise/total_questions_score', :locals => {:exercise => exercise, :current_score => current_score} %> <%= render :partial => 'exercise/total_questions_score', :locals => {:exercise => exercise, :current_score => current_score} %>
</div> </div>
<div class="ur_buttons" style="width: 220px;"> <div class="ur_buttons" style="width: 297px;">
<%= link_to "返回", exercise_index_path(:course_id => @course.id),:class => "btn_grey_64_width" %> <%= link_to "返回", exercise_index_path(:course_id => @course.id),:class => "btn_grey_64_width" %>
<a href="javascript:void(0)" onclick="send_exercise_to_course();" class="btn_green_64_width ml10 mr10">发送</a> <a href="javascript:void(0)" onclick="send_exercise_to_course();" class="btn_green_64_width ml10 mr10">发送</a>
<% if exercise.exercise_status == 1 %> <% if exercise.exercise_status == 1 %>
<%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "btn_blue_64_width" %> <a class="btn_green_64_width mr10" onclick="$.get('<%= publish_exercise_exercise_path(@exercise) %>');">立即发布</a>
<%= link_to l(:button_edit), edit_exercise_path(exercise.id), :class => "btn_blue_64_width" %>
<% else %> <% else %>
<span class="btn_grey_64_width mr10" title="测验已发布">立即发布</span>
<span class="btn_grey_64_width" title="测验已发布,不可再编辑">编辑</span> <span class="btn_grey_64_width" title="测验已发布,不可再编辑">编辑</span>
<% end %> <% end %>
</div> </div>

View File

@ -2,5 +2,5 @@
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>"); $("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index =>@index}) %>");
notice_box("发布成功"); notice_box("发布成功");
<% else %> <% else %>
notice_box_redirect('<%= exercise_url(@exercise) %>', '发布成功'); notice_box_redirect('<%= exercise_index_path(:course_id => @course.id) %>', '发布成功');
<% end %> <% end %>

View File

@ -1,5 +1,5 @@
$("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>"); $("#exercises_<%= @exercise.id %>").html("<%= escape_javascript(render :partial => 'exercise',:locals => {:exercise => @exercise,:index => @index}) %>");
var htmlvalue = '<div id="muban_popup_box" style="width:400px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+ var htmlvalue = '<div id="muban_popup_box" style="width:300px;"><div class="muban_popup_top"><h3 class="fl">提示</h3><a href="javascript:void(0);" class="muban_icons_close fr"></a></div>'+
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>取消成功</p>' + '<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>取消成功</p>' +
'<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>'; '<a href="javascript:void(0);" class="btn btn-blue mt10" onclick="hideModal();">知道了</a></div></div></div>';
pop_box_new(htmlvalue, 400, 152); pop_box_new(htmlvalue, 300, 152);