modqueue: link tags, like they are in /comments.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -24,11 +24,7 @@
|
||||
</div>
|
||||
<div class="row list-of-tags">
|
||||
<strong>Tags</strong>
|
||||
<% post.tag_array.each do |tag_name| %>
|
||||
<span class="category-<%= Tag.category_for(tag_name) %>">
|
||||
<%= link_to(tag_name.tr("_", " "), posts_path(:tags => tag_name)) %>
|
||||
</span>
|
||||
<% end %>
|
||||
<%= post.presenter.inline_tag_list_html(self) %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<strong>Hidden</strong>: <%= render "post_disapprovals/compact_counts", :disapprovals => post.disapprovals, :post => post %>
|
||||
</li>
|
||||
<li><strong>Source</strong>: <%= post.source %></li>
|
||||
<li><strong>Tags</strong>: <%= post.tag_string %></li>
|
||||
<li><strong>Tags</strong>: <%= post.presenter.inline_tag_list_html(self) %></li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user