管理员界面增加竞赛列表
This commit is contained in:
parent
ff054b6bdb
commit
231fa56c49
|
@ -124,6 +124,16 @@ class AdminController < ApplicationController
|
||||||
render :action => "projects", :layout => false if request.xhr?
|
render :action => "projects", :layout => false if request.xhr?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def contests
|
||||||
|
@name = params[:name]
|
||||||
|
@contests = Contest.where("id >= 780 and name like '%#{@name}%'").order('created_at desc')
|
||||||
|
@contests = paginateHelper @contests,30
|
||||||
|
@page = (params['page'] || 1).to_i - 1
|
||||||
|
respond_to do |format|
|
||||||
|
format.html
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def syllabuses
|
def syllabuses
|
||||||
@name = params[:name]
|
@name = params[:name]
|
||||||
@syllabuses = Syllabus.like(@name).order('created_at desc')
|
@syllabuses = Syllabus.like(@name).order('created_at desc')
|
||||||
|
|
|
@ -4127,6 +4127,10 @@ def searchstudent_by_name users, name
|
||||||
mems
|
mems
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def contest_feedback_count
|
||||||
|
@contest.journals_for_messages.where('m_parent_id IS NULL').count
|
||||||
|
end
|
||||||
|
|
||||||
def add_reply_adapter obj, options
|
def add_reply_adapter obj, options
|
||||||
#modify by nwb
|
#modify by nwb
|
||||||
#添加对课程留言的支持
|
#添加对课程留言的支持
|
||||||
|
|
|
@ -93,8 +93,4 @@ module ContestsHelper
|
||||||
end
|
end
|
||||||
mems
|
mems
|
||||||
end
|
end
|
||||||
|
|
||||||
def contest_feedback_count
|
|
||||||
@contest.journals_for_messages.where('m_parent_id IS NULL').count
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
<h3>
|
||||||
|
<%=l(:label_contest_plural)%>
|
||||||
|
</h3>
|
||||||
|
|
||||||
|
<%= form_tag({}, :method => :get) do %>
|
||||||
|
<fieldset>
|
||||||
|
<label for='name'>
|
||||||
|
竞赛:
|
||||||
|
</label>
|
||||||
|
<%= text_field_tag 'name', params[:name], :size => 30, :placeholder => '竞赛名称' %>
|
||||||
|
<%= submit_tag l(:button_apply), :class => "small", :name => nil %>
|
||||||
|
<%= link_to l(:button_clear), {:controller => 'admin', :action => 'contests'}, :class => 'icon icon-reload' %>
|
||||||
|
</fieldset>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="autoscroll">
|
||||||
|
<table class="list" style="width: 100%;table-layout: fixed">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th style="width: 40px;">
|
||||||
|
序号
|
||||||
|
</th>
|
||||||
|
<th style="width: 200px;">
|
||||||
|
竞赛
|
||||||
|
</th>
|
||||||
|
<th style="width: 40px;">
|
||||||
|
公开
|
||||||
|
</th>
|
||||||
|
<th style="width: 100px;">
|
||||||
|
创建者
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
成员数
|
||||||
|
</th>
|
||||||
|
<th style="width: 30px;">
|
||||||
|
提交数
|
||||||
|
</th>
|
||||||
|
<th style="width: 70px;">
|
||||||
|
创建于
|
||||||
|
</th>
|
||||||
|
<th style="width: 120px;">
|
||||||
|
最新动态时间
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<% @contests.each do |contest| %>
|
||||||
|
<tr class="<%= cycle("odd", "even") %>">
|
||||||
|
<td style="text-align: center;">
|
||||||
|
<%= contest.id %>
|
||||||
|
</td>
|
||||||
|
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=contest.name%>'>
|
||||||
|
<span>
|
||||||
|
<%= link_to contest.name, contest_path(contest), :target => '_blank' %>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%= checked_image contest.is_public %>
|
||||||
|
</td>
|
||||||
|
<td style="text-align: center; white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=contest.user.show_name%>'>
|
||||||
|
<span>
|
||||||
|
<%= link_to contest.user.show_name, user_path(contest.user), :target => '_blank' %>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=contest.contest_members.count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%=contest.works.count %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%= format_date(contest.created_at) %>
|
||||||
|
</td>
|
||||||
|
<td align="center">
|
||||||
|
<%= contest.contest_acts.order("updated_at asc").last.updated_at.strftime('%Y-%m-%d %H:%M:%S') %>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<% end %>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="pagination">
|
||||||
|
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false %>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<% html_title(l(:label_project_plural)) -%>
|
|
@ -395,6 +395,7 @@ zh:
|
||||||
label_edit_organization: 编辑组织
|
label_edit_organization: 编辑组织
|
||||||
label_organization_edit: 修改组织
|
label_organization_edit: 修改组织
|
||||||
label_project_plural: 项目列表
|
label_project_plural: 项目列表
|
||||||
|
label_contest_plural: 竞赛列表
|
||||||
|
|
||||||
label_first_page_made: 首页定制
|
label_first_page_made: 首页定制
|
||||||
label_project_first_page: 项目托管平台首页
|
label_project_first_page: 项目托管平台首页
|
||||||
|
|
|
@ -1225,6 +1225,7 @@ RedmineApp::Application.routes.draw do
|
||||||
match 'admin/export_rep_static_users', :via => :get
|
match 'admin/export_rep_static_users', :via => :get
|
||||||
get 'admin/courses', as: :all_courses
|
get 'admin/courses', as: :all_courses
|
||||||
get 'admin/syllabuses', as: :all_syllabuses
|
get 'admin/syllabuses', as: :all_syllabuses
|
||||||
|
get 'admin/contests', :via => :get
|
||||||
get 'admin/non_syllabus_courses', as: :non_syllabus_courses
|
get 'admin/non_syllabus_courses', as: :non_syllabus_courses
|
||||||
post 'admin/update_course_name'
|
post 'admin/update_course_name'
|
||||||
post 'admin/update_syllabus_title'
|
post 'admin/update_syllabus_title'
|
||||||
|
|
|
@ -374,6 +374,7 @@ Redmine::MenuManager.map :admin_menu do |menu|
|
||||||
menu.push :organization, {:controller => 'admin', :action => 'organization'}, :caption => :label_organization_list
|
menu.push :organization, {:controller => 'admin', :action => 'organization'}, :caption => :label_organization_list
|
||||||
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
|
menu.push :projects, {:controller => 'admin', :action => 'projects'}, :caption => :label_project_plural
|
||||||
menu.push :syllabuses, {:controller => 'admin', :action => 'syllabuses'}, :caption => :label_course_all
|
menu.push :syllabuses, {:controller => 'admin', :action => 'syllabuses'}, :caption => :label_course_all
|
||||||
|
menu.push :contests, {:controller => 'admin', :action => 'contests'}, :caption => :label_contest_plural
|
||||||
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
|
menu.push :users, {:controller => 'admin', :action => 'users'}, :caption => :label_user_plural
|
||||||
menu.push :messages, {:controller => 'admin', :action => 'messages'}, :caption => :label_system_message
|
menu.push :messages, {:controller => 'admin', :action => 'messages'}, :caption => :label_system_message
|
||||||
menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural
|
menu.push :schools, {:controller => 'admin', :action => 'schools'}, :caption => :label_school_plural
|
||||||
|
|
|
@ -189,8 +189,10 @@ module Redmine
|
||||||
title = h(caption) + "(#{Organization.all.count})"
|
title = h(caption) + "(#{Organization.all.count})"
|
||||||
when '项目列表'
|
when '项目列表'
|
||||||
title = h(caption) + "(#{Project.all.count})"
|
title = h(caption) + "(#{Project.all.count})"
|
||||||
when '课程列表'
|
when '班级列表'
|
||||||
title = h(caption) + "(#{Course.all.count})"
|
title = h(caption) + "(#{Course.all.count})"
|
||||||
|
when '竞赛列表'
|
||||||
|
title = h(caption) + "(#{Contest.where("id >= 780").count})"
|
||||||
when '用户列表'
|
when '用户列表'
|
||||||
title = h(caption) + "(#{User.all.count})"
|
title = h(caption) + "(#{User.all.count})"
|
||||||
when '分享作业申请'
|
when '分享作业申请'
|
||||||
|
|
Loading…
Reference in New Issue