socialforge/app/views/users/_courses_list.html.erb

43 lines
3.1 KiB
Plaintext
Raw Normal View History

<% unless courses.nil? %>
<% courses.each_with_index do |course, i| %>
2016-08-24 15:58:23 +08:00
<li class="syllabus_class_list <%= i > 2 ? 'none' : '' %>">
<% allow_visit = User.current.member_of_course?(course) || User.current.admin? || course.is_public == 1 %>
2016-08-24 15:58:23 +08:00
<span class="icons_sy_favorite " title="点击将其从个人主页的班级列表中移除"></span>
<span class="icons_sy_star " title="点击将其添加至个人主页的班级列表中"></span>
<div class="fl">
<div class="syllabus_class_w ">
<a href="<%= allow_visit ? course_path(course.id) : "javascript:void(0)" %>" class="syllabus_class_title fl" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问" %>"><%= course.name %></a>
<span class="<%= course.is_public == 0 ? 'syllabus_class_private' : 'syllabus_class_open' %> fl ml10 mt3 syllabus_class_property"><%= course.is_public == 0 ? '私有' : '公开' %></span>
<span class="fr sy_p_grey hidden" style="max-width: 120px;">主讲老师:<%= link_to course.teacher.show_name, user_path(course.teacher) %></span>
<div class="cl"></div>
</div>
2016-08-24 15:58:23 +08:00
<div class="">
<p class="fl grayTxt ">更新:<%= format_date Time.at(course.updatetime) %><span class="mr10"></span>
学期:<%= current_time_and_term(course) %></p>
<p class="list-info fr grayTxt">
<% student_link = (User.current.logged? && course.open_student == 1 && course.is_public == 1) || (User.current.member_of_course?(course)) || User.current.admin? %>
<span><a href="<%= student_link ? course_member_path(course, :role => 2) : "javascript:void(0)" %>" target="_blank" title="<%= student_link ? "" : "学生列表不对外公开" %>"><%= studentCount course %></a></span><span>学生</span>
<span>|</span>
<span><a href="<%= allow_visit ? homework_common_index_path(:course => course.id) : "javascript:void(0)" %>" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问" %>"><%= visable_course_homework course %></a></span><span>作业</span>
<span>|</span>
<span><a href="<%= allow_visit ? course_files_path(course) : "javascript:void(0)" %>" target="_blank" title="<%= allow_visit ? "" : "私有班级不可访问" %>"><%= visable_attachemnts_incourse(course).count %></a></span><span>资源</span>
</p>
<div class="cl"></div>
</div>
</div>
<span class="icons_sy_arrow fl mt19 ml10"></span>
<div class="cl"></div>
</li>
<% end %>
<% if courses.count > 3 %>
2016-08-24 15:58:23 +08:00
<li class="syllabus_class_list_more" id="syllabus_class_list_more_<%= syllabus.id %>">
<a href="javascript:void(0);" id="expand_list_<%= syllabus.id %>" data-init="0" onclick="expand_course_list(<%=syllabus.id %>,'#syllabus_course_ul_<%=syllabus.id %> li','#expand_list_<%=syllabus.id %>',<%=courses.count %>)">共<%= courses.count %>
个班级,点击全部展开</a>
</li>
<% end %>
<% end %>