tag_set_presenter: refactor split_tag_list_html.

* Make category headers optional.
* Make category order configurable.
* Clean up code.
This commit is contained in:
evazion
2018-04-25 19:49:46 -05:00
parent fdd5ea3e78
commit 442964b0eb
3 changed files with 15 additions and 30 deletions

View File

@@ -1,5 +1,6 @@
class PostPresenter < Presenter
attr_reader :pool, :next_post_in_pool
delegate :tag_list_html, :split_tag_list_html, :inline_tag_list_html, :split_inline_tag_list_html, to: :tag_set_presenter
def self.preview(post, options = {})
if post.nil?
@@ -162,10 +163,6 @@ class PostPresenter < Presenter
categorized_tag_groups.join(" \n")
end
def humanized_categorized_tag_string
categorized_tag_groups.flatten.slice(0, 25).join(", ").tr("_", " ")
end
def safe_mode_message(template)
html = ["This image is unavailable on safe mode (#{Danbooru.config.app_name}). Go to "]
html << template.link_to("Danbooru", "http://danbooru.donmai.us") # XXX don't hardcode.
@@ -193,18 +190,6 @@ class PostPresenter < Presenter
end
end
def tag_list_html(template, options = {})
tag_set_presenter.tag_list_html(template, options.merge(:show_extra_links => CurrentUser.user.is_gold?))
end
def split_tag_list_html(template, options = {})
tag_set_presenter.split_tag_list_html(template, options.merge(:show_extra_links => CurrentUser.user.is_gold?))
end
def inline_tag_list_html(template)
tag_set_presenter.inline_tag_list(template)
end
def has_nav_links?(template)
has_sequential_navigation?(template.params) || @post.pools.undeleted.any? || @post.favorite_groups(active_id=template.params[:favgroup_id]).any?
end