Profile links with tilde

This commit is contained in:
Marcin Kulik 2012-03-10 14:56:25 +01:00
parent 2e678714d4
commit 6b8a9e8610
2 changed files with 10 additions and 4 deletions

View File

@ -12,7 +12,8 @@ module ApplicationHelper
end
def avatar_img(user)
nickname = "~#{user.nickname}"
image_tag user.avatar_url || default_avatar_url,
:title => user.nickname, :alt => user.nickname, :class => "avatar"
:title => nickname, :alt => nickname, :class => "avatar"
end
end

View File

@ -10,10 +10,15 @@ module AsciicastsHelper
end
end
def asciicast_author(asciicast)
def profile_link(asciicast, options = {})
if asciicast.user
link_to avatar_img(asciicast.user) + " #{asciicast.user.nickname}",
profile_path(asciicast.user)
if options[:avatar]
img = avatar_img(asciicast.user) + " "
else
img = ""
end
link_to img + "~#{asciicast.user.nickname}", profile_path(asciicast.user)
end
end