diff --git a/app/helpers/posts_helper.rb b/app/helpers/posts_helper.rb index 1e674f013..39d4e01f4 100644 --- a/app/helpers/posts_helper.rb +++ b/app/helpers/posts_helper.rb @@ -20,4 +20,13 @@ module PostsHelper nil 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 diff --git a/app/views/posts/partials/show/_information.html.erb b/app/views/posts/partials/show/_information.html.erb index 07085b5e8..1d0fc73ba 100644 --- a/app/views/posts/partials/show/_information.html.erb +++ b/app/views/posts/partials/show/_information.html.erb @@ -4,13 +4,14 @@ <% if post.approver %>
  • Approver: <%= link_to(post.approver.name, user_path(post.approver_id)) %>
  • <% end %> -
  • Rating: <%= post.pretty_rating %>
  • Size: <%= number_to_human_size(post.file_size) %> <% if post.is_image? %> (<%= post.image_width %>x<%= post.image_height %>) <% end %>
  • +
  • Source: <%= post_source_tag(post) %>
  • +
  • Rating: <%= post.pretty_rating %>
  • Score: <%= post.score %> (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 %>)
  • Status: