myexperiment-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myexperiment-hackers] [2263] trunk/app/controllers: Fix for commenting


From: noreply
Subject: [myexperiment-hackers] [2263] trunk/app/controllers: Fix for commenting when javascript is turned off.
Date: Thu, 20 Aug 2009 11:28:42 -0400 (EDT)

Revision
2263
Author
dtm
Date
2009-08-20 11:28:41 -0400 (Thu, 20 Aug 2009)

Log Message

Fix for commenting when _javascript_ is turned off.

Modified Paths

Diff

Modified: trunk/app/controllers/blobs_controller.rb (2262 => 2263)


--- trunk/app/controllers/blobs_controller.rb	2009-08-13 11:04:05 UTC (rev 2262)
+++ trunk/app/controllers/blobs_controller.rb	2009-08-20 15:28:41 UTC (rev 2263)
@@ -195,14 +195,24 @@
   # POST /files/1;comment
   def comment 
     text = params[:comment][:comment]
+    ajaxy = true
     
+    if text.nil? or (text.length == 0)
+      text = params[:comment_0_comment_editor]
+      ajaxy = false
+    end
+
     if text and text.length > 0
       comment = Comment.create(:user => current_user, :comment => text)
       @blob.comments << comment
     end
     
     respond_to do |format|
-      format.html { render :partial => "comments/comments", :locals => { :commentable => @blob } }
+      if ajaxy
+        format.html { render :partial => "comments/comments", :locals => { :commentable => @blob } }
+      else
+        format.html { redirect_to file_url(@blob) }
+      end
     end
   end
   

Modified: trunk/app/controllers/networks_controller.rb (2262 => 2263)


--- trunk/app/controllers/networks_controller.rb	2009-08-13 11:04:05 UTC (rev 2262)
+++ trunk/app/controllers/networks_controller.rb	2009-08-20 15:28:41 UTC (rev 2263)
@@ -298,14 +298,24 @@
   # POST /networks/1;comment
   def comment
     text = params[:comment][:comment]
+    ajaxy = true
     
+    if text.nil? or (text.length == 0)
+      text = params[:comment_0_comment_editor]
+      ajaxy = false
+    end
+    
     if text and text.length > 0
       comment = Comment.create(:user => current_user, :comment => text)
       @network.comments << comment
     end
     
     respond_to do |format|
-      format.html { render :partial => "comments/comments", :locals => { :commentable => @network } }
+      if ajaxy
+        format.html { render :partial => "comments/comments", :locals => { :commentable => @network } }
+      else
+        format.html { redirect_to group_url(@network) }
+      end
     end
   end
   

Modified: trunk/app/controllers/packs_controller.rb (2262 => 2263)


--- trunk/app/controllers/packs_controller.rb	2009-08-13 11:04:05 UTC (rev 2262)
+++ trunk/app/controllers/packs_controller.rb	2009-08-20 15:28:41 UTC (rev 2263)
@@ -187,14 +187,24 @@
   # POST /packs/1;comment
   def comment 
     text = params[:comment][:comment]
+    ajaxy = true
     
+    if text.nil? or (text.length == 0)
+      text = params[:comment_0_comment_editor]
+      ajaxy = false
+    end
+
     if text and text.length > 0
       comment = Comment.create(:user => current_user, :comment => text)
       @pack.comments << comment
     end
     
     respond_to do |format|
-      format.html { render :partial => "comments/comments", :locals => { :commentable => @pack } }
+      if ajaxy
+        format.html { render :partial => "comments/comments", :locals => { :commentable => @pack } }
+      else
+        format.html { redirect_to pack_url(@pack) }
+      end
     end
   end
   

Modified: trunk/app/controllers/workflows_controller.rb (2262 => 2263)


--- trunk/app/controllers/workflows_controller.rb	2009-08-13 11:04:05 UTC (rev 2262)
+++ trunk/app/controllers/workflows_controller.rb	2009-08-20 15:28:41 UTC (rev 2263)
@@ -65,6 +65,12 @@
   # POST /workflows/1;comment
   def comment
     text = params[:comment][:comment]
+    ajaxy = true
+
+    if text.nil? or (text.length == 0)
+      text = params[:comment_0_comment_editor]
+      ajaxy = false
+    end
     
     if text and text.length > 0
       comment = Comment.create(:user => current_user, :comment => text)
@@ -72,7 +78,11 @@
     end
   
     respond_to do |format|
-      format.html { render :partial => "comments/comments", :locals => { :commentable => @workflow } }
+      if ajaxy
+        format.html { render :partial => "comments/comments", :locals => { :commentable => @workflow } }
+      else
+        format.html { redirect_to workflow_url(@workflow) }
+      end
     end
   end
   

reply via email to

[Prev in Thread] Current Thread [Next in Thread]