未配置班级列表报500,全部班级列表添加状态列表明班级是否已删除

cxt_course
cxt 9 years ago
parent 8e8d6a8439
commit 834e72b0f8

@ -112,10 +112,10 @@ class AdminController < ApplicationController
def non_syllabus_courses def non_syllabus_courses
@name = params[:name].to_s.strip.downcase @name = params[:name].to_s.strip.downcase
if @name && @name != "" if @name && @name != ""
@courses = Course.where("syllabus_id is null").select{ |course| (course.teacher[:lastname].to_s.downcase + course.teacher[:firstname].to_s.downcase).include?(@name) || course.name.include?(@name)} @courses = Course.where("syllabus_id is null and is_delete = 0").select{ |course| (course.teacher[:lastname].to_s.downcase + course.teacher[:firstname].to_s.downcase).include?(@name) || course.name.include?(@name)}
@courses = @courses.sort{|x, y| y.created_at <=> x.created_at} @courses = @courses.sort{|x, y| y.created_at <=> x.created_at}
else else
@courses = Course.where("syllabus_id is null").order('created_at desc') @courses = Course.where("syllabus_id is null and is_delete = 0").order('created_at desc')
end end
@courses = paginateHelper @courses,30 @courses = paginateHelper @courses,30
@page = (params['page'] || 1).to_i - 1 @page = (params['page'] || 1).to_i - 1

@ -7,7 +7,7 @@
</span> </span>
</td> </td>
<td align="center"> <td align="center">
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> <%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %>
</td> </td>
<td align="center"> <td align="center">
<%= course.class_period %> <%= course.class_period %>
@ -16,6 +16,8 @@
<%= checked_image course.is_public? %> <%= checked_image course.is_public? %>
</td> </td>
<td class="center"> <td class="center">
<%= course.is_delete == 0 ? '正常' : '归档' %>
</td><td class="center">
<%= format_date(course.created_at) %> <%= format_date(course.created_at) %>
</td> </td>
<td class="center"> <td class="center">

@ -27,10 +27,10 @@
<table class="list" style="width: 100%;table-layout: fixed"> <table class="list" style="width: 100%;table-layout: fixed">
<thead> <thead>
<tr> <tr>
<th style="width: 30px;"> <th style="width: 20px;">
序号 序号
</th> </th>
<th style="width: 85px;"> <th style="width: 70px;">
班级 班级
</th> </th>
<th style="width: 35px;"> <th style="width: 35px;">
@ -42,6 +42,9 @@
<th style="width: 15px;"> <th style="width: 15px;">
<%=l(:field_is_public)%> <%=l(:field_is_public)%>
</th> </th>
<th style="width: 20px;">
状态
</th>
<th style="width: 45px;"> <th style="width: 45px;">
<%=l(:field_created_on)%> <%=l(:field_created_on)%>
</th> </th>
@ -58,10 +61,12 @@
</thead> </thead>
<tbody> <tbody>
<% @courses.each do |course| %> <% @courses.each do |course| %>
<% unless course.teacher.nil? %>
<tr class="<%= cycle("odd", "even") %>" id="course_<%=course.id %>"> <tr class="<%= cycle("odd", "even") %>" id="course_<%=course.id %>">
<%=render :partial => 'courselist_detail_tr', :locals => {:course => course} %> <%=render :partial => 'courselist_detail_tr', :locals => {:course => course} %>
</tr> </tr>
<% end %> <% end %>
<% end %>
</tbody> </tbody>
</table> </table>
</div> </div>

@ -58,6 +58,7 @@
</thead> </thead>
<tbody> <tbody>
<% @courses.each do |course| %> <% @courses.each do |course| %>
<% unless course.teacher.nil? %>
<tr class="<%= cycle("odd", "even") %>" id="course_<%=course.id %>"> <tr class="<%= cycle("odd", "even") %>" id="course_<%=course.id %>">
<td style="text-align: center;"> <td style="text-align: center;">
<%= course.id %> <%= course.id %>
@ -68,7 +69,7 @@
</span> </span>
</td> </td>
<td align="center"> <td align="center">
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> <%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %>
</td> </td>
<td align="center"> <td align="center">
<%= course.class_period %> <%= course.class_period %>
@ -90,6 +91,7 @@
</td> </td>
</tr> </tr>
<% end %> <% end %>
<% end %>
</tbody> </tbody>
</table> </table>
</div> </div>

Loading…
Cancel
Save