issue global 859. 搜索处理空格
This commit is contained in:
parent
4d75fbfcb8
commit
91eb7751da
|
@ -166,10 +166,10 @@ class ForumsController < ApplicationController
|
|||
|
||||
def search_forum
|
||||
# @forums = paginateHelper Forum.where("name LIKE '%#{params[:name]}%'")
|
||||
name = params[:name]
|
||||
(redirect_to forums_path, :notice => l(:label_sumbit_empty);return) if name.blank?
|
||||
q = "%#{params[:name].strip}%"
|
||||
(redirect_to forums_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
|
||||
@offset, @limit = api_offset_and_limit({:limit => 10})
|
||||
@forums_all = Forum.where("name LIKE '%#{params[:name]}%'")
|
||||
@forums_all = Forum.where("name LIKE ?", q)
|
||||
@forums_count = @forums_all.count
|
||||
@forums_pages = Paginator.new @forums_count, @limit, params['page']
|
||||
|
||||
|
@ -185,11 +185,13 @@ class ForumsController < ApplicationController
|
|||
end
|
||||
|
||||
def search_memo
|
||||
q = "%#{params[:name].strip}%"
|
||||
|
||||
limit = PageLimit
|
||||
@memo = Memo.new
|
||||
@offset, @limit = api_offset_and_limit({:limit => limit})
|
||||
@forum = Forum.find(params[:id])
|
||||
@memos_all = @forum.topics.where("subject LIKE '%#{params[:name]}%'")
|
||||
@memos_all = @forum.topics.where("subject LIKE ?", q)
|
||||
@topic_count = @memos_all.count
|
||||
@topic_pages = Paginator.new @topic_count, @limit, params['page']
|
||||
|
||||
|
|
|
@ -98,10 +98,11 @@ class SchoolController < ApplicationController
|
|||
end
|
||||
|
||||
def search_school
|
||||
q = "%#{params[:key_word].strip}%"
|
||||
if params[:province].nil? or params[:province] == "0"
|
||||
@school = School.where("name LIKE '%"+params[:key_word]+"%'");
|
||||
@school = School.where("name LIKE ?", q);
|
||||
else
|
||||
@school = School.where("province = ? AND name LIKE '%"+params[:key_word]+"%'", params[:province]);
|
||||
@school = School.where("province = ? AND name LIKE ?", params[:province], q);
|
||||
end
|
||||
options = ""
|
||||
@school.each do |s|
|
||||
|
|
|
@ -5,10 +5,10 @@ class StoresController < ApplicationController
|
|||
layout 'base_stores'
|
||||
|
||||
def search
|
||||
name = params[:name] ||= ''
|
||||
(redirect_to stores_path, :notice => l(:label_sumbit_empty);return) if name.blank?
|
||||
q = "%#{params[:name].strip}%"
|
||||
(redirect_to stores_path, :notice => l(:label_sumbit_empty);return) if params[:name].blank?
|
||||
|
||||
result = find_public_attache name
|
||||
result = find_public_attache q
|
||||
@searched_attach = paginateHelper result
|
||||
@result_all_count = result.count;
|
||||
end
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
}
|
||||
}
|
||||
$(document).ready(function($) {
|
||||
$('.cb span').highlight('<%=params[:name]%>');
|
||||
$('.cb span').highlight('<%="#{params[:name].strip}"%>');
|
||||
|
||||
$('.a_download_icon').each(function(){
|
||||
$(this).mouseenter(function(event) {
|
||||
|
|
Loading…
Reference in New Issue