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

55 lines
3.2 KiB
Plaintext

<% unless courses.nil? %>
<% courses.each_with_index do |course, i| %>
<li class="syllabus_class_list <%= i > 2 ? 'none' : '' %>">
<% allow_visit = course.is_delete == 0 && (User.current.member_of_course?(course) || User.current.admin? || course.is_public == 1) %>
<% if course.is_delete == 0 %>
<span id="collect_course_icon_<%=course.id %>">
<%=render :partial => 'collect_course', :locals => {:course => course} %>
</span>
<% end %>
<div class="fl">
<div class="syllabus_class_w" style="width: 580px;">
<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>
<div class="cl"></div>
</div>
<div class="">
<p class="fl grayTxt ">更新:<%= format_date Time.at(course.updatetime) %><span class="mr10"></span>
创建老师:<%= link_to course.teacher.show_name, user_path(course.teacher) %>
</p>
<div class="cl"></div>
</div>
</div>
<% if User.current == @user && (User.current == course.teacher || User.current.admin?) %>
<div class="pr">
<a href="javascript:void(0)" onclick="archive_course(<%=course.id %>, <%=course.is_delete %>, 0);" onmouseover="$('#archive_notice_<%=course.id %>').show();" onmouseout="$('#archive_notice_<%=course.id %>').hide();"
class="btn_grey_big fr mt5 mr15" style="width: 56px;"><%= course.is_delete == 0 ? '归档' : '恢复' %></a>
<div class="archive_course_notice fontGrey2 none" id="archive_notice_<%=course.id %>" style="width: 230px;">
<em></em>
<span></span>
<p class="mt5 mb5 break_word">
<% if course.is_delete == 0 %>
此班级的信息将不再显示<br/>
您和您的学生将不能在此班级中继续互动<br/>
但您可以点击上方的“归档管理”
<% else %>
此班级的信息将恢复显示<br/>
您和您的学生将可以重新在此班级中互动
<% end %>
</p>
</div>
</div>
<% end %>
<div class="cl"></div>
</li>
<% end %>
<% if courses.count > 3 %>
<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 %>