显示图片的数据的封装

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 = {}) def link_to_content_update(text, url_params = {}, html_options = {})
link_to(text, url_params, html_options) link_to(text, url_params, html_options)
end 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 end

View File

@ -63,14 +63,6 @@
</table> </table>
</div> </div>
<div class="user_underline"></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="user_fans">
<div class="font_title_left"> <div class="font_title_left">
@ -81,9 +73,7 @@
<table> <table>
<tr> <tr>
<td style="padding-top: 5px"> <td style="padding-top: 5px">
<% for user in User.watched_by(@user.id)%> <%= show_watcher_profile(@user) %>
<%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar" %>
<% end%>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -103,9 +93,7 @@
<table> <table>
<tr> <tr>
<td style="padding-top: 5px"> <td style="padding-top: 5px">
<% for user in @user.watcher_users %> <%= show_fans_picture(@user) %>
<%= link_to image_tag(url_to_avatar(user), :class => "avatar"), user_path(user), :class => "avatar" %>
<% end%>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -134,15 +122,11 @@
</div> </div>
<%=render :partial => 'layouts/base_footer'%> <%=render :partial => 'layouts/base_footer'%>
</div> </div>
<div id="ajax-indicator" style="display:none;"> <div id="ajax-indicator" style="display:none;">
<span><%= l(:label_loading) %></span> <span><%= l(:label_loading) %></span>
</div> </div>
<div id="ajax-modal" style="display:none;"></div> <div id="ajax-modal" style="display:none;"></div>
</div> </div>
</div> </div>