2016-01-14 15:59:50 +08:00
<% courses.each do |course|%>
<li class="homepageLeftMenuCoursesLine pr">
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
2016-03-17 16:17:33 +08:00
<%= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course), :class => "coursesLineGrey hidden #{course_endTime_timeout?(course) ? 'c_dark_grey' : ''}",
2016-03-11 11:34:16 +08:00
:id => "show_course_#{course.id}", :target => '_blank', :title => (course.is_public? ? "公开课程:":"私有课程:")+course.name+"( "+current_time_and_term(course)+") "%>
2016-04-27 10:28:36 +08:00
<% 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 %>
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
2016-01-14 15:59:50 +08:00
<li>
<ul class="subNavMenu boxShadow">
<% if is_teacher %>
<li class="subNavRow">
<%= link_to "作业",homework_common_index_path(:course => course.id), :class => 'fl fontGrey2 w48', :target => '_blank' %>
<%= link_to '+',homework_common_index_path(:course => course.id,:is_new => 1), :class => 'fr fb', :title => '发布作业',:target => '_blank' %>
<div class="cl"></div>
</li>
<li class="subNavRow">
<%= link_to "通知", course_news_index_path(course), :class => 'fl w48',:target => '_blank' %>
<%= link_to "+", new_course_news_path(course,:is_new=>1), :class => 'fr fb', :title => '发布通知',:target => '_blank' %>
<div class="cl"></div>
</li>
<% else %>
<li class="subNavRow">
<%= link_to "作业",homework_common_index_path(:course => course.id), :target => '_blank' %>
<div class="cl"></div>
</li>
<li class="subNavRow">
<%= link_to "通知", course_news_index_path(course),:target => '_blank' %>
<div class="cl"></div>
</li>
<% end %>
<% if is_teacher || (course.publish_resource == 1 && User.current.member_of_course?(course)) %>
<li class="subNavRow">
<%= link_to "资源",course_files_path(course), :class => 'fl w48',:target => '_blank' %>
<%= link_to "+",upload_files_menu_path(:course_id => course.id), :class => 'fr fb',:remote => true, :title => '上传资源' %>
<div class="cl"></div>
</li>
<% else %>
<li class="subNavRow">
<%= link_to "资源",course_files_path(course),:target => '_blank' %>
<div class="cl"></div>
</li>
<% end %>
<li class="subNavRow">
<%= link_to "论坛",course_boards_path(course), :class => 'fl w48',:target => '_blank' %>
<%= link_to "+",course_boards_path(course, :flag => true, :is_new => 1), :class => 'fr fb', :title => '发布帖子',:target => '_blank' %>
<div class="cl"></div>
</li>
2016-06-28 15:13:04 +08:00
<% if User.current == user %>
2016-01-14 15:59:50 +08:00
<li class="subNavRow">
<% if count == 0 %>
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :course_id => course.id), :method => 'post',:remote => true %>
<% else %>
<%= link_to "显示动态", show_acts_shield_activities_path(:user_id => user.id, :course_id => course.id),:remote => true,:method => 'delete' %>
<% end %>
</li>
2016-04-27 10:28:36 +08:00
<li class="subNavRow">
<% if wechat_count == 0 %>
<%= link_to "屏蔽微信消息", shield_wechat_messages_path(:user_id => user.id, :course_id => course.id), :method => 'post',:remote => true %>
<% else %>
<%= link_to "接收微信消息", show_messages_shield_wechat_messages_path(:user_id => user.id, :course_id => course.id),:remote => true,:method => 'delete' %>
<% end %>
</li>
2016-01-14 15:59:50 +08:00
<% end %>
<% if User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
<li class="subNavRow">
<%= 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,:confirm=>"您确定要设置为"+(course.is_public == 0 ? "公开" : "私有")+"吗"%>
<div class="cl"></div>
</li>
<% end %>
</ul>
</li>
</ul>
</li>
<% end %>
<% if courses.size == 5%>
<li class="homepageLeftMenuMore" id="user_show_more_course">
<input type="hidden" value="<%= page%>" id="course_page_num">
2016-04-13 15:14:35 +08:00
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_course('<%= user_courses4show_user_path(user.id)%>');"></a>
2016-01-14 15:59:50 +08:00
</li>
2016-04-27 09:54:49 +08:00
<% end%>
<script type="text/javascript">
2016-06-28 15:13:04 +08:00
var coursecount = <%= user.courses.visible.where("is_delete =?", 0).count %>;
2016-04-27 14:12:56 +08:00
var courseshowcount = document.getElementsByClassName("coursesLineGrey").length;
2016-04-27 09:54:49 +08:00
2016-05-04 16:28:40 +08:00
if((coursecount <= courseshowcount)&&(coursecount > 5) ){
2016-04-27 14:12:56 +08:00
$("#user_show_more_course").hide();
$('#user_hide_course').show();
2016-04-27 09:54:49 +08:00
}
</script>