课程列表内容

This commit is contained in:
sw 2015-07-01 17:34:17 +08:00
parent 749b9c4429
commit 07d95bdda9
3 changed files with 82 additions and 3 deletions

View File

@ -42,7 +42,11 @@ class AdminController < ApplicationController
end
def courses
@name = params[:name]
@courses = Course.like(@name)
respond_to do |format|
format.html
end
end
def users

View File

@ -1 +1,76 @@
1111
<div class="contextual">
<%= link_to l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add' %>
</div>
<h3>
<%=l(:label_course_all)%>
</h3>
<%= form_tag({}, :method => :get) do %>
<fieldset>
<label for='name'>
课程:
</label>
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '课程名称' %>
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
<a class="icon icon-reload" onclick="$('#name').val('')" style="cursor: pointer;text-decoration: none;">
<%= l(:button_clear)%>
</a>
</fieldset>
<% end %>
&nbsp;
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
序号
</th>
<th style="width: 120px;">
课程
</th>
<th style="width: 50px;">
主讲老师
</th>
<th style="width: 30px;">
学时
</th>
<th style="width: 20px;">
<%=l(:field_is_public)%>
</th>
<th style="width: 70px;">
<%=l(:field_created_on)%>
</th>
</tr>
</thead>
<tbody>
<% @courses.each do |course| %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: center;">
<%= course.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>'>
<span>
<%= link_to(course.name, course_path(course.id)) %>
</span>
</td>
<td align="center">
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
</td>
<td align="center">
<%= course.class_period %>
</td>
<td class="center">
<%= checked_image course.is_public? %>
</td>
<td class="center">
<%= format_date(course.created_at) %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<% html_title(l(:label_course_all)) -%>

View File

@ -263,7 +263,7 @@ zh:
label_tags_numbers: "Tag统计"
label_issue_plural: 问题跟踪
label_project_plural: 项目列表
# label_project_plural: 项目列表
label_user_plural: 用户列表
label_tags_call: 需求
field_filename: 文件