用户主页头像显示改进

This commit is contained in:
nieguanghui 2013-08-19 16:41:22 +08:00
parent 9dc4fcaa8e
commit a126083579
1 changed files with 6 additions and 0 deletions

View File

@ -1311,6 +1311,9 @@ module ApplicationHelper
def show_watcher_profile(obj) def show_watcher_profile(obj)
count = 0 count = 0
html = '' html = ''
if User.watched_by(obj.id).count == 0
html << (content_tag "span", l(:label_no_current_watchers))
end
for user in User.watched_by(obj.id) for user in User.watched_by(obj.id)
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => "#{user.name}") html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => "#{user.name}")
count = count + 1 count = count + 1
@ -1333,6 +1336,9 @@ module ApplicationHelper
def show_fans_picture(obj) def show_fans_picture(obj)
html = '' html = ''
count = 0 count = 0
if obj.watcher_users.count == 0
html << (content_tag "span", l(:label_no_current_fans))
end
for user in obj.watcher_users for user in obj.watcher_users
html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => "#{user.name}") html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar", :title => "#{user.name}")
count = count + 1 count = count + 1