FIX: anonymous had <a> items for pin/unpin

FEATURE: display category in search results
FEATURE: display topic state (locked/pinned/etc) in search results

UI cleanup for search results, clearing floats and so on.
This commit is contained in:
Sam
2014-09-03 12:13:13 +10:00
parent 4f09d552ed
commit 921dd75dd9
12 changed files with 105 additions and 120 deletions

View File

@ -300,10 +300,13 @@ class Search
def aggregate_search
post_sql = posts_query(@limit, aggregate_search: true)
.select('topics.id', 'min(post_number) post_number, row_number() OVER() row_number')
.select('topics.id', 'min(post_number) post_number')
.group('topics.id')
.to_sql
# double wrapping so we get correct row numbers
post_sql = "SELECT *, row_number() over() row_number FROM (#{post_sql}) xxx"
posts = Post.includes(:topic => :category)
.joins("JOIN (#{post_sql}) x ON x.id = posts.topic_id AND x.post_number = posts.post_number")
.order('row_number')