显示图片的数据的封装

This commit is contained in:
nieguanghui 2013-08-03 19:42:09 +08:00
parent c24320fda5
commit a29a84d8a3
2 changed files with 24 additions and 21 deletions

View File

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

View File

@ -63,14 +63,6 @@
</table>
</div>
<div class="user_underline"></div>
<!--<div class="user_private">
<div class="user_private_left"><a>发私信</a></div>
<div class="user_private_right"><a>发留言</a></div>
</div> -->
<!--座右铭
<div class="inf_user_motto">
<span>加油~</span>
</div> -->
<!--关注-->
<div class="user_fans">
<div class="font_title_left">
@ -81,9 +73,7 @@
<table>
<tr>
<td style="padding-top: 5px">
<% 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) %>
</td>
</tr>
<tr>
@ -103,9 +93,7 @@
<table>
<tr>
<td style="padding-top: 5px">
<% 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) %>
</td>
</tr>
<tr>
@ -133,16 +121,12 @@
<%= render_flash_messages %>
</div>
<%=render :partial => 'layouts/base_footer'%>
</div>
<%=render :partial => 'layouts/base_footer'%>
</div>
<div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span>
</div>
<div id="ajax-modal" style="display:none;"></div>
<div id="ajax-modal" style="display:none;"></div>
</div>
</div>