完善课程资源列表,完成项目资源列表

This commit is contained in:
linchun 2016-03-08 11:01:08 +08:00
parent b7f4b584f2
commit 3c66a29767
7 changed files with 91 additions and 16 deletions

View File

@ -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)

View File

@ -6,25 +6,25 @@
<thead>
<tr>
<th style="width: 120px;">
<th style="width: 60px;">
资源名称
</th>
<th style="width: 50px;">
<th style="width: 30px;">
资源大小
</th>
<th style="width: 30px;">
<th style="width: 25px;">
资源类型
</th>
<th style="width: 20px;">
<th style="width: 23px;">
上传时间
</th>
<th style="width: 20px;">
<th style="width: 15px;">
下载次数
</th>
<th style="width: 20px;">
上传者
</th>
<th style="width: 20px;">
<th style="width: 35px;">
所属课程
</th>
</tr>
@ -33,10 +33,10 @@
<% @resource.each do |resource| %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: left;">
<a href="<%= download_named_attachment_path(resource.id,resource.filename)%>" class="fontGrey3 mr10 fl"><%= resource.filename %>
<%= link_to truncate(resource.filename, :length => 18), download_named_attachment_path(resource.id, resource.filename ), :title => resource.filename,:class=>'resourcesBlack'%>
</td>
<td style=" text-align: center;">
<%= number_to_human_size(resource.filesize)%>
<%= number_to_human_size(resource.filesize)%>
</td>
<td style=" text-align: center;">
课程资源
@ -51,13 +51,10 @@
<%= link_to(User.find(resource.author_id).realname, user_path(User.find(resource.author_id)) ) %>
</td>
<td style=" text-align: center;">
<%=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" %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>

View File

@ -0,0 +1,64 @@
<h3><%=l(:label_project_resource_list)%></h3>
<div class="autoscroll">
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 60px;">
资源名称
</th>
<th style="width: 30px;">
资源大小
</th>
<th style="width: 25px;">
资源类型
</th>
<th style="width: 23px;">
上传时间
</th>
<th style="width: 15px;">
下载次数
</th>
<th style="width: 20px;">
上传者
</th>
<th style="width: 35px;">
所属项目
</th>
</tr>
</thead>
<tbody>
<% @pro_resource.each do |pro_resource| %>
<tr class="<%= cycle("odd", "even") %>">
<td style="text-align: left;">
<%= link_to truncate(pro_resource.filename, :length => 18), download_named_attachment_path(pro_resource.id, pro_resource.filename ), :title => pro_resource.filename,:class=>'resourcesBlack'%>
</td>
<td style=" text-align: center;">
<%= number_to_human_size(pro_resource.filesize)%>
</td>
<td style=" text-align: center;">
项目资源
</td>
<td style=" text-align: center;">
<%= format_date(pro_resource.created_on)%>
</td>
<td style=" text-align: center;">
<%= pro_resource.downloads %>
</td>
<td style=" text-align: center;">
<%= link_to(User.find(pro_resource.author_id).realname, user_path(User.find(pro_resource.author_id)) ) %>
</td>
<td style=" text-align: center;">
<%=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" %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>

View File

@ -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

View File

@ -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: 作业

View File

@ -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

View File

@ -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