public
Description: Canberra Ruby Crew Site #crc
Homepage: http://canberraruby.com
Clone URL: git://github.com/artpop/crc_site.git
added attendees on show and form views along with gravatars
schlick (author)
Wed Oct 22 05:05:24 -0700 2008
commit  d09b1b63fb9c1eefd41963b0436772d9dde61ab4
tree    af27012116f1e54c3711ce0716d7472e31f67304
parent  cad924776c13ab9fa6d744a441b088969ffaee6f
...
36
37
38
 
39
40
41
...
36
37
38
39
40
41
42
0
@@ -36,6 +36,7 @@ class MeetingsController < ApplicationController
0
 
0
   # PUT /meetings/1
0
   def update
0
+    params[:meeting][:attendee_ids] ||= []
0
     @meeting = Meeting.find(params[:id])
0
     if @meeting.update_attributes(params[:meeting])
0
       flash[:notice] = 'Meeting was successfully updated.'
...
9
10
11
12
 
13
14
15
...
9
10
11
 
12
13
14
15
0
@@ -9,7 +9,7 @@ class Meeting < ActiveRecord::Base
0
   named_scope :past, :conditions => ['date < ?', Date.today], :order => 'date DESC'
0
   
0
   has_many    :attendances,  :dependent => :destroy
0
-  has_many    :attendees,    :through => :attendances, :source => :person
0
+  has_many    :attendees,    :through => :attendances, :order => :name, :source => :person
0
 
0
   validates_presence_of :date
0
   validates_presence_of :venue
...
22
23
24
 
 
 
 
 
 
25
26
27
...
22
23
24
25
26
27
28
29
30
31
32
33
0
@@ -22,5 +22,11 @@
0
     = f.label :venue
0
     %br
0
     = f.text_field :venue
0
+  %h4 Attendees
0
+  %ul{ :style => 'list-style:none; padding-left: 0'}
0
+    - for person in Person.all
0
+      %li
0
+        = check_box_tag "meeting[attendee_ids][]", person.id, @meeting.attendees.include?(person)
0
+        = person.name
0
   %p
0
     = f.submit "Save"
0
\ No newline at end of file
...
6
7
8
 
 
 
 
 
 
 
 
9
10
11
...
6
7
8
9
10
11
12
13
14
15
16
17
18
19
0
@@ -6,6 +6,14 @@
0
   %strong Venue:
0
   =h @meeting.venue
0
 
0
+%p
0
+  %strong Attendees:
0
+%ul{ :style => 'list-style:none; padding-left: 0' }
0
+  - for person in @meeting.attendees
0
+    %li.peep
0
+      = image_tag(person.gravatar_url(:size => 32), :alt => person.name, :valign => 'middle')
0
+      = person.name
0
+      
0
 = link_to 'Edit', edit_meeting_path(@meeting)
0
 |
0
 = link_to 'Back', meetings_path

Comments