public
Description: Tog Platform Social Component
Home | Edit | New

Showing friends, followers or followings in a portlet

Given the partial:


<div class="portlet <%= style || 'portletA' %>" id="portlet_friends">
  <h2><span><%= title %> (<%=  items.size %>)</span></h2>
  <div class="portlet_content">
      <ul class="clearfix">
        <% unless items.blank? %>
          <% for item in items %>
            <li><%= link_to icon_for_profile(item, 'small'), profile_path(item),
 :title => item.full_name %></li>
          <% end %>
        <% else %>
          <li><%= no_items %></li>
        <% end %>
      </ul>
  </div>    
</div>

you can show a list of it’s related users with:

List of friends


<%= render :partial => "shared/profiles_portlet", :locals => { 
  :items =>  @profile.friends, 
  :style => :portletG, 
  :title => "Friends", 
  :no_items => "#{@profile.full_name} has 0 friends." } %>

List of followers


<%= render :partial => "shared/profiles_portlet", :locals => { 
  :items =>  @profile.followers, 
  :style => :portletG, 
  :title => "Followers", 
  :no_items => "#{@profile.full_name} has 0 followers." } %>

List of followings


<%= render :partial => "shared/profiles_portlet", :locals => { 
  :items =>  @profile.followings, 
  :style => :portletG, 
  :title => "Fans", 
  :no_items => "#{@profile.full_name} has 0 fans." } %>
Last edited by molpe, Tue Sep 09 04:08:26 -0700 2008
Home | Edit | New
Versions: