limit wiki pages to 8 posts
This commit is contained in:
10
app/logical/post_sets/wiki_page.rb
Normal file
10
app/logical/post_sets/wiki_page.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
module PostSets
|
||||||
|
class SearchError < Exception
|
||||||
|
end
|
||||||
|
|
||||||
|
class WikiPage < Post
|
||||||
|
def presenter
|
||||||
|
@presenter ||= ::PostSetPresenters::WikiPage.new(self)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -82,7 +82,7 @@ class WikiPage < ActiveRecord::Base
|
|||||||
end
|
end
|
||||||
|
|
||||||
def post_set
|
def post_set
|
||||||
@post_set ||= PostSets::Post.new(title)
|
@post_set ||= PostSets::WikiPage.new(title)
|
||||||
end
|
end
|
||||||
|
|
||||||
def presenter
|
def presenter
|
||||||
|
|||||||
10
app/presenters/post_set_presenters/wiki_page.rb
Normal file
10
app/presenters/post_set_presenters/wiki_page.rb
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
module PostSetPresenters
|
||||||
|
class WikiPage < Post
|
||||||
|
def posts
|
||||||
|
Thread.current["records_per_page"] = 8
|
||||||
|
@post_set.posts
|
||||||
|
ensure
|
||||||
|
Thread.current["records_per_page"] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -63,7 +63,8 @@ module Danbooru
|
|||||||
end
|
end
|
||||||
|
|
||||||
def records_per_page
|
def records_per_page
|
||||||
Danbooru.config.posts_per_page
|
# ugly hack but no easy way to pass this info down
|
||||||
|
Thread.current["records_per_page"] || Danbooru.config.posts_per_page
|
||||||
end
|
end
|
||||||
|
|
||||||
# taken from kaminari (https://github.com/amatsuda/kaminari)
|
# taken from kaminari (https://github.com/amatsuda/kaminari)
|
||||||
|
|||||||
Reference in New Issue
Block a user