136 lines
7.7 KiB
Plaintext
136 lines
7.7 KiB
Plaintext
<% courses.each do |course|%>
|
||
<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" >
|
||
<%= link_to 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 %>
|
||
<% wechat_count = ShieldWechatMessage.where("container_type='User' and container_id=#{user.id} and shield_type='Course' and shield_id=#{course.id}").count %>
|
||
|
||
<div class="user_navmore_box">
|
||
<ul class="<%#= count > 0 ? 'shild shildP':'subNavArrow'%>">
|
||
<li class="user_navmore_icons">
|
||
<ul class="user_navmore_txt">
|
||
<% if is_teacher %>
|
||
<li class="clear">
|
||
<%= link_to "作业",homework_common_index_path(:course => course.id), :class => 'user_navmore_li fl', :target => '_blank' %>
|
||
<%= link_to '+',homework_common_index_path(:course => course.id,:is_new => 1), :class => 'user_navmore_add fl', :title => '发布作业',:target => '_blank' %>
|
||
</li>
|
||
<li class="clear">
|
||
<%= link_to "通知", course_news_index_path(course), :class => 'user_navmore_li fl',:target => '_blank' %>
|
||
<%= link_to "+", new_course_news_path(course,:is_new=>1), :class => 'user_navmore_add fl', :title => '发布通知',:target => '_blank' %>
|
||
</li>
|
||
<% else %>
|
||
<li>
|
||
<%= link_to "作业",homework_common_index_path(:course => course.id), :class => 'user_navmore_li', :target => '_blank' %>
|
||
<div class="cl"></div>
|
||
</li>
|
||
<li>
|
||
<%= link_to "通知", course_news_index_path(course), :class => 'user_navmore_li',:target => '_blank' %>
|
||
<div class="cl"></div>
|
||
</li>
|
||
<% end %>
|
||
<% if is_teacher || (course.publish_resource == 1 && User.current.member_of_course?(course)) %>
|
||
<li class="clear">
|
||
<%= link_to "资源",course_files_path(course), :class => 'user_navmore_li fl',:target => '_blank' %>
|
||
<%= link_to "+",upload_files_menu_path(:course_id => course.id), :class => 'user_navmore_add fl',:remote => true, :title => '上传资源' %>
|
||
</li>
|
||
<% else %>
|
||
<li>
|
||
<%= link_to "资源",course_files_path(course), :class => 'user_navmore_li',:target => '_blank' %>
|
||
<div class="cl"></div>
|
||
</li>
|
||
<% end %>
|
||
<li class="clear">
|
||
<%= link_to "论坛",course_boards_path(course), :class => 'user_navmore_li fl',:target => '_blank' %>
|
||
<%= link_to "+",course_boards_path(course, :flag => true, :is_new => 1), :class => 'user_navmore_add fl', :title => '发布帖子',:target => '_blank' %>
|
||
</li>
|
||
<% if !course.syllabus.nil? %>
|
||
<li>
|
||
<%= link_to "所属课程",syllabus_path(course.syllabus_id), :class => 'user_navmore_li',:target => '_blank' %>
|
||
<div class="cl"></div>
|
||
</li>
|
||
<% end %>
|
||
<% if User.current == user %>
|
||
<li>
|
||
<%= link_to "取消收藏", cancel_or_collect_user_path(user, :course => course.id), :class => 'user_navmore_li',:target => '_blank', :remote => true %>
|
||
<div class="cl"></div>
|
||
</li>
|
||
<li>
|
||
<% if count == 0 %>
|
||
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :course_id => course.id), :method => 'post', :class => 'user_navmore_li',:remote => true %>
|
||
<% else %>
|
||
<%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :course_id => course.id),:remote => true,:method => 'delete', :class => 'user_navmore_li' %>
|
||
<% end %>
|
||
</li>
|
||
<li>
|
||
<% if wechat_count == 0 %>
|
||
<%= link_to "屏蔽微信消息", shield_wechat_messages_path(:user_id => user.id, :course_id => course.id), :method => 'post',:remote => true, :class => 'user_navmore_li' %>
|
||
<% else %>
|
||
<%= link_to "接收微信消息", show_messages_shield_wechat_messages_path(:user_id => user.id, :course_id => course.id),:remote => true,:method => 'delete', :class => 'user_navmore_li' %>
|
||
<% end %>
|
||
</li>
|
||
<% end %>
|
||
<% if User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
|
||
<li>
|
||
<%= link_to course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => course,:user_page => true},
|
||
:id => "set_course_public_#{course.id.to_s}",:remote=>true, :class => 'user_navmore_li',:confirm=>"您确定要设置为"+(course.is_public == 0 ? "公开" : "私有")+"吗"%>
|
||
<div class="cl"></div>
|
||
</li>
|
||
<% end %>
|
||
</ul>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</li>
|
||
<% end %>
|
||
|
||
<% if all_count > (page.to_i+1) * 10%>
|
||
<a class="user_navmorebox" href="javascript:void(0);" id="user_show_more_course" onclick="show_more_course('<%= user_courses4show_user_path(user.id,:page => page)%>');">
|
||
<span class="user_icons_moreclass"></span>
|
||
</a>
|
||
<% end%>
|
||
|
||
<script type="text/javascript">
|
||
var coursecount = <%= all_count %>;
|
||
var courseshowcount = document.getElementsByClassName("course_list_menu").length;
|
||
|
||
if((coursecount <= courseshowcount)&&(coursecount > 10) ){
|
||
$("#user_show_more_course").hide();
|
||
$('#user_hide_course').show();
|
||
}
|
||
|
||
$(".course_list_menu").each(function(){
|
||
$(this).mouseenter(function(){
|
||
$(".sub-menu-title").hide();
|
||
$(this).next().stop();
|
||
$(this).next().show();
|
||
});
|
||
$(this).mouseleave(function(){
|
||
$(this).next().delay(500).hide(0);
|
||
});
|
||
})
|
||
|
||
$(".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>
|