52 lines
1.2 KiB
Ruby
52 lines
1.2 KiB
Ruby
class SchoolController < ApplicationController
|
|
|
|
before_filter :require_admin, :only => :upload_logo
|
|
|
|
def upload_logo
|
|
|
|
end
|
|
|
|
|
|
def index
|
|
|
|
end
|
|
|
|
def get_options
|
|
@school = School.where("province = ?", params[:province])
|
|
p = params[:province]
|
|
##@school = School.all
|
|
options = ""
|
|
|
|
@school.each do |s|
|
|
#options << "<option value=#{s.id}>#{s.name}</option>"
|
|
options << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id, this.text)'>#{s.name}</a></li>"
|
|
end
|
|
|
|
|
|
render :text => options
|
|
|
|
end
|
|
|
|
def get_schoollist
|
|
@school = School.where("province = ?", params[:province])
|
|
|
|
options = ""
|
|
@school.each do |s|
|
|
options << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
|
|
end
|
|
|
|
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 << "<li style = 'width: 33%; float: left'><a id=#{s.id} onclick='test(this.id)'>#{s.name}</a></li>"
|
|
end
|
|
|
|
render :text => options
|
|
end
|
|
end
|