管理员界面添加“分享作业申请”列表

This commit is contained in:
cxt 2016-05-09 18:40:21 +08:00
parent 1eb41478b2
commit f6d7df7393
6 changed files with 104 additions and 0 deletions

View File

@ -593,4 +593,14 @@ class AdminController < ApplicationController
end end
end end
#分享作业申请
def apply_for_homework
homeworks = ApplyHomework.where("user_id != 0")
@homework = paginateHelper homeworks,30
@page = (params['page'] || 1).to_i - 1
respond_to do |format|
format.html
end
end
end end

View File

@ -0,0 +1,89 @@
<h3>
<%=l(:label_apply_homework)%>
</h3>
<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: 120px;">
课程名称
</th>
<th style="width: 50px;">
作者
</th>
<th style="width: 50px;">
申请者
</th>
<th style="width: 50px;">
申请状态
</th>
<th style="width: 70px;">
申请日期
</th>
</tr>
</thead>
<tbody>
<%@count=@page*30 %>
<% for homework in @homework do %>
<% unless homework.nil? %>
<% @count+=1 %>
<tr>
<td align="center">
<%=@count %>
</td>
<% c_h = HomeworkCommon.find homework.homework_common_id %>
<% if c_h %>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=c_h.name%>'>
<%=link_to(c_h.try(:name), student_work_index_path(:homework => c_h.id))%>
</td>
<% if c_h.course %>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=c_h.course.name%>'>
<%= link_to(c_h.course.name, course_path(c_h.course.id)) %>
</td>
<% end %>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if c_h.try(:user).try(:realname) == ' '%><%= c_h.try(:user)%><% else %><%=c_h.try(:user).try(:realname) %><% end %>'>
<% if c_h.try(:user).try(:realname) == ' '%>
<%= link_to(c_h.try(:user), user_path(c_h.user_id)) %>
<% else %>
<%= link_to(c_h.try(:user).try(:realname), user_path(c_h.user_id)) %>
<% end %>
</td>
<% end %>
<td align="center" style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<% if homework.try(:user).try(:realname) == ' '%><%= homework.try(:user)%><% else %><%=homework.try(:user).try(:realname) %><% end %>'>
<% if homework.try(:user).try(:realname) == ' '%>
<%= link_to(homework.try(:user), user_path(homework.user_id)) %>
<% else %>
<%= link_to(homework.try(:user).try(:realname), user_path(homework.user_id)) %>
<% end %>
</td>
<td align="center">
<% if homework.status == 1 %>
待审核
<% elsif homework.status == 2 %>
已通过
<% else %>
已拒绝
<% end %>
</td>
<td align="center">
<%=format_date( homework.created_at ) %>
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
</div>
<div class="pagination">
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
</div>
<% html_title(l(:label_apply_homework)) -%>

View File

@ -419,6 +419,7 @@ zh:
label_project_all: 所有的项目 label_project_all: 所有的项目
label_project_latest: 最近的项目 label_project_latest: 最近的项目
label_issue: 问题 label_issue: 问题
label_apply_homework: 分享作业申请
label_issue_view_all: 查看所有问题 label_issue_view_all: 查看所有问题
label_issues_by: "按 %{value} 分组显示问题" label_issues_by: "按 %{value} 分组显示问题"

View File

@ -985,6 +985,7 @@ RedmineApp::Application.routes.draw do
match 'admin/latest_login_users', as: :latest_login_users match 'admin/latest_login_users', as: :latest_login_users
match 'admin/latest_login_teachers', as: :latest_login_teachers match 'admin/latest_login_teachers', as: :latest_login_teachers
get 'admin/homework' get 'admin/homework'
get 'admin/apply_for_homework'
resources :auth_sources do resources :auth_sources do
member do member do

View File

@ -395,6 +395,7 @@ Redmine::MenuManager.map :admin_menu do |menu|
menu.push :course_resource_list, {: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 :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 menu.push :homework, {:controller => 'admin', :action => 'homework'}, :caption => :label_user_homework
menu.push :apply_for_homework, {:controller => 'admin', :action => 'apply_for_homework'}, :caption => :label_apply_homework
end end
#Modified by young #Modified by young

View File

@ -193,6 +193,8 @@ module Redmine
title = h(caption) + "(#{Course.all.count})" title = h(caption) + "(#{Course.all.count})"
when '用户列表' when '用户列表'
title = h(caption) + "(#{User.all.count})" title = h(caption) + "(#{User.all.count})"
when '分享作业申请'
title = h(caption) + "(#{ApplyHomework.where("user_id != 0").count})"
end end
link_to(title, url, item.html_options(:selected => selected)) link_to(title, url, item.html_options(:selected => selected))