修改学校链接

This commit is contained in:
sw 2014-07-03 18:11:10 +08:00
parent b42d742c06
commit 3e185c3a4b
3 changed files with 14 additions and 6 deletions

View File

@ -105,7 +105,7 @@ class SchoolController < ApplicationController
end end
options = "" options = ""
@school.each do |s| @school.each do |s|
options << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>" options << "<li style = 'width: 33%; float: left'> <a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
end end
render :text => options render :text => options

View File

@ -44,8 +44,16 @@
<script type="text/javascript"> <script type="text/javascript">
function test(id){ function test(id){
location.href = encodeURI('http://course.trustie.net<%=port%>?school_id='+id); $.ajax({
url: '<%=school_course_list_path%>',
type: "POST",
data: {
school_id: id
}
}).complete(eval_ajax);
} }
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
function ssearch(){ function ssearch(){
@ -70,8 +78,8 @@
<div> <div>
<p> <p>
<a href="http://course.trustie.net<%=port%>?school_id=0">全部学校</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <%= link_to "全部学校",school_index_path %>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<%= link_to '我的学校',scholl_course_list_path(User.current.user_extensions.school) %> <%= link_to '我的学校',school_course_list_path(User.current.user_extensions.school) %>
</p> </p>
<ul> <ul>
<li style="width: 40%; float: left">请选择省份: <li style="width: 40%; float: left">请选择省份:
@ -85,7 +93,7 @@
<div style="clear: both"></div> <div style="clear: both"></div>
<div> <div>
<ul id="schoollist" style="line-height: 25px"> <ul id="schoollist" style="line-height: 25px">
</ul> </ul>
</div> </div>

View File

@ -700,7 +700,7 @@ RedmineApp::Application.routes.draw do
#######confusing######## #######confusing########
get 'welcome/search', to: 'welcome#search' get 'welcome/search', to: 'welcome#search'
get 'school/index', to: 'school#index' get 'school/index', to: 'school#index'
get 'course/:school_id', to: 'welcome#course', :as => 'scholl_course_list' get 'course/:school_id', to: 'welcome#course', :as => 'school_course_list'
#get 'course/:school_id', to: 'welcome#course' #get 'course/:school_id', to: 'welcome#course'
post 'school/get_options/:province', :to => 'school#get_options' post 'school/get_options/:province', :to => 'school#get_options'
get 'school/get_options/:province', :to => 'school#get_options' get 'school/get_options/:province', :to => 'school#get_options'