@ -1,19 +1,16 @@
<% courses.each do |course|%>
<li>
<li class="pr" >
<span class="user_icons_class"></span>
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
<p href="javascript:void(0);" id="show_course_<%= course.id %>" class="course_list_menu pr" >
<% title = "<span class='course-name'>#{course.syllabus.title}</span>".html_safe %>
<%= link_to title, syllabus_path(course.syllabus_id), :target => '_blank', :class => 'hidden', :style => "max-width:91px; display:inline-block;"%>
<font class="fb c_grey" style="height:39px; line-height:39px; vertical-align:top;">·</font>
<% classes = "<span class='course-name'>#{course.name}</span>".html_safe %>
<%= link_to classes, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => "max-width:91px; display:inline-block;"%>
<span class="sub-menu-title c_dark">
课程名称:<%= course.syllabus.title %><br />
班级名称:<%= course.name+'( '+current_time_and_term(course)+') ' %><br />
班级属性:<%= course.is_public? ? '公开' : '私有' %>
</span>
<p href="javascript:void(0);" id="show_course_<%= course.id %>" class="course_list_menu" >
<%= link_to course.syllabus.title + course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank', :class => 'hidden', :style => 'display:block;'%>
</p>
<div class="sub-menu-title c_dark">
<em></em>
<font></font>
<div>课程:<%= link_to course.syllabus.title, syllabus_path(course.syllabus_id), :target => '_blank' %></div>
<div>班级:<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank' %></div>
</div>
<%#= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course),
:id => "show_course_#{course.id}", :class => 'course_list_menu hidden', :target => '_blank', :title => (course.is_public? ? "公开班级:":"私有班级:")+course.name+"( "+current_time_and_term(course)+") "%>
<% count = ShieldActivity.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
@ -113,25 +110,26 @@
}
$(".course_list_menu").each(function(){
var courseWidth = $(this).children().eq(0).children().width();
var classWidth = $(this).children().eq(2).children().width();
var newClassWidth = 182 - courseWidth;
var newCourseWidth = 182 - classWidth;
console.log(courseWidth, classWidth);
if(courseWidth < 91 && classWidth > 91){
$(this).children().eq(2).css("max-width",newClassWidth + "px");
}
if(classWidth < 91 && courseWidth > 91){
$(this).children().eq(0).css("max-width",newCourseWidth + "px");
}
$(this).mouseenter(function(){
$(".sub-menu-title").hide();
$(this).next().stop();
$(this).next().show();
});
$(this).mouseleave(function(){
$(this).next().delay(500).hide(0);
});
})
$(".course-name").each(function(){
$(this).mouseenter(function(){
$(this).parent().parent().children().eq(3).show();
});
$(this).mouseleave(function(){
$(this).parent().parent().children().eq(3).hide();
});
})
$(".sub-menu-title").each(function(){
var boxWidth = $(this).width();
var leftAttr = boxWidth + 30
$(this).css("left",-leftAttr);
$(this).mouseover(function(){
$(this).stop();
$(this).show();
});
$(this).mouseout(function(){
$(this).delay(500).hide(0);
});
});
</script>