fixes #18: Source/rating not displayed on post pages
This commit is contained in:
@@ -20,4 +20,13 @@ module PostsHelper
|
|||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def post_source_tag(post)
|
||||||
|
if post.source =~ /^http/
|
||||||
|
text = truncate(post.source.sub(/^https?:\/\//, ""))
|
||||||
|
link_to(truncate(text, :length => 15), post.source)
|
||||||
|
else
|
||||||
|
truncate(post.source, :length => 100)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,13 +4,14 @@
|
|||||||
<% if post.approver %>
|
<% if post.approver %>
|
||||||
<li>Approver: <%= link_to(post.approver.name, user_path(post.approver_id)) %></li>
|
<li>Approver: <%= link_to(post.approver.name, user_path(post.approver_id)) %></li>
|
||||||
<% end %>
|
<% end %>
|
||||||
<li>Rating: <%= post.pretty_rating %></li>
|
|
||||||
<li>
|
<li>
|
||||||
Size: <%= number_to_human_size(post.file_size) %>
|
Size: <%= number_to_human_size(post.file_size) %>
|
||||||
<% if post.is_image? %>
|
<% if post.is_image? %>
|
||||||
(<%= post.image_width %>x<%= post.image_height %>)
|
(<%= post.image_width %>x<%= post.image_height %>)
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
</li>
|
||||||
|
<li>Source: <%= post_source_tag(post) %></li>
|
||||||
|
<li>Rating: <%= post.pretty_rating %></li>
|
||||||
<li>Score: <span id="score-for-post-<%= post.id %>"><%= post.score %></span> (vote <%= link_to "up", post_votes_path(:post_id => post.id, :score => "up"), :remote => true, :method => :post %>/<%= link_to "down", post_votes_path(:post_id => post.id, :score => "down"), :remote => true, :method => :post %>)</li>
|
<li>Score: <span id="score-for-post-<%= post.id %>"><%= post.score %></span> (vote <%= link_to "up", post_votes_path(:post_id => post.id, :score => "up"), :remote => true, :method => :post %>/<%= link_to "down", post_votes_path(:post_id => post.id, :score => "down"), :remote => true, :method => :post %>)</li>
|
||||||
<li>
|
<li>
|
||||||
Status:
|
Status:
|
||||||
|
|||||||
Reference in New Issue
Block a user