Skip to content

Instantly share code, notes, and snippets.

@jenaiz
Created November 27, 2008 11:12
Show Gist options
  • Save jenaiz/29725 to your computer and use it in GitHub Desktop.
Save jenaiz/29725 to your computer and use it in GitHub Desktop.
personal implementation of tog public continium method
def public_continuum(size = 40)
puts '***************************************************************'
if current_user.profile.friends != nil
friends = current_user.profile.friends.collect{|a| a.user_id}
Activity.find(:all, :conditions => {:action => ['membership', 'group'], :user_id => friends}, :limit=> size,
:order => " created_at DESC").collect{|a|
content_tag :span, :class => "clearfix" + cycle(nil, " pair") do
profile = content_tag :div, :class => "image" do
link_to icon_for_profile(a.user.profile, 'tiny'), profile_path(a.user.profile)
end
if a.action == 'membership'
puts '*************************************************************** dentro if'
membership = Membership.find_by_id(a.item_id)
text = content_tag :div, :class => "text" do
" #{link_to(a.user.profile.full_name, profile_path(a.user.profile))} " +
" se ha unido a la comunidad: #{link_to(membership.group.name, group_path(membership.group))}"
end
elsif a.action == 'group'
group = Group.find_by_id(a.item_id)
text = content_tag :div, :class => "text" do
" #{link_to(a.user.profile.full_name, profile_path(a.user.profile))} " +
" ha creado la comunidad: #{link_to(group.name, group_path(group))}"
end
end
profile + text
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment