Files
danbooru/app/presenters/post_set_presenters/pool.rb
evazion 99632d5e8a TagSetPresenter: refactor to pass options explicitly.
Refactor tag_list_html, split_tag_list_html, and inline_tag_list_html to
take the `show_extra_links` and `current_query` options explicitly,
rather than implicitly relying on CurrentUser or taking `params[:tags]`
from the template.
2018-09-30 21:52:24 -05:00

30 lines
655 B
Ruby

module PostSetPresenters
class Pool < Base
attr_reader :tag_set_presenter, :post_set
delegate :posts, :to => :post_set
def initialize(post_set)
@post_set = post_set
@tag_set_presenter = TagSetPresenter.new(
RelatedTagCalculator.calculate_from_sample_to_array(
post_set.tag_string
).map {|x| x[0]}
)
end
def post_previews_html(template)
html = ""
if posts.empty?
return template.render("post_sets/blank")
end
posts.each do |post|
html << PostPresenter.preview(post, :pool_id => post_set.pool.id)
end
html.html_safe
end
end
end