diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb
index a2f6a348c..3e12ba3b3 100644
--- a/app/controllers/school_controller.rb
+++ b/app/controllers/school_controller.rb
@@ -31,4 +31,15 @@ class SchoolController < ApplicationController
render :text => options
end
+
+ def search_school
+ @school = School.where("province = ? AND name LIKE '%"+params[:key_word]+"%'", params[:province]);
+
+ options = ""
+ @school.each do |s|
+ options << "
#{s.name}"
+ end
+
+ render :text => options
+ end
end
diff --git a/app/views/school/index.html.erb b/app/views/school/index.html.erb
index ad9523025..1277c0b4b 100644
--- a/app/views/school/index.html.erb
+++ b/app/views/school/index.html.erb
@@ -22,17 +22,38 @@
location.href = "welcome/index?course.trustie.net&school_id="+id;
}
+
全部学校
-
- 请选择省份:<%= select_tag "province",
- options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province),
- :onclick => "get_school(this.value)" %>
-
+
+
diff --git a/config/routes.rb b/config/routes.rb
index 50b38d337..3c4510be9 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -585,6 +585,9 @@ RedmineApp::Application.routes.draw do
post 'school/get_schoollist/:province', :to => 'school#get_schoollist'
get 'school/get_schoollist/:province', :to => 'school#get_schoollist'
+ post 'school/search_school/', :to => 'school#search_school'
+ get 'school/search_school/', :to => 'school#search_school'
+
######added by nie
match 'tags/show_projects_tags',:to => 'tags#show_projects_tags'
########### added by liuping