95 lines
5.9 KiB
Plaintext
95 lines
5.9 KiB
Plaintext
<% courses.each do |course|%>
|
||
<li class="homepageLeftMenuCoursesLine pr">
|
||
<% is_teacher = User.current.logged? && (User.current.admin? || User.current.allowed_to?(:as_teacher,course)) %>
|
||
<%= 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' : ''}",
|
||
:id => "show_course_#{course.id}", :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 %>
|
||
|
||
<ul class="<%= count > 0 ? 'shild shildP':'subNavArrow'%>">
|
||
<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>
|
||
<% if User.current == @user %>
|
||
<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>
|
||
<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>
|
||
<% 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">
|
||
<a href="javascript:void(0);" class="homepageLeftMenuMoreIcon" onclick="show_more_course('<%= user_courses4show_user_path(user.id)%>');"></a>
|
||
</li>
|
||
<% end%>
|
||
|
||
<script type="text/javascript">
|
||
var coursecount = <%= @user.courses.visible.where("is_delete =?", 0).count %>;
|
||
var courseshowcount = document.getElementsByClassName("coursesLineGrey").length;
|
||
|
||
if((coursecount <= courseshowcount)&&(coursecount > 5) ){
|
||
$("#user_show_more_course").hide();
|
||
$('#user_hide_course').show();
|
||
}
|
||
</script>
|