socialforge/app/views/layouts/_user_courses.html.erb

100 lines
6.2 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<% courses.each do |course|%>
<li>
<span class="user_icons_class"></span>
<% 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),
: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>
<% 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%>
<input type="hidden" value="<%= page%>" id="course_page_num">
<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();
}
</script>