modqueue: link tags, like they are in /comments.

This commit is contained in:
evazion
2017-02-24 20:59:21 -06:00
parent 83915a5d46
commit b80976bce7
4 changed files with 23 additions and 10 deletions

View File

@@ -95,6 +95,10 @@ class PostPresenter < Presenter
@post = post
end
def tag_set_presenter
@tag_set_presenter ||= TagSetPresenter.new(@post.tag_array)
end
def preview_html
PostPresenter.preview(@post)
end
@@ -170,13 +174,15 @@ class PostPresenter < Presenter
end
def tag_list_html(template, options = {})
@tag_set_presenter ||= TagSetPresenter.new(@post.tag_array)
@tag_set_presenter.tag_list_html(template, options.merge(:show_extra_links => CurrentUser.user.is_gold?))
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 ||= TagSetPresenter.new(@post.tag_array)
@tag_set_presenter.split_tag_list_html(template, options.merge(:show_extra_links => CurrentUser.user.is_gold?))
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)

View File

@@ -64,6 +64,17 @@ class TagSetPresenter < Presenter
html.html_safe
end
# compact (horizontal) list, as seen in the /comments index.
def inline_tag_list(template)
@tags.map do |tag_name|
<<-EOS
<span class="category-#{Tag.category_for(tag_name)}">
#{template.link_to(tag_name.tr("_", " "), template.posts_path(tags: tag_name))}
</span>
EOS
end.join.html_safe
end
private
def general_tags
@general_tags ||= categories.select {|k, v| v == Tag.categories.general}