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

108 lines
6.9 KiB
Plaintext
Raw Normal View History

<% courses.each do |course|%>
2016-08-04 11:05:34 +08:00
<li>
<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 hidden" title="<%= course.syllabus.title+' · '+(course.is_public? ? '公开班级:' : '私有班级:')+course.name+''+current_time_and_term(course)+'' %>">
<%= link_to course.syllabus.title, syllabus_path(course.syllabus_id), :target => '_blank'%>
&nbsp;<font class="fb c_grey">·</font>&nbsp;
<%= link_to course.name, course_path(course.id,:host=>Setting.host_course), :target => '_blank'%>
</p>
<%#= link_to course.name+"("+current_time_and_term_short(course)+")", course_path(course.id,:host=>Setting.host_course),
2016-08-04 11:05:34 +08:00
: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 %>
2016-08-04 16:33:51 +08:00
<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 %>
2016-08-04 16:33:51 +08:00
<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>
2016-08-04 16:33:51 +08:00
<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 %>
2016-08-04 16:33:51 +08:00
<li>
<%= link_to "作业",homework_common_index_path(:course => course.id), :class => 'user_navmore_li', :target => '_blank' %>
<div class="cl"></div>
</li>
2016-08-04 16:33:51 +08:00
<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)) %>
2016-08-04 16:33:51 +08:00
<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 %>
2016-08-04 16:33:51 +08:00
<li>
<%= link_to "资源",course_files_path(course), :class => 'user_navmore_li',:target => '_blank' %>
<div class="cl"></div>
</li>
<% end %>
2016-08-04 16:33:51 +08:00
<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>
2016-08-04 11:05:34 +08:00
<% if !course.syllabus.nil? %>
2016-08-04 16:33:51 +08:00
<li>
<%= link_to "所属课程",syllabus_path(course.syllabus_id), :class => 'user_navmore_li',:target => '_blank' %>
2016-07-01 11:11:53 +08:00
<div class="cl"></div>
</li>
<% end %>
<% if User.current == user %>
2016-08-24 15:58:23 +08:00
<li>
<%= link_to "取消收藏", cancel_or_collect_user_path(user, :course => course.id), :class => 'user_navmore_li',:target => '_blank', :remote => true %>
2016-08-24 15:58:23 +08:00
<div class="cl"></div>
</li>
2016-08-04 16:33:51 +08:00
<li>
<% if count == 0 %>
2016-08-04 16:33:51 +08:00
<%= link_to "屏蔽动态", shield_activities_path(:user_id => user.id, :course_id => course.id), :method => 'post', :class => 'user_navmore_li',:remote => true %>
<% else %>
2016-08-04 16:33:51 +08:00
<%= 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>
2016-08-04 16:33:51 +08:00
<li>
<% if wechat_count == 0 %>
2016-08-04 16:33:51 +08:00
<%= link_to "屏蔽微信消息", shield_wechat_messages_path(:user_id => user.id, :course_id => course.id), :method => 'post',:remote => true, :class => 'user_navmore_li' %>
<% else %>
2016-08-04 16:33:51 +08:00
<%= 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)) %>
2016-08-04 16:33:51 +08:00
<li>
<%= link_to course.is_public == 0 ? "设为公开" : "设为私有", {:controller => 'courses', :action => 'private_or_public', :id => course,:user_page => true},
2016-08-04 16:33:51 +08:00
: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>
2016-08-04 16:33:51 +08:00
</div>
</li>
<% end %>
2016-08-04 11:05:34 +08:00
<% if all_count > (page.to_i+1) * 10%>
2016-08-04 16:33:51 +08:00
<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>
2016-04-27 09:54:49 +08:00
<% end%>
<script type="text/javascript">
2016-06-29 10:45:56 +08:00
var coursecount = <%= all_count %>;
2016-08-04 11:05:34 +08:00
var courseshowcount = document.getElementsByClassName("course_list_menu").length;
2016-04-27 09:54:49 +08:00
2016-08-04 11:05:34 +08:00
if((coursecount <= courseshowcount)&&(coursecount > 10) ){
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>