首页班级列表的归档
This commit is contained in:
parent
62ea9d12f7
commit
4388b7625e
|
@ -3397,7 +3397,11 @@ class UsersController < ApplicationController
|
|||
|
||||
@my_syllabuses = @user.syllabuses
|
||||
|
||||
my_syllabus_ids = @my_syllabuses.empty? ? "(-1)" : "(" + @my_syllabuses.map{|syllabus| syllabus.id}.join(',') + ")"
|
||||
if @user == User.current
|
||||
archive_ids = Course.where("tea_id = #{@user.id} and is_delete = 1").blank? ? "(-1)" : "(" + Course.where("tea_id = #{@user.id} and is_delete = 1").map{|course| course.syllabus_id}.join(",") + ")"
|
||||
@archive_syllabuses = Syllabus.where("id in #{archive_ids}")
|
||||
end
|
||||
|
||||
sy_courses = @user.courses.visible.not_deleted
|
||||
syllabus_ids = sy_courses.empty? ? '(-1)' : "(" + sy_courses.map{|course| !course.syllabus_id.nil? && course.syllabus_id}.join(",") + ")"
|
||||
syllabus_members = SyllabusMember.where("user_id = #{@user.id}")
|
||||
|
@ -3469,6 +3473,47 @@ class UsersController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
#归档班级列表
|
||||
def user_archive_courses
|
||||
if User.current.logged?
|
||||
@order, @c_sort, @type, @list_type = params[:order] || 1, params[:sort] || 1, params[:type] || 1, params[:list_type] || 1
|
||||
|
||||
#确定 sort_type
|
||||
if @order.to_i == @type.to_i
|
||||
@c_sort = @c_sort.to_i == 1 ? 2 : 1 #1升序 2降序
|
||||
else
|
||||
@c_sort = 2
|
||||
end
|
||||
|
||||
sort_name = "updated_at"
|
||||
archive_ids = Course.where("tea_id = #{@user.id} and is_delete = 1").blank? ? "(-1)" : "(" + Course.where("tea_id = #{@user.id} and is_delete = 1").map{|course| course.syllabus_id}.join(",") + ")"
|
||||
@archive_syllabuses = Syllabus.where("id in #{archive_ids}")
|
||||
|
||||
if @order.to_i == 1 #根据 班级更新时间排序
|
||||
@archive_syllabuses = syllabus_course_list_sort @archive_syllabuses
|
||||
@c_sort == 1 ? (@archive_syllabuses = @archive_syllabuses.sort{|x,y| x[:last_update] <=> y[:last_update] }) : (@archive_syllabuses = @archive_syllabuses.sort{|x,y| y[:last_update] <=> x[:last_update]})
|
||||
@type = 1
|
||||
elsif @order.to_i == 2 #根据 作业+资源数排序
|
||||
@type = 2
|
||||
@archive_syllabuses.each do |syllabus|
|
||||
count = 0
|
||||
courses = syllabus.courses.not_deleted
|
||||
courses.each do |c|
|
||||
count += (User.current.admin? || User.current.allowed_to?(:as_teacher,c)) ? (c.homework_commons.count + visable_attachemnts_incourse(c).count) : (c.homework_commons.where("publish_time <= '#{Date.today}'").count + visable_attachemnts_incourse(c).count)
|
||||
end
|
||||
syllabus[:infocount] = count
|
||||
end
|
||||
@c_sort == 1 ? (@archive_syllabuses = @syllabuses.sort{|x,y| x[:infocount] <=> y[:infocount] }) : (@archive_syllabuses = @archive_syllabuses.sort{|x,y| y[:infocount] <=> x[:infocount]})
|
||||
@archive_syllabuses = sortby_time_countcommon_nosticky @archive_syllabuses,sort_name
|
||||
else
|
||||
@type = 1
|
||||
end
|
||||
respond_to do |format|
|
||||
format.html
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
#展开课程下的班级
|
||||
def expand_courses
|
||||
@syllabus = Syllabus.where("id = #{params[:syllabus_id]}").first
|
||||
|
|
|
@ -13,5 +13,7 @@ function click_OK(){
|
|||
hideModal();
|
||||
<% if params[:source] == "1" %>
|
||||
window.location.href = "<%=syllabus_courselist_syllabus_path(@syllabus, :list_type => params[:type].to_i) %>";
|
||||
<% else params[:source] == "0" %>
|
||||
window.location.href = "<%=user_courselist_path(User.current) %>";
|
||||
<% end %>
|
||||
}
|
|
@ -68,11 +68,11 @@
|
|||
<%= link_to "加入班级",join_private_courses_courses_path,:remote => true,:class => "hw_btn_green fr mt5",:method => "post"%>
|
||||
<% end %>
|
||||
<% if User.current == course.teacher || User.current.admin? %>
|
||||
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 0);" class="btn_grey_big fr mt5 mr5" style="width: 56px;">归档</a>
|
||||
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 0, 1);" class="btn_grey_big fr mt5 mr5" style="width: 56px;">归档</a>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<% if User.current == course.teacher || User.current.admin? %>
|
||||
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 1);" class="btn_grey_big fr mt5" style="width: 56px;">恢复</a>
|
||||
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 1, 1);" class="btn_grey_big fr mt5" style="width: 56px;">恢复</a>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
|
@ -119,19 +119,4 @@
|
|||
$(function() {
|
||||
$(".sy_con_l").css("min-height",$(".sy_con_r").height());
|
||||
});
|
||||
function archive_course(id, type){
|
||||
if(type == 0){
|
||||
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>'+
|
||||
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>您是否确定归档此班级</p>' +
|
||||
'<a href="javascript:void(0);" class="btn btn-grey mt10 mr10" onclick="hideModal();">取 消</a>' +
|
||||
'<a href="/courses/'+ id +'/archive_course?source=1&type=0" class="btn btn-blue mt10" onclick="hideModal();" data-remote="true">确 定</a></div></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 132);
|
||||
} else{
|
||||
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>'+
|
||||
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>您和您的学生将可以重新在此班级中互动<br/>此班级的动态会在首页中显示<br/><br/>' +
|
||||
'您是否确定恢复此班级</p><a href="javascript:void(0);" class="btn btn-grey mt10 mr10" onclick="hideModal();">取 消</a>' +
|
||||
'<a href="/courses/'+ id +'/archive_course?source=1&type=1" class="btn btn-blue mt10" onclick="hideModal();" data-remote="true">确 定</a></div></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 200);
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -7,30 +7,32 @@
|
|||
</span>
|
||||
|
||||
<div class="fl">
|
||||
<div class="syllabus_class_w ">
|
||||
<div class="syllabus_class_w" style="width: 580px;">
|
||||
<a href="<%= allow_visit ? course_path(course.id) : "javascript:void(0)" %>" class="syllabus_class_title fl" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问" %>"><%= course.name %></a>
|
||||
<span class="<%= course.is_public == 0 ? 'syllabus_class_private' : 'syllabus_class_open' %> fl ml10 mt3 syllabus_class_property"><%= course.is_public == 0 ? '私有' : '公开' %></span>
|
||||
<span class="fr sy_p_grey hidden" style="max-width: 120px;">创建老师:<%= link_to course.teacher.show_name, user_path(course.teacher) %></span>
|
||||
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="">
|
||||
<p class="fl grayTxt ">更新:<%= format_date Time.at(course.updatetime) %><span class="mr10"></span>
|
||||
学期:<%= current_time_and_term(course) %></p>
|
||||
|
||||
<p class="list-info fr grayTxt">
|
||||
<% student_link = (User.current.logged? && course.open_student == 1 && course.is_public == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
|
||||
<span><a href="<%= student_link ? course_member_path(course, :role => 2) : "javascript:void(0)" %>" target="_blank" title="<%= student_link ? "" : "学生列表不对外公开" %>"><%= studentCount course %></a></span><span>学生</span>
|
||||
<span>|</span>
|
||||
<span><a href="<%= allow_visit ? homework_common_index_path(:course => course.id) : "javascript:void(0)" %>" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问" %>"><%= visable_course_homework course %></a></span><span>作业</span>
|
||||
<span>|</span>
|
||||
<span><a href="<%= allow_visit ? course_files_path(course) : "javascript:void(0)" %>" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问" %>"><%= visable_attachemnts_incourse(course).count %></a></span><span>资源</span>
|
||||
创建老师:<%= link_to course.teacher.show_name, user_path(course.teacher) %>
|
||||
</p>
|
||||
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
</div>
|
||||
<span class="icons_sy_arrow fl mt19 ml10"></span>
|
||||
<% if User.current == course.teacher || User.current.admin? %>
|
||||
<div class="pr">
|
||||
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, 0, 0);" onmouseover="$('#archive_notice_<%=course.id %>').show();" onmouseout="$('#archive_notice_<%=course.id %>').hide();" class="btn_grey_big fr mt5 mr15" style="width: 56px;">归档</a>
|
||||
<div class="archive_course_notice fontGrey2 none" id="archive_notice_<%=course.id %>" style="width: 230px;">
|
||||
<em></em>
|
||||
<span></span>
|
||||
<p class="mt5 mb5 break_word">此班级的信息将不再显示<br/>
|
||||
您和您的学生将不能在此班级中继续互动<br/>
|
||||
但您可以点击上方的“归档管理”
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div class="cl"></div>
|
||||
</li>
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
<div class="syllabus_category">
|
||||
<% if @type.to_i == 2 %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :style => "margin-right: 5px;", :remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortdownbtn sort_no fr", :style => "margin-right: 5px;", :remote => true %>
|
||||
<% end %>
|
||||
<%= link_to "人气", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 2 }, :class => "sortTxt fr", :remote => true %>
|
||||
<% if @type.to_i == 1 %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "#{@c_sort.to_i == 1 ? 'sortupbtn' : 'sortdownbtn'} fr", :remote => true %>
|
||||
<% else %>
|
||||
<%= link_to "", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortdownbtn sort_no fr", :remote => true %>
|
||||
<% end %>
|
||||
<%= link_to "时间", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt fr", :remote => true %>
|
||||
<%= link_to "时间", {:controller => 'users', :action => 'sort_syllabus_list', :id =>@user,:list_type => list_type, :type => @type, :sort => @c_sort, :order => 1 }, :class => "sortTxt mr5 fr", :remote => true %>
|
||||
<span class="grayTxt fl "><%=@user == User.current ? "我" : "他" %><%= list_type == 1 ? "创建" : "加入"%>的课程</span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
<div class="syllabus_box" id="course-list">
|
||||
<h2 class="syllabus_h2_top"><span class="icon_course fl mt7 mr5"></span>课程列表</h2>
|
||||
<div style="border-bottom: 1px solid #e7e7e7;">
|
||||
<h2 class="syllabus_h2_top fl" style="border-bottom: none;"><span class="icon_course fl mt7 mr5"></span>课程列表</h2>
|
||||
<% if @user == User.current && !@archive_syllabuses.blank? %>
|
||||
<%= link_to "归档管理", user_archive_courses_users_path(), :class => "linkBlue2 mt15 fr mr20 f14"%>
|
||||
<% end %>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'users/user_syllabus_list'%>
|
||||
<div class="" style="height:20px; background:#eaebec;"></div>
|
||||
|
|
|
@ -579,6 +579,7 @@ RedmineApp::Application.routes.draw do
|
|||
post 'user_select_homework'
|
||||
post 'check_homework'
|
||||
get 'all_journals'
|
||||
get 'user_archive_courses'
|
||||
end
|
||||
|
||||
member do
|
||||
|
|
|
@ -2240,3 +2240,19 @@ function getIssueStatistics(url){
|
|||
|
||||
}
|
||||
|
||||
function archive_course(id, type, source){
|
||||
if(type == 0){
|
||||
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>'+
|
||||
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>您是否确定归档此班级</p>' +
|
||||
'<a href="javascript:void(0);" class="btn btn-grey mt10 mr10" onclick="hideModal();">取 消</a>' +
|
||||
'<a href="/courses/'+ id +'/archive_course?source='+ source +'&type=0" class="btn btn-blue mt10" onclick="hideModal();" data-remote="true">确 定</a></div></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 132);
|
||||
} else{
|
||||
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>'+
|
||||
'<div class="clear muban_popup_con"><div class="newupload_conbox newupload_tishi"><p>您和您的学生将可以重新在此班级中互动<br/>此班级的动态会在首页中显示<br/><br/>' +
|
||||
'您是否确定恢复此班级</p><a href="javascript:void(0);" class="btn btn-grey mt10 mr10" onclick="hideModal();">取 消</a>' +
|
||||
'<a href="/courses/'+ id +'/archive_course?source='+ source +'&type=1" class="btn btn-blue mt10" onclick="hideModal();" data-remote="true">确 定</a></div></div></div>';
|
||||
pop_box_new(htmlvalue, 400, 200);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -597,4 +597,10 @@ a:hover.blueCir{ background:#3598db; color:#fff;}
|
|||
a.ex_icon_de{ background:url(/images/course/icons.png) 0px -342px no-repeat; width:16px; height:27px; display:block;float:right;}
|
||||
a:hover.ex_icon_de{ background:url(/images/course/icons.png) -20px -342px no-repeat;}
|
||||
.ex_icon_edit{ background:url(/images/course/icons.png) 0px -276px no-repeat; width:16px; height:27px; display:block;float:right; margin-right:10px;}
|
||||
a:hover.ex_icon_edit{ background:url(/images/course/icons.png) -21px -276px no-repeat;}
|
||||
a:hover.ex_icon_edit{ background:url(/images/course/icons.png) -21px -276px no-repeat;}
|
||||
|
||||
/*首页课程列表归档按钮提示*/
|
||||
/*分组作业评分提示框*/
|
||||
.archive_course_notice {width:220px; position:absolute; padding:5px 10px; white-space:nowrap; background-color:#fff; right:-265px; top:-15px; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5);}
|
||||
.archive_course_notice em {display:block; border-width:10px; position:absolute;top:26px; left:-20px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;}
|
||||
.archive_course_notice span {display:block; border-width:10px; position:absolute;top:26px; left:-18px; border-style:dashed solid dashed dashed; border-color:transparent #fff transparent transparent; font-size:0; line-height:0;}
|
||||
|
|
|
@ -65,7 +65,7 @@ input.syllabus_input_min{
|
|||
.syllabus_class_list_more{padding:8px; text-align:center;border-left:1px solid #e7e7e7;border-bottom:1px solid #e7e7e7;}
|
||||
.syllabus_class_list_more:hover{ background:#ececec;}
|
||||
.syllabus_class_list_more a{ color:#ff7e00;}
|
||||
a.syllabus_class_title{ font-size:14px; color:#333; max-width:480px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
||||
a.syllabus_class_title{ font-size:14px; color:#333; max-width:520px; margin-bottom:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
|
||||
.syllabus_class_w{ width:650px;}
|
||||
.syllabus_class_property {font-size:12px; padding:0 5px; border-radius:3px; line-height:14px;}
|
||||
.syllabus_class_private {color:#ff4a1b; border:1px solid #ff4a1b;}
|
||||
|
|
Loading…
Reference in New Issue