fixes #563
This commit is contained in:
@@ -8,8 +8,7 @@ class TagsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@search = Tag.search(params[:search])
|
@tags = Tag.search(params[:search]).paginate(params[:page])
|
||||||
@tags = @search.paginate(params[:page])
|
|
||||||
respond_with(@tags)
|
respond_with(@tags)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ class Artist < ActiveRecord::Base
|
|||||||
|
|
||||||
def search(params)
|
def search(params)
|
||||||
q = active
|
q = active
|
||||||
return q if params.blank?
|
params = {} if params.blank?
|
||||||
|
|
||||||
case params[:name]
|
case params[:name]
|
||||||
when /^http/
|
when /^http/
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ class Tag < ActiveRecord::Base
|
|||||||
|
|
||||||
def search(params)
|
def search(params)
|
||||||
q = scoped
|
q = scoped
|
||||||
return q if params.blank?
|
params = {} if params.blank?
|
||||||
|
|
||||||
if params[:name_matches].present?
|
if params[:name_matches].present?
|
||||||
q = q.name_matches(params[:name_matches])
|
q = q.name_matches(params[:name_matches])
|
||||||
@@ -413,7 +413,7 @@ class Tag < ActiveRecord::Base
|
|||||||
q = q.where("category = ?", params[:category])
|
q = q.where("category = ?", params[:category])
|
||||||
end
|
end
|
||||||
|
|
||||||
if params[:hide_empty] != "no"
|
if params[:hide_empty].blank? || params[:hide_empty] != "no"
|
||||||
q = q.where("post_count > 0")
|
q = q.where("post_count > 0")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -422,22 +422,22 @@ class Tag < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
case params[:order]
|
case params[:order]
|
||||||
when "date"
|
when "name"
|
||||||
q = q.order("created_at desc")
|
q = q.order("name")
|
||||||
|
|
||||||
else
|
else
|
||||||
q = q.order("name")
|
q = q.order("created_at desc")
|
||||||
end
|
end
|
||||||
|
|
||||||
case params[:sort]
|
case params[:sort]
|
||||||
when "count"
|
when "count"
|
||||||
q = q.order("post_count desc")
|
q = q.order("post_count desc")
|
||||||
|
|
||||||
when "date"
|
when "name"
|
||||||
q = q.order("created_at desc")
|
q = q.order("name")
|
||||||
|
|
||||||
else
|
else
|
||||||
q = q.order("name")
|
q = q.order("created_at desc")
|
||||||
end
|
end
|
||||||
|
|
||||||
q
|
q
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class WikiPage < ActiveRecord::Base
|
|||||||
|
|
||||||
def search(params = {})
|
def search(params = {})
|
||||||
q = scoped
|
q = scoped
|
||||||
return q if params.blank?
|
params = {} if params.blank?
|
||||||
|
|
||||||
if params[:title].present?
|
if params[:title].present?
|
||||||
q = q.where("title LIKE ? ESCAPE E'\\\\'", params[:title].downcase.tr(" ", "_").to_escaped_for_sql_like)
|
q = q.where("title LIKE ? ESCAPE E'\\\\'", params[:title].downcase.tr(" ", "_").to_escaped_for_sql_like)
|
||||||
|
|||||||
Reference in New Issue
Block a user