From 07d95bdda9345c617224c7e268448555a784a638 Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Wed, 1 Jul 2015 17:34:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E5=88=97=E8=A1=A8=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 6 ++- app/views/admin/courses.html.erb | 77 ++++++++++++++++++++++++++++- config/locales/commons/zh.yml | 2 +- 3 files changed, 82 insertions(+), 3 deletions(-) diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index a01bba913..086ecfb7f 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -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 diff --git a/app/views/admin/courses.html.erb b/app/views/admin/courses.html.erb index d1d06ad36..1615bccbc 100644 --- a/app/views/admin/courses.html.erb +++ b/app/views/admin/courses.html.erb @@ -1 +1,76 @@ -1111 \ No newline at end of file +
+ <%= link_to l(:label_course_new), {:controller => 'courses', :action => 'new'}, :class => 'icon icon-add' %> +
+ +

+ <%=l(:label_course_all)%> +

+ +<%= form_tag({}, :method => :get) do %> +
+ + <%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '课程名称' %> + <%= submit_tag l(:button_apply), :class => "small", :name => nil %> + + <%= l(:button_clear)%> + +
+<% end %> +  + +
+ + + + + + + + + + + + + <% @courses.each do |course| %> + "> + + + + + + + + <% end %> + +
+ 序号 + + 课程 + + 主讲老师 + + 学时 + + <%=l(:field_is_public)%> + + <%=l(:field_created_on)%> +
+ <%= course.id %> + + + <%= link_to(course.name, course_path(course.id)) %> + + + <%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %> + + <%= course.class_period %> + + <%= checked_image course.is_public? %> + + <%= format_date(course.created_at) %> +
+
+ +<% html_title(l(:label_course_all)) -%> diff --git a/config/locales/commons/zh.yml b/config/locales/commons/zh.yml index f83d3810c..5dee0b505 100644 --- a/config/locales/commons/zh.yml +++ b/config/locales/commons/zh.yml @@ -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: 文件