public
Description: Canberra Ruby Crew Site #crc
Homepage: http://canberraruby.com
Clone URL: git://github.com/artpop/crc_site.git
added some ajax goodness to the meetings show page. its still ugly but its a 
start
schlick (author)
Fri Oct 24 07:22:56 -0700 2008
commit  73b80e3578ae1f2a203dfec41478e1f3a96b49f0
tree    1e6b583ca318e237d2173641ba5ff7028b7f5bb5
parent  f10022b0044347b59ccff24bee6e132d3cae3168
...
1
 
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
...
38
39
40
41
42
43
44
45
46
47
48
49
 
 
 
50
51
52
 
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
 
 
 
 
 
71
72
73
74
75
76
77
78
79
80
81
82
83
 
84
85
...
1
2
3
 
4
5
 
 
 
 
 
6
7
8
 
9
10
 
 
 
 
 
11
12
13
 
14
15
 
 
 
 
 
16
17
18
...
21
22
23
 
24
25
 
26
27
28
 
 
29
30
31
32
 
 
33
34
35
36
37
38
 
39
40
 
 
 
 
 
 
 
 
 
 
41
42
43
44
45
46
47
48
49
 
50
51
52
 
 
 
 
 
53
54
55
0
@@ -1,35 +1,18 @@
0
 class TopicsController < ApplicationController
0
+  
0
   # GET /topics
0
-  # GET /topics.xml
0
   def index
0
     @topics = Topic.find(:all)
0
-
0
-    respond_to do |format|
0
-      format.html # index.html.erb
0
-      format.xml  { render :xml => @topics }
0
-    end
0
   end
0
 
0
   # GET /topics/1
0
-  # GET /topics/1.xml
0
   def show
0
     @topic = Topic.find(params[:id])
0
-
0
-    respond_to do |format|
0
-      format.html # show.html.erb
0
-      format.xml  { render :xml => @topic }
0
-    end
0
   end
0
 
0
   # GET /topics/new
0
-  # GET /topics/new.xml
0
   def new
0
     @topic = Topic.new
0
-
0
-    respond_to do |format|
0
-      format.html # new.html.erb
0
-      format.xml  { render :xml => @topic }
0
-    end
0
   end
0
 
0
   # GET /topics/1/edit
0
@@ -38,48 +21,35 @@ class TopicsController < ApplicationController
0
   end
0
 
0
   # POST /topics
0
-  # POST /topics.xml
0
   def create
0
     @topic = Topic.new(params[:topic])
0
-
0
     respond_to do |format|
0
       if @topic.save
0
         flash[:notice] = 'Topic was successfully created.'
0
-        format.html { redirect_to(@topic) }
0
-        format.xml  { render :xml => @topic, :status => :created, :location => @topic }
0
+        # redirect_to(@topic)
0
+        format.html { redirect_to meeting_path(@topic.meeting_id) }
0
+        format.js
0
       else
0
-        format.html { render :action => "new" }
0
-        format.xml  { render :xml => @topic.errors, :status => :unprocessable_entity }
0
+        render :action => "new"
0
       end
0
     end
0
   end
0
 
0
   # PUT /topics/1
0
-  # PUT /topics/1.xml
0
   def update
0
     @topic = Topic.find(params[:id])
0
-
0
-    respond_to do |format|
0
-      if @topic.update_attributes(params[:topic])
0
-        flash[:notice] = 'Topic was successfully updated.'
0
-        format.html { redirect_to(@topic) }
0
-        format.xml  { head :ok }
0
-      else
0
-        format.html { render :action => "edit" }
0
-        format.xml  { render :xml => @topic.errors, :status => :unprocessable_entity }
0
-      end
0
+    if @topic.update_attributes(params[:topic])
0
+      flash[:notice] = 'Topic was successfully updated.'
0
+      redirect_to(@topic)
0
+    else
0
+      render :action => "edit"
0
     end
0
   end
0
 
0
   # DELETE /topics/1
0
-  # DELETE /topics/1.xml
0
   def destroy
0
     @topic = Topic.find(params[:id])
0
     @topic.destroy
0
-
0
-    respond_to do |format|
0
-      format.html { redirect_to(topics_url) }
0
-      format.xml  { head :ok }
0
-    end
0
+    redirect_to(topics_url)
0
   end
0
 end
...
 
 
1
2
3
...
9
10
11
12
13
14
15
16
 
 
17
18
19
...
26
27
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
...
1
2
3
4
5
...
11
12
13
 
 
 
 
 
14
15
16
17
18
...
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
0
@@ -1,3 +1,5 @@
0
+= flash[:notice]
0
+
0
 %p
0
   %strong Date:
0
   =h @meeting.date
0
@@ -9,11 +11,8 @@
0
 %p
0
   %strong Topics:
0
 %ul
0
-  - for topic in @meeting.topics
0
-    %li
0
-      = link_to topic.title, topic.link
0
-      \-
0
-      = topic.description
0
+
0
+= link_to 'Create new topic', new_topic_path
0
 
0
 %p
0
   %strong Attendees:
0
@@ -26,3 +25,43 @@
0
 = link_to 'Edit', edit_meeting_path(@meeting)
0
 |
0
 = link_to 'Back', meetings_path
0
+
0
+%ul#topic_list
0
+  = render :partial => 'topic', :collection => Topic.all
0
+
0
+%a#new_topic Add new topic
0
+:javascript
0
+  $(document).ready(function(){
0
+    $("#add_topic").hide();    
0
+    $("a#new_topic").toggle(function(){
0
+      $("#add_topic").show('slow');
0
+    },function(){
0
+      $("#add_topic").hide('slow');
0
+    });
0
+  });
0
+
0
+#add_topic
0
+  %h1 Editing topic
0
+
0
+  - form_remote_for :topic, :url => topics_path, :html => { :id => 'topic_form' } do |f|
0
+    = f.error_messages
0
+
0
+    %p
0
+      = f.label :title
0
+      %br
0
+      = f.text_field :title
0
+
0
+    %p
0
+      = f.label :description
0
+      %br
0
+      = f.text_area :description
0
+
0
+    %p
0
+      = f.label :link
0
+      %br
0
+      = f.text_field :link
0
+
0
+    = f.hidden_field :meeting_id, :value => @meeting.id
0
+
0
+    %p
0
+      = f.submit "Update"
0
\ No newline at end of file

Comments