竞赛首页修改

This commit is contained in:
nwb 2014-07-21 16:19:45 +08:00
parent aea41ba997
commit 27fda1f938
3 changed files with 11 additions and 1 deletions

View File

@ -77,6 +77,10 @@ class ContestsController < ApplicationController
end
end
def search
redirect_to action: 'index',name:params[:name]
end
def homework
@offset, @limit = api_offset_and_limit({:limit => 10})
@bids = @course.homeworks.order('deadline DESC')

View File

@ -118,6 +118,11 @@ class WelcomeController < ApplicationController
search_condition = params[:q]
search_type = params[:search_type].to_sym unless search_condition.blank?
if search_type.nil? && params[:contests_search] && params[:name] != ""
search_type = :contests
search_condition = params[:name]
end
respond_to do |format|
format.html{
case search_type
@ -127,7 +132,7 @@ class WelcomeController < ApplicationController
when :courses
redirect_to courses_search_path(:name => search_condition)
when :contests
redirect_to contests_search_path(:name => search_condition)
redirect_to contests_path(:name => search_condition)
when :users
redirect_to users_search_path(:name => search_condition)
when :users_teacher

View File

@ -578,6 +578,7 @@ RedmineApp::Application.routes.draw do
end
match 'courses/search', :to => 'courses#search'
match '/contests/search', :controller => 'contests', :action => 'search', :via => [:get, :post]
# add by nwb
# 课程路由设置
resources :courses do