导入试卷
This commit is contained in:
parent
57c82effed
commit
9f79408e32
|
@ -618,6 +618,20 @@ class ExerciseController < ApplicationController
|
|||
score = score1 + score2 + score3
|
||||
end
|
||||
|
||||
#导入试卷的弹框
|
||||
def other_exercise
|
||||
# 查作者是我,或者作者是当前课程的老师,且不在当前课程内的试卷 进行导入
|
||||
courses = User.current.courses.not_deleted.select { |course| User.current.allowed_to?(:as_teacher,course)}
|
||||
course_ids = courses.empty? ? "(-1)" : "(" + courses.map { |course| course.id}.join(',') + ")"
|
||||
#none_courses = User.current.courses.where("is_delete = 1 or #{Course.table_name}.id = #{params[:course_id].to_i}")
|
||||
#none_course_ids = none_courses.empty? ? "(-1)" : "(" + none_courses.map { |course| course.id}.join(',') + ")"
|
||||
@exercises = Exercise.where("(user_id = #{User.current.id} or course_id in #{course_ids}) and course_id != #{params[:course_id].to_i}")
|
||||
@course_id = params[:course_id]
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
#测验列表转换为excel
|
||||
def exercise_to_xls items
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<span>(<%= @obj_count%>)</span>
|
||||
</h2>
|
||||
<% if @is_teacher%>
|
||||
<%#= link_to "导入", other_poll_poll_index_path(:polls_group_id => @course.id), :remote=>true,:class => "newbtn"%>
|
||||
<%= link_to "导入试卷", other_exercise_exercise_index_path(:course_id => @course.id), :remote=>true,:class => "newbtn"%>
|
||||
<%= link_to "新建试卷 ", new_exercise_path(:course_id => @course.id), :class => "newbtn" %>
|
||||
<% end%>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,117 @@
|
|||
<div id="muban_popup_box" style="width:745px;">
|
||||
<div class="muban_popup_top">
|
||||
<h3 class="fl">选择试卷导入本班级</h3>
|
||||
<a href="javascript:void(0);" class="muban_icons_close fr"></a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="muban_popup_con">
|
||||
<div class="newupload_conbox">
|
||||
<div class="newupload_search_box mb10">
|
||||
<input class="newupload_search_input" placeholder="输入试卷标题的关键词进行搜索" type="text">
|
||||
<a href="javascript:void(0);" class="newupload_btn_search"></a>
|
||||
</div>
|
||||
</div>
|
||||
<div class=" ml15">
|
||||
<table class="newupload_table " cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="newupload_td01"> </th>
|
||||
<th>试卷标题</th>
|
||||
<th class="newupload_td03">来源</th>
|
||||
<th class="newupload_td05">引用数<a href="javascript:void(0);" class="sortdownbtn mt5 fr"></a></th>
|
||||
<th class="newupload_td05">创建时间<a href="javascript:void(0);" class="sortdownbtn mt5 fr mr5"></a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td02"><p>软件测试小测</p></td>
|
||||
<td class="newupload_td02"><p>软件测试软件测试软件测试软件测试软件测试软件测试软件测试软件测试</p></td>
|
||||
<td class="newupload_td05">300000</td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td02"><p>数据库查询系统数据库查询系统课数据库查询系统课数据库查询系统课数据库查询系统课课件练习.doc</p></td>
|
||||
<td class="newupload_td02"><p>软件测试</p></td>
|
||||
<td class="newupload_td05">1</td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td02"><p>软件测试小测</p></td>
|
||||
<td class="newupload_td02"><p>软件测试软件测试软件测试软件测试软件测试软件测试软件测试软件测试</p></td>
|
||||
<td class="newupload_td05">3</td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td02"><p>数据库查询系统数据库查询系统课数据库查询系统课数据库查询系统课数据库查询系统课课件练习.doc</p></td>
|
||||
<td class="newupload_td02"><p>软件测试</p></td>
|
||||
<td class="newupload_td05">1</td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td02"><p>软件测试小测</p></td>
|
||||
<td class="newupload_td02"><p>软件测试软件测试软件测试软件测试软件测试软件测试软件测试软件测试</p></td>
|
||||
<td class="newupload_td05">3</td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td02"><p>数据库查询系统数据库查询系统课数据库查询系统课数据库查询系统课数据库查询系统课课件练习.doc</p></td>
|
||||
<td class="newupload_td02"><p>软件测试</p></td>
|
||||
<td class="newupload_td05">1</td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td02"><p>软件测试小测</p></td>
|
||||
<td class="newupload_td02"><p>软件测试软件测试软件测试软件测试软件测试软件测试软件测试软件测试</p></td>
|
||||
<td class="newupload_td05">3</td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td02"><p>数据库查询系统数据库查询系统课数据库查询系统课数据库查询系统课数据库查询系统课课件练习.doc</p></td>
|
||||
<td class="newupload_td02"><p>软件测试</p></td>
|
||||
<td class="newupload_td05">1</td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td02"><p>软件测试小测</p></td>
|
||||
<td class="newupload_td02"><p>软件测试软件测试软件测试软件测试软件测试软件测试软件测试软件测试</p></td>
|
||||
<td class="newupload_td05">3</td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="newupload_td01"><input type="checkbox"> </td>
|
||||
<td class="newupload_td02"><p>数据库查询系统数据库查询系统课数据库查询系统课数据库查询系统课数据库查询系统课课件练习.doc</p></td>
|
||||
<td class="newupload_td02"><p>软件测试</p></td>
|
||||
<td class="newupload_td05">1</td>
|
||||
<td class="newupload_td05">2016-10-26</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="clear">
|
||||
<div class="clear fl mt10">
|
||||
<button class=" btn btn-blue fr ">确定</button >
|
||||
<button class=" btn fr mr5">取消</button >
|
||||
</div>
|
||||
<div class="fr pages_right_min mt10 mr15" >
|
||||
<a href="javascript:void(0);" class="pages-big">上一页</a>
|
||||
<a href="javascript:void(0);" class="active ">1</a>
|
||||
<a href="javascript:void(0);">2</a>
|
||||
<a href="javascript:void(0);">3</a>
|
||||
<a href="javascript:void(0);">...</a>
|
||||
<a href="javascript:void(0);">31</a>
|
||||
<a href="javascript:void(0);" class="pages-big pages-border-right">下一页</a>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
|
@ -0,0 +1,8 @@
|
|||
<% if @exercises.blank? %>
|
||||
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 mt15"><p class="text_c f14">您的其它班级下没有试卷可供导入</p><div class="cl"></div><a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 122px;" onclick="hideModal();">确定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% else %>
|
||||
var html_value = '<%= escape_javascript(render :partial => 'other_exercises',:locals => {:exercises => @exercises, :course_id=>@course_id}) %>';
|
||||
pop_box_new(html_value, 510, 550);
|
||||
<% end %>
|
|
@ -1,14 +1,8 @@
|
|||
<% if @polls.empty? %>
|
||||
alert('您的其它班级下没有问卷可供导入');
|
||||
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 mt15"><p class="text_c f14">您的其它班级下没有问卷可供导入</p><div class="cl"></div><a href="javascript:void(0);" class="fr sy_btn_blue mt10" style="margin-right: 122px;" onclick="hideModal();">确定</a></div></div>';
|
||||
pop_box_new(htmlvalue, 300, 140);
|
||||
<% else %>
|
||||
var html_value = '<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>';
|
||||
pop_box_new(html_value, 510, 550);
|
||||
// $('#ajax-modal').html('<%= escape_javascript(render :partial => 'other_poll',:locals => {:polls => @polls,:polls_group_id=>@polls_group_id}) %>');
|
||||
//
|
||||
//
|
||||
// showModal('ajax-modal', '513px');
|
||||
// $('#ajax-modal').siblings().remove();
|
||||
// $('#ajax-modal').before("<a href='javascript:void(0)' onclick='closeModal()' style='margin-left: 480px;'><img src='/images/bid/close.png' width='26px' height='26px' /></a>");
|
||||
// $('#ajax-modal').parent().css("top","").css("left","").css("border","3px solid #269ac9");
|
||||
// $('#ajax-modal').parent().addClass("popbox_polls");
|
||||
<% end %>
|
|
@ -296,6 +296,7 @@ RedmineApp::Application.routes.draw do
|
|||
collection do #生成路径为 /exercise/方法名
|
||||
delete 'delete_exercise_question'
|
||||
post 'update_exercise_question'
|
||||
get 'other_exercise'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 27 KiB |
Loading…
Reference in New Issue