show story hider count on story detail page
This commit is contained in:
parent
ed71fd8d61
commit
8b60e5fd63
|
@ -225,6 +225,11 @@ class Story < ActiveRecord::Base
|
||||||
"hotness = '#{self.calculated_hotness}' WHERE id = #{self.id.to_i}")
|
"hotness = '#{self.calculated_hotness}' WHERE id = #{self.id.to_i}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def hider_count
|
||||||
|
@hider_count ||= Vote.where(:story_id => self.id, :comment_id => nil,
|
||||||
|
:vote => 0).count
|
||||||
|
end
|
||||||
|
|
||||||
def is_editable_by_user?(user)
|
def is_editable_by_user?(user)
|
||||||
if user && user.is_moderator?
|
if user && user.is_moderator?
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -71,6 +71,9 @@ class="story <%= story.vote == 1 ? "upvoted" : "" %> <%= story.vote == -1 ?
|
||||||
| <%= link_to "hide", story_hide_url(story.short_id),
|
| <%= link_to "hide", story_hide_url(story.short_id),
|
||||||
:class => "hider" %>
|
:class => "hider" %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<% if defined?(single_story) && single_story && story.hider_count > 0 %>
|
||||||
|
(hidden by <%= pluralize(story.hider_count, "user") %>)
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if !story.is_gone? && (@user || story.comments_count > 0) %>
|
<% if !story.is_gone? && (@user || story.comments_count > 0) %>
|
||||||
<span class="comments_label">
|
<span class="comments_label">
|
||||||
|
|
Loading…
Reference in a new issue