incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject svn commit: r1160543 - in /incubator/deltacloud/trunk/server: lib/deltacloud/helpers/application_helper.rb server.rb views/buckets/show.html.haml
Date Tue, 23 Aug 2011 04:41:03 GMT
Author: lutter
Date: Tue Aug 23 04:41:03 2011
New Revision: 1160543

URL: http://svn.apache.org/viewvc?rev=1160543&view=rev
Log:
Restores explicit route for getting the 'new_blob' form.

A naming clash with GET /api/buckets/:bucket/:blob meant that the
'new_blob' operation under buckets collection was never triggered.

Signed-off-by: marios <marios@redhat.com>

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb
    incubator/deltacloud/trunk/server/server.rb
    incubator/deltacloud/trunk/server/views/buckets/show.html.haml

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb?rev=1160543&r1=1160542&r2=1160543&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb Tue Aug
23 04:41:03 2011
@@ -285,4 +285,7 @@ module ApplicationHelper
     end
   end
 
+  def new_blob_form_url(bucket)
+    bucket_url(@bucket.name) + "/" + NEW_BLOB_FORM_ID
+  end
 end

Modified: incubator/deltacloud/trunk/server/server.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/server.rb?rev=1160543&r1=1160542&r2=1160543&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/server.rb (original)
+++ incubator/deltacloud/trunk/server/server.rb Tue Aug 23 04:41:03 2011
@@ -786,6 +786,21 @@ put "#{Sinatra::UrlForHelper::DEFAULT_UR
   end
 end
 
+#get html form for creating a new blob
+
+# The URL for getting the new blob form for the HTML UI looks like the URL
+# for getting the details of an existing blob. To make collisions less
+# likely, we use a name for the form that will rarely be the name of an
+# existing blob
+NEW_BLOB_FORM_ID = "new_blob_form_d15cfd90"
+
+get "#{Sinatra::UrlForHelper::DEFAULT_URI_PREFIX}/buckets/:bucket/#{NEW_BLOB_FORM_ID}" do
+  @bucket_id = params[:bucket]
+  respond_to do |format|
+    format.html {haml :"blobs/new"}
+  end
+end
+
 #create a new blob using html interface - NON STREAMING (i.e. browser POST http form data)
 post "#{Sinatra::UrlForHelper::DEFAULT_URI_PREFIX}/buckets/:bucket" do
   bucket_id = params[:bucket]
@@ -897,16 +912,6 @@ collection :buckets do
     end
   end
 
-  operation :new_bucket, :form => true, :method => :get, :member => true do
-    param :bucket,  :string
-    control do
-      @bucket_id = params[:bucket]
-      respond_to do |format|
-        format.html {haml :"blobs/new"}
-      end
-    end
-  end
-
   operation :index do
     description "List buckets associated with this account"
     with_capability :buckets

Modified: incubator/deltacloud/trunk/server/views/buckets/show.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/buckets/show.html.haml?rev=1160543&r1=1160542&r2=1160543&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/buckets/show.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/buckets/show.html.haml Tue Aug 23 04:41:03 2011
@@ -19,5 +19,5 @@
     %li{ :'data-role' => 'list-divider'} Actions
     %li
       %div{ :'data-role' => 'controlgroup', :'data-type' => "horizontal" }
-        %a{ :href => bucket_url(@bucket.name) + "/new_blob", :'data-role' => "button",
:'data-ajax' => 'false'} Create a new blob
+        %a{ :href => new_blob_form_url(@bucket), :'data-role' => "button", :'data-ajax'
=> 'false'} Create a new blob
         =link_to_action 'Delete bucket', destroy_bucket_url(@bucket.name), :delete



Mime
View raw message