From a29a84d8a31fe771802ed93ea10abfe00942e234 Mon Sep 17 00:00:00 2001 From: nieguanghui Date: Sat, 3 Aug 2013 19:42:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=9B=BE=E7=89=87=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E5=B0=81=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 19 +++++++++++++++++++ app/views/layouts/base_users.html.erb | 26 +++++--------------------- 2 files changed, 24 insertions(+), 21 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index fedefeb7..891842ea 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1284,4 +1284,23 @@ module ApplicationHelper def link_to_content_update(text, url_params = {}, html_options = {}) link_to(text, url_params, html_options) end + +#added by nie +# Display watcher picture + def show_watcher_profile(obj) + html = '' + for user in User.watched_by(obj.id) + html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar") + end + html.html_safe + end + +#display fans picture + def show_fans_picture(obj) + html = '' + for user in obj.watcher_users + html << (link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar") + end + html.html_safe + end end diff --git a/app/views/layouts/base_users.html.erb b/app/views/layouts/base_users.html.erb index 46f549a3..3f04f57d 100644 --- a/app/views/layouts/base_users.html.erb +++ b/app/views/layouts/base_users.html.erb @@ -63,14 +63,6 @@
- -
@@ -81,9 +73,7 @@ @@ -103,9 +93,7 @@
- <% for user in User.watched_by(@user.id)%> - <%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar" %> - <% end%> + <%= show_watcher_profile(@user) %>
@@ -133,16 +121,12 @@ <%= render_flash_messages %> - <%=render :partial => 'layouts/base_footer'%> - - - + <%=render :partial => 'layouts/base_footer'%> + - - - +
- <% for user in @user.watcher_users %> - <%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar" %> - <% end%> + <%= show_fans_picture(@user) %>