controller tweaks

This commit is contained in:
albert
2013-02-23 15:58:21 -05:00
parent 096f1be22b
commit 56dd8707fd
17 changed files with 43 additions and 28 deletions

View File

@@ -2,7 +2,7 @@ class ArtistVersionsController < ApplicationController
respond_to :html, :xml, :json
def index
@artist_versions = ArtistVersion.search(params[:search]).order("id desc").paginate(params[:page])
@artist_versions = ArtistVersion.search(params[:search]).order("id desc").paginate(params[:page], :search_count => params[:search])
respond_with(@artist_versions)
end
end

View File

@@ -67,14 +67,14 @@ private
end
def index_by_post
@posts = Post.commented_before(Time.now).tag_match(params[:tags]).paginate(params[:page], :limit => 5)
@posts = Post.commented_before(Time.now).tag_match(params[:tags]).paginate(params[:page], :limit => 5, :search_count => params[:search])
respond_with(@posts) do |format|
format.html {render :action => "index_by_post"}
end
end
def index_by_comment
@comments = Comment.search(params[:search]).order("comments.id DESC").paginate(params[:page])
@comments = Comment.search(params[:search]).order("comments.id DESC").paginate(params[:page], :search_count => params[:search])
respond_with(@comments) do |format|
format.html {render :action => "index_by_comment"}
end

View File

@@ -17,7 +17,7 @@ class ForumPostsController < ApplicationController
def index
@search = ForumPost.active.search(params[:search])
@forum_posts = @search.order("forum_posts.id DESC").paginate(params[:page])
@forum_posts = @search.order("forum_posts.id DESC").paginate(params[:page], :search_count => params[:search])
respond_with(@forum_posts)
end

View File

@@ -19,7 +19,7 @@ class ForumTopicsController < ApplicationController
def index
@search = ForumTopic.active.search(params[:search])
@forum_topics = @search.order("is_sticky DESC, updated_at DESC").paginate(params[:page])
@forum_topics = @search.order("is_sticky DESC, updated_at DESC").paginate(params[:page], :search_count => params[:search])
respond_with(@forum_topics)
end

View File

@@ -63,8 +63,7 @@ private
end
def index_by_note
@search = Note.search(params[:search])
@notes = @search.order("id desc").paginate(params[:page])
@notes = Note.search(params[:search]).order("id desc").paginate(params[:page], :search_count => params[:search])
respond_with(@notes) do |format|
format.html {render :action => "index_by_note"}
end

View File

@@ -1,6 +1,5 @@
class PoolVersionsController < ApplicationController
def index
@search = PoolVersion.search(params[:search])
@pool_versions = @search.order("updated_at desc").paginate(params[:page])
@pool_versions = PoolVersion.search(params[:search]).order("updated_at desc").paginate(params[:page], :search_count => params[:search])
end
end

View File

@@ -15,8 +15,7 @@ class PoolsController < ApplicationController
end
def index
@search = Pool.active.search(params[:search])
@pools = @search.order("updated_at desc").paginate(params[:page])
@pools = Pool.active.search(params[:search]).order("updated_at desc").paginate(params[:page], :search_count => params[:search])
respond_with(@pools)
end

View File

@@ -2,7 +2,7 @@ class PostVersionsController < ApplicationController
respond_to :html, :xml, :json
def index
@post_versions = PostVersion.search(params[:search]).order("updated_at desc").paginate(params[:page], :count => (params[:search].present? ? nil : 1_000_000))
@post_versions = PostVersion.search(params[:search]).order("updated_at desc").paginate(params[:page], :search_count => params[:search])
respond_with(@post_versions)
end

View File

@@ -8,7 +8,7 @@ class TagsController < ApplicationController
end
def index
@tags = Tag.search(params[:search]).paginate(params[:page])
@tags = Tag.search(params[:search]).paginate(params[:page], :search_count => params[:search])
respond_with(@tags)
end

View File

@@ -15,8 +15,7 @@ class UsersController < ApplicationController
end
def index
@search = User.search(params[:search])
@users = @search.order("users.id desc").paginate(params[:page])
@users = User.search(params[:search]).order("users.id desc").paginate(params[:page], :search_count => params[:search])
respond_with(@users)
end

View File

@@ -2,8 +2,7 @@ class WikiPageVersionsController < ApplicationController
respond_to :json, :html, :xml
def index
@search = WikiPageVersion.search(params[:search])
@wiki_page_versions = @search.order("id desc").paginate(params[:page])
@wiki_page_versions = WikiPageVersion.search(params[:search]).order("id desc").paginate(params[:page], :search_count => params[:search])
respond_with(@wiki_page_versions)
end

View File

@@ -15,8 +15,7 @@ class WikiPagesController < ApplicationController
end
def index
@search = WikiPage.search(params[:search])
@wiki_pages = @search.order("id desc").paginate(params[:page])
@wiki_pages = WikiPage.search(params[:search]).order("id desc").paginate(params[:page], :search_count => params[:search])
respond_with(@wiki_pages) do |format|
format.html do
if @wiki_pages.count == 1