From 3c66a297673f1f6ee3102a5c0049c984783307e0 Mon Sep 17 00:00:00 2001 From: linchun Date: Tue, 8 Mar 2016 11:01:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=AF=BE=E7=A8=8B=E8=B5=84?= =?UTF-8?q?=E6=BA=90=E5=88=97=E8=A1=A8=EF=BC=8C=E5=AE=8C=E6=88=90=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E8=B5=84=E6=BA=90=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/admin_controller.rb | 14 +++- app/views/admin/course_resource_list.html.erb | 21 +++--- .../admin/project_resource_list.html.erb | 64 +++++++++++++++++++ config/locales/en.yml | 1 + config/locales/zh.yml | 1 + config/routes.rb | 1 + lib/redmine.rb | 3 +- 7 files changed, 90 insertions(+), 15 deletions(-) create mode 100644 app/views/admin/project_resource_list.html.erb diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 4259aa333..7ff36c11d 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -59,17 +59,27 @@ class AdminController < ApplicationController #管理员界面课程资源列表 def course_resource_list - @resource = Attachment.find_all_by_container_id(12) - + @resource = Attachment.where(:container_type => 'Course') @resource = paginateHelper @resource,30 @page = (params['page'] || 1).to_i - 1 respond_to do |format| format.html end + end + + #管理员界面項目资源列表 + def project_resource_list + @pro_resource = Attachment.where(:container_type => 'Project') + @pro_resource = paginateHelper @pro_resource,30 + @page = (params['page'] || 1).to_i - 1 + respond_to do |format| + format.html + end end + def users sort_init 'login', 'asc' sort_update %w(login firstname lastname mail admin created_on last_login_on) diff --git a/app/views/admin/course_resource_list.html.erb b/app/views/admin/course_resource_list.html.erb index 7a2ac1af1..4316555f7 100644 --- a/app/views/admin/course_resource_list.html.erb +++ b/app/views/admin/course_resource_list.html.erb @@ -6,25 +6,25 @@ - + 资源名称 - + 资源大小 - + 资源类型 - + 上传时间 - + 下载次数 上传者 - + 所属课程 @@ -33,10 +33,10 @@ <% @resource.each do |resource| %> "> - <%= resource.filename %> + <%= link_to truncate(resource.filename, :length => 18), download_named_attachment_path(resource.id, resource.filename ), :title => resource.filename,:class=>'resourcesBlack'%> - <%= number_to_human_size(resource.filesize)%> + <%= number_to_human_size(resource.filesize)%> 课程资源 @@ -51,13 +51,10 @@ <%= link_to(User.find(resource.author_id).realname, user_path(User.find(resource.author_id)) ) %> - <%=link_to Course.find(resource.container_id).name, course_path(Course.find(resource.container_id)), :class => "hidden fl w170" %> + <%=link_to truncate(Course.find(resource.container_id).name, :length => 10), course_path(Course.find(resource.container_id)), :title => Course.find(resource.container_id).name, :class => "hidden fl w170" %> <% end %> - - - diff --git a/app/views/admin/project_resource_list.html.erb b/app/views/admin/project_resource_list.html.erb new file mode 100644 index 000000000..c245f73b8 --- /dev/null +++ b/app/views/admin/project_resource_list.html.erb @@ -0,0 +1,64 @@ +

<%=l(:label_project_resource_list)%>

+ + +
+ + + + + + + + + + + + + + + <% @pro_resource.each do |pro_resource| %> + "> + + + + + + + + + <% end %> + +
+ 资源名称 + + 资源大小 + + 资源类型 + + 上传时间 + + 下载次数 + + 上传者 + + 所属项目 +
+ <%= link_to truncate(pro_resource.filename, :length => 18), download_named_attachment_path(pro_resource.id, pro_resource.filename ), :title => pro_resource.filename,:class=>'resourcesBlack'%> + + <%= number_to_human_size(pro_resource.filesize)%> + + 项目资源 + + <%= format_date(pro_resource.created_on)%> + + <%= pro_resource.downloads %> + + <%= link_to(User.find(pro_resource.author_id).realname, user_path(User.find(pro_resource.author_id)) ) %> + + <%=link_to truncate(Project.find(pro_resource.container_id).name, :length => 10), project_path(Project.find(pro_resource.container_id)), :title => Project.find(pro_resource.container_id).name, :class => "hidden fl w170" %> +
+
+ + \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index 86a285342..3da533eb7 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -1522,6 +1522,7 @@ en: label_enterprise_page_made: enterprise_page label_excellent_courses_list: excellent_courses label_course_resource_list: course_resource_list + label_project_resource_list: project_resource_list #api label_recently_updated_notification: Recently updated notification diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 8884b0e67..b6bd6afa4 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -485,6 +485,7 @@ zh: label_course_all: 课程列表 label_excellent_courses_list: 精品课程列表 label_course_resource_list: 课程资源列表 + label_project_resource_list: 項目资源列表 label_teacher_all: 所有教师 label_requirement_enterprise_list: 众包列表 label_new_homework: 作业 diff --git a/config/routes.rb b/config/routes.rb index e92590895..de1d9d652 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -935,6 +935,7 @@ RedmineApp::Application.routes.draw do get 'admin/courses' get 'admin/excellent_courses' get 'admin/course_resource_list' + get 'admin/project_resource_list' match 'admin/users', :via => :get match 'admin/messages', :via => :get match 'admin/first_page_made', as: :first_page_made diff --git a/lib/redmine.rb b/lib/redmine.rb index 21309b710..47ee3d38f 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -392,7 +392,8 @@ Redmine::MenuManager.map :admin_menu do |menu| menu.push :notices, {:controller => 'admin', :action => 'notices'}, :caption => :label_notification_list menu.push :latest_login_users, {:controller => 'admin', :action => 'latest_login_users'}, :caption => :label_latest_login_user_list menu.push :excellent_courses, {:controller => 'admin', :action => 'excellent_courses'}, :caption => :label_excellent_courses_list - menu.push :var, {:controller => 'admin', :action => 'course_resource_list'}, :caption => :label_course_resource_list + menu.push :course_resource_list, {:controller => 'admin', :action => 'course_resource_list'}, :caption => :label_course_resource_list + menu.push :project_resource_list, {:controller => 'admin', :action => 'project_resource_list'}, :caption => :label_project_resource_list menu.push :homework, {:controller => 'admin', :action => 'homework'}, :caption => :label_user_homework end