fix for #1217
This commit is contained in:
@@ -20,15 +20,24 @@ module PostsHelper
|
||||
def post_source_tag(post)
|
||||
if post.source =~ %r!http://img\d+\.pixiv\.net/img/([^\/]+)/!
|
||||
text = "pixiv/#{$1}"
|
||||
link_to(text, post.normalized_source)
|
||||
source_link = link_to(text, post.normalized_source)
|
||||
source_search = "source:#{text}"
|
||||
elsif post.source =~ %r!http://i\d\.pixiv\.net/img\d+/img/([^\/]+)/!
|
||||
text = "pixiv/#{$1}"
|
||||
link_to(text, post.normalized_source)
|
||||
source_link = link_to(text, post.normalized_source)
|
||||
source_search = "source:#{text}"
|
||||
elsif post.source =~ /^http/
|
||||
text = truncate(post.normalized_source.sub(/^https?:\/\/(?:www)?/, ""))
|
||||
link_to(truncate(text, :length => 20), post.normalized_source)
|
||||
source_link = link_to(truncate(text, :length => 20), post.normalized_source)
|
||||
source_search = "source:#{post.source.sub(/[^\/]*$/, "")}"
|
||||
else
|
||||
truncate(post.source, :length => 100)
|
||||
source_link = truncate(post.source, :length => 100)
|
||||
end
|
||||
|
||||
if CurrentUser.is_builder? && !source_search.blank?
|
||||
source_link + " " + link_to("»".html_safe, posts_path(:tags => source_search))
|
||||
else
|
||||
source_link
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<ul>
|
||||
<li>ID: <%= post.id %></li>
|
||||
<li>Uploader: <%= link_to_user_unless(post.uploader.nil?, post.uploader) %></li>
|
||||
<li>Uploader: <%= link_to_user_unless(post.uploader.nil?, post.uploader) + " " + link_to("»".html_safe, posts_path(:tags => "user:#{post.uploader.name}")) %></li>
|
||||
<li>Date: <%= link_to time_ago_in_words_tagged(post.created_at), posts_path(:tags => "date:#{post.created_at.to_date}") %></li>
|
||||
<% if post.approver %>
|
||||
<li>Approver: <%= link_to_user(post.approver) %></li>
|
||||
|
||||
Reference in New Issue
Block a user