diff --git a/app/controllers/admin_controller.rb b/app/controllers/admin_controller.rb index 99732fc6b..11dfbf5f4 100644 --- a/app/controllers/admin_controller.rb +++ b/app/controllers/admin_controller.rb @@ -593,4 +593,14 @@ class AdminController < ApplicationController 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 diff --git a/app/views/admin/apply_for_homework.html.erb b/app/views/admin/apply_for_homework.html.erb new file mode 100644 index 000000000..1c7a04901 --- /dev/null +++ b/app/views/admin/apply_for_homework.html.erb @@ -0,0 +1,89 @@ +

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

+ +
+ + + + + + + + + + + + + + <%@count=@page*30 %> + <% for homework in @homework do %> + <% unless homework.nil? %> + <% @count+=1 %> + + + <% c_h = HomeworkCommon.find homework.homework_common_id %> + <% if c_h %> + + <% if c_h.course %> + + <% end %> + + <% end %> + + + + + <% end %> + <% end %> + +
+ 序号 + + 作业名称 + + 课程名称 + + 作者 + + 申请者 + + 申请状态 + + 申请日期 +
+ <%=@count %> + + <%=link_to(c_h.try(:name), student_work_index_path(:homework => c_h.id))%> + + <%= link_to(c_h.course.name, course_path(c_h.course.id)) %> + <%= 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 %> + <%= 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 %> + + <% if homework.status == 1 %> + 待审核 + <% elsif homework.status == 2 %> + 已通过 + <% else %> + 已拒绝 + <% end %> + + <%=format_date( homework.created_at ) %> +
+
+ + + +<% html_title(l(:label_apply_homework)) -%> diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 088ce3d8e..55124cf58 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -419,6 +419,7 @@ zh: label_project_all: 所有的项目 label_project_latest: 最近的项目 label_issue: 问题 + label_apply_homework: 分享作业申请 label_issue_view_all: 查看所有问题 label_issues_by: "按 %{value} 分组显示问题" diff --git a/config/routes.rb b/config/routes.rb index afefc9e3c..6b06feebc 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -985,6 +985,7 @@ RedmineApp::Application.routes.draw do match 'admin/latest_login_users', as: :latest_login_users match 'admin/latest_login_teachers', as: :latest_login_teachers get 'admin/homework' + get 'admin/apply_for_homework' resources :auth_sources do member do diff --git a/lib/redmine.rb b/lib/redmine.rb index 47ee3d38f..7fec36426 100644 --- a/lib/redmine.rb +++ b/lib/redmine.rb @@ -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 :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 :apply_for_homework, {:controller => 'admin', :action => 'apply_for_homework'}, :caption => :label_apply_homework end #Modified by young diff --git a/lib/redmine/menu_manager.rb b/lib/redmine/menu_manager.rb index f9ce21987..6d1bb2fcb 100644 --- a/lib/redmine/menu_manager.rb +++ b/lib/redmine/menu_manager.rb @@ -193,6 +193,8 @@ module Redmine title = h(caption) + "(#{Course.all.count})" when '用户列表' title = h(caption) + "(#{User.all.count})" + when '分享作业申请' + title = h(caption) + "(#{ApplyHomework.where("user_id != 0").count})" end link_to(title, url, item.html_options(:selected => selected))