modqueue: link tags, like they are in /comments.
This commit is contained in:
@@ -95,6 +95,10 @@ class PostPresenter < Presenter
|
|||||||
@post = post
|
@post = post
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tag_set_presenter
|
||||||
|
@tag_set_presenter ||= TagSetPresenter.new(@post.tag_array)
|
||||||
|
end
|
||||||
|
|
||||||
def preview_html
|
def preview_html
|
||||||
PostPresenter.preview(@post)
|
PostPresenter.preview(@post)
|
||||||
end
|
end
|
||||||
@@ -170,13 +174,15 @@ class PostPresenter < Presenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def tag_list_html(template, options = {})
|
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
|
end
|
||||||
|
|
||||||
def split_tag_list_html(template, options = {})
|
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
|
end
|
||||||
|
|
||||||
def has_nav_links?(template)
|
def has_nav_links?(template)
|
||||||
|
|||||||
@@ -64,6 +64,17 @@ class TagSetPresenter < Presenter
|
|||||||
html.html_safe
|
html.html_safe
|
||||||
end
|
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
|
private
|
||||||
def general_tags
|
def general_tags
|
||||||
@general_tags ||= categories.select {|k, v| v == Tag.categories.general}
|
@general_tags ||= categories.select {|k, v| v == Tag.categories.general}
|
||||||
|
|||||||
@@ -24,11 +24,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row list-of-tags">
|
<div class="row list-of-tags">
|
||||||
<strong>Tags</strong>
|
<strong>Tags</strong>
|
||||||
<% post.tag_array.each do |tag_name| %>
|
<%= post.presenter.inline_tag_list_html(self) %>
|
||||||
<span class="category-<%= Tag.category_for(tag_name) %>">
|
|
||||||
<%= link_to(tag_name.tr("_", " "), posts_path(:tags => tag_name)) %>
|
|
||||||
</span>
|
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
<strong>Hidden</strong>: <%= render "post_disapprovals/compact_counts", :disapprovals => post.disapprovals, :post => post %>
|
<strong>Hidden</strong>: <%= render "post_disapprovals/compact_counts", :disapprovals => post.disapprovals, :post => post %>
|
||||||
</li>
|
</li>
|
||||||
<li><strong>Source</strong>: <%= post.source %></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>
|
</ul>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user