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 %>