<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -16,7 +16,6 @@ class PeopleController &lt; ApplicationController
 
   def show
     @person = Person.find(params[:id])
-    @memberships = Membership.find(:all, :conditions =&gt; [&quot;person_id = ?&quot;, @person.id])
     
     @person_tips = Tip.find(:all, :limit =&gt; 3, :order =&gt; &quot;id desc&quot;, :conditions =&gt; &quot;person_id = &quot; + @person.id.to_s + &quot; and is_anon = false&quot;)
     @number_of_tips = Tip.count(:conditions =&gt; &quot;person_id = &quot; + @person.id.to_s + &quot; and is_anon = false&quot;)
@@ -25,7 +24,6 @@ class PeopleController &lt; ApplicationController
 	def show_by_login
 		@person = Person.find_by_login(params[:login])
 		unless @person.nil?
-			@memberships = Membership.find(:all, :conditions =&gt; [&quot;person_id = ?&quot;, @person.id])
 			
 			@person_tips = Tip.find(:all, :limit =&gt; 3, :order =&gt; &quot;id desc&quot;, :conditions =&gt; &quot;person_id = &quot; + @person.id.to_s + &quot; and is_anon = false&quot;)
 			@number_of_tips = Tip.count(:conditions =&gt; &quot;person_id = &quot; + @person.id.to_s + &quot; and is_anon = false&quot;)</diff>
      <filename>app/controllers/people_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -16,9 +16,6 @@ class TeamsController &lt; ApplicationController
   end
 
   def show
-    @memberships = @team.memberships
-    @invitations = Invitation.find(:all, :conditions =&gt; [ &quot;team_id = ? and accepted = 0&quot; , @team.id ])
-    @lists = List.find(:all, :conditions =&gt; [ &quot;team_id = ?&quot;, @team.id ], :order =&gt; &quot;name ASC&quot;)
   end
 
   def new</diff>
      <filename>app/controllers/teams_controller.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,4 +3,6 @@ class Invitation &lt; ActiveRecord::Base
 	belongs_to(:person) # people can invite other people ...
 	belongs_to(:team) # ... into teams
 	
+	named_scope :unaccepted, :conditions =&gt; {:accepted =&gt; false}
+	
 end</diff>
      <filename>app/models/invitation.rb</filename>
    </modified>
    <modified>
      <diff>@@ -51,16 +51,12 @@
           &lt;tr&gt;
             &lt;th&gt;Teams:&lt;/th&gt;
             &lt;td&gt;
-              &lt;table&gt;
-                &lt;% for membership in @memberships %&gt;
-                  &lt;tr&gt;
-                    &lt;td&gt;&lt;%= link_to_team(membership.team, 'picturelink') %&gt;&lt;/td&gt;
-                    &lt;td&gt;
-                      &lt;%= membership.confirmed? ? '&amp;nbsp;' : ' (awaiting confirmation)' %&gt;
-                    &lt;/td&gt;
-                  &lt;/tr&gt;
-                &lt;% end %&gt;
-              &lt;/table&gt;
+              &lt;% @person.memberships.each do |membership| -%&gt;
+                &lt;p&gt;
+                  &lt;%= link_to_team(membership.team, 'picturelink') %&gt;
+                  &lt;%= ' (awaiting confirmation)' unless membership.confirmed? %&gt;
+                &lt;/p&gt;
+              &lt;% end -%&gt;
             &lt;/td&gt;
           &lt;/tr&gt;
 </diff>
      <filename>app/views/people/show.rhtml</filename>
    </modified>
    <modified>
      <diff>@@ -41,7 +41,7 @@
   &lt;tr&gt;
     &lt;th&gt;Team Members:&lt;/th&gt;
     &lt;td&gt;
-      &lt;% @memberships.each do |membership| -%&gt;
+      &lt;% @team.memberships.each do |membership| -%&gt;
         &lt;p&gt;
           &lt;%= link_to_person(membership.person, 'picturelink') %&gt;
           &lt;%= ' (awaiting confirmation)' unless membership.confirmed? %&gt;
@@ -52,11 +52,12 @@
 
   &lt;% if controller.logged_in? &amp;&amp; @team.member?(session[:person]) -%&gt;
   
-    &lt;% if @invitations.any? -%&gt;
+    &lt;% invitations = @team.invitations.unaccepted -%&gt;
+    &lt;% if invitations.any? -%&gt;
       &lt;tr&gt;
         &lt;th&gt;Invitations:&lt;/th&gt;
         &lt;td&gt;
-          &lt;% @invitations.each do |invitation| -%&gt;
+          &lt;% invitations.each do |invitation| -%&gt;
             &lt;p&gt;
               &lt;%= invitation.email %&gt;
               &lt;%= link_to(image_tag('envelope.jpg', :size =&gt; '17x11', :alt =&gt; 'Send a reminder email?', :title =&gt; 'Send a reminder email?'), { :controller =&gt; 'invitations', :action =&gt; 'remind', :id =&gt; invitation.code }, :confirm =&gt; 'Would you like to send this person a reminder email?') %&gt;
@@ -69,29 +70,18 @@
     &lt;tr&gt;
       &lt;th&gt;Lists:&lt;/th&gt;
       &lt;td&gt;
-        &lt;table&gt;
-          &lt;tr&gt;&lt;td colspan='2'&gt;&lt;%= link_to('Create new list ...', {:controller=&gt;'lists', :action=&gt;'new', :team=&gt;@team.id}, 'class'=&gt;'picturelink list_add') %&gt;&lt;/td&gt;&lt;/tr&gt;
-
-
-          &lt;% if @lists.empty? %&gt;
-            &lt;tr&gt;&lt;td colspan='2'&gt;This team currently has no lists.&lt;/td&gt;&lt;/tr
-          &lt;% else %&gt;
+        &lt;p&gt;&lt;%= link_to('Create new list ...', {:controller=&gt;'lists', :action=&gt;'new', :team=&gt;@team.id}, 'class'=&gt;'picturelink list_add') %&gt;&lt;/p&gt;
 
-            &lt;tr&gt;
-              &lt;% row_counter = 0 %&gt;
+        &lt;% lists = @team.lists -%&gt;
 
-              &lt;% for list in @lists %&gt;
-                &lt;td&gt;&lt;%= link_to_list(list, 'picturelink') %&gt; &amp;nbsp;&amp;nbsp;&lt;/td&gt;
-                &lt;% row_counter += 1 %&gt;
-                &lt;% if row_counter == 2 %&gt;
-                &lt;/tr&gt;&lt;tr&gt;
-                  &lt;% row_counter = 0 %&gt;
-                &lt;% end %&gt;
-              &lt;% end %&gt;
-            &lt;/tr&gt;
-          &lt;% end %&gt;
-
-        &lt;/table&gt;
+        &lt;% if lists.empty? %&gt;
+          &lt;p&gt;This team currently has no lists.&lt;/p&gt;
+        &lt;% else %&gt;
+          &lt;% lists.each do |list| -%&gt;
+            &lt;p&gt;&lt;%= link_to_list(list, 'picturelink') %&gt;&lt;/p&gt;
+          &lt;% end -%&gt;
+        &lt;% end -%&gt;
+        
       &lt;/td&gt;
     &lt;/tr&gt;
 </diff>
      <filename>app/views/teams/show.rhtml</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>70a6a390ef5dabfdacf940095cd46073b4f526cf</id>
    </parent>
  </parents>
  <author>
    <name>Aimee Daniells</name>
    <email>aimee@edendevelopment.co.uk</email>
  </author>
  <url>http://github.com/sermoa/mychores/commit/cd57ddc9da0e72ed69793bc64a5670860d1b4fd4</url>
  <id>cd57ddc9da0e72ed69793bc64a5670860d1b4fd4</id>
  <committed-date>2009-04-18T15:27:54-07:00</committed-date>
  <authored-date>2009-04-18T15:27:54-07:00</authored-date>
  <message>Refactored the fetching and displaying of members and lists.</message>
  <tree>0c60d71ca2a22693594def01f502b5a327804701</tree>
  <committer>
    <name>Aimee Daniells</name>
    <email>aimee@edendevelopment.co.uk</email>
  </committer>
</commit>
