incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1039381 - in /incubator/deltacloud/trunk/server: lib/deltacloud/helpers/ public/javascripts/ public/stylesheets/compiled/ views/buckets/ views/instances/ views/keys/ views/load_balancers/
Date Fri, 26 Nov 2010 14:35:44 GMT
Author: mfojtik
Date: Fri Nov 26 14:35:43 2010
New Revision: 1039381

URL: http://svn.apache.org/viewvc?rev=1039381&view=rev
Log:
Removed Javascript helper for calling DELETE and POST requests since Sinatra can handle this
itself using method overide. (thx. Marios)

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb
    incubator/deltacloud/trunk/server/public/javascripts/application.js
    incubator/deltacloud/trunk/server/public/stylesheets/compiled/application.css
    incubator/deltacloud/trunk/server/views/buckets/index.html.haml
    incubator/deltacloud/trunk/server/views/buckets/show.html.haml
    incubator/deltacloud/trunk/server/views/instances/index.html.haml
    incubator/deltacloud/trunk/server/views/instances/show.html.haml
    incubator/deltacloud/trunk/server/views/keys/index.html.haml
    incubator/deltacloud/trunk/server/views/load_balancers/index.html.haml
    incubator/deltacloud/trunk/server/views/load_balancers/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=1039381&r1=1039380&r2=1039381&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/helpers/application_helper.rb Fri Nov
26 14:35:43 2010
@@ -130,4 +130,16 @@ module ApplicationHelper
     "<pem><![CDATA[#{text.strip}]]></pem>"
   end
 
+  def link_to_action(action, url, method)
+    return link_to(action, url) if method.eql? :get
+    capture_haml do
+      haml_tag :form, :method => :post, :action => url, :class => :link do
+        haml_tag :input, :type => :hidden, :name => '_method', :value => method
+        haml_tag :button, :type => :submit do 
+          haml_concat action
+        end
+      end
+    end
+  end
+
 end

Modified: incubator/deltacloud/trunk/server/public/javascripts/application.js
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/public/javascripts/application.js?rev=1039381&r1=1039380&r2=1039381&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/public/javascripts/application.js (original)
+++ incubator/deltacloud/trunk/server/public/javascripts/application.js Fri Nov 26 14:35:43
2010
@@ -3,32 +3,6 @@
 
 $(document).ready(function() {
 
-  $("a.delete").click(function(e) {
-    var original_url = $(this).attr('href')
-    $.ajax({
-      url : original_url,
-      type : 'DELETE',
-      cache : false,
-      success: function(data) {
-        window.location = original_url.replace(/\/([\w_-]+)$/i, '')
-      }
-    })
-    return false;
-  })
-
-  $("a.post").click(function(e) {
-    var original_url = $(this).attr('href')
-    $.ajax({
-      url : original_url,
-      type : 'POST',
-      dataType : 'xml',
-      success: function(data) {
-        window.location = original_url.replace(/\/([\w_-]+)$/i, '')
-      }
-    })
-    return false;
-  })
-
   if ($('select#list_instances').length) {
     $('select#list_instances').html("<option>Loading instances...</option>");
     $.getJSON("/api/instances?state=RUNNING&format=json",

Modified: incubator/deltacloud/trunk/server/public/stylesheets/compiled/application.css
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/public/stylesheets/compiled/application.css?rev=1039381&r1=1039380&r2=1039381&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/public/stylesheets/compiled/application.css (original)
+++ incubator/deltacloud/trunk/server/public/stylesheets/compiled/application.css Fri Nov
26 14:35:43 2010
@@ -611,3 +611,5 @@ input[type='radio'] {
 table.docs { border : 1px solid #ccc }
 table.docs td { border : 1px solid #ccc }
 table.docs table td { border : none }
+
+td form.link { display : inline }

Modified: incubator/deltacloud/trunk/server/views/buckets/index.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/buckets/index.html.haml?rev=1039381&r1=1039380&r2=1039381&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/buckets/index.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/buckets/index.html.haml Fri Nov 26 14:35:43 2010
@@ -30,4 +30,4 @@
           -bucket.blob_list.each do |blob|
             = blob
         %td
-          =link_to 'Delete', destroy_bucket_url(bucket.name), :class => 'delete'
+          =link_to_action 'Delete', destroy_bucket_url(bucket.name), :delete

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=1039381&r1=1039380&r2=1039381&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/buckets/show.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/buckets/show.html.haml Fri Nov 26 14:35:43 2010
@@ -16,7 +16,7 @@
         = link_to blob, bucket_url(@bucket.name) + '/' + blob
     %dt Delete bucket (must be empty)
     %dd
-      =link_to 'Delete', destroy_bucket_url(@bucket.name), :class => 'delete'
     %dt Create a new blob
     %dd
-      =link_to 'Create Blob', bucket_url(@bucket.name) + '/new_blob'
\ No newline at end of file
+      =link_to 'Create Blob', bucket_url(@bucket.name) + '/new_blob'
+      =link_to_action 'Delete', destroy_bucket_url(@bucket.name), :delete

Modified: incubator/deltacloud/trunk/server/views/instances/index.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/instances/index.html.haml?rev=1039381&r1=1039380&r2=1039381&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/instances/index.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/instances/index.html.haml Fri Nov 26 14:35:43
2010
@@ -27,4 +27,4 @@
           = instance.state
         %td
           -instance.actions.each do |action|
-            =link_to action, self.send(:"#{action}_instance_url", instance.id), :class =>
instance_action_method(action)
+            =link_to_action action, self.send(:"#{action}_instance_url", instance.id), instance_action_method(action)

Modified: incubator/deltacloud/trunk/server/views/instances/show.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/instances/show.html.haml?rev=1039381&r1=1039380&r2=1039381&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/instances/show.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/instances/show.html.haml Fri Nov 26 14:35:43 2010
@@ -40,4 +40,4 @@
     %dt
     %dd
       -@instance.actions.each do |action|
-        =link_to action, self.send(:"#{action}_instance_url", @instance.id), :class =>
instance_action_method(action)
+        =link_to_action action, self.send(:"#{action}_instance_url", @instance.id), instance_action_method(action)

Modified: incubator/deltacloud/trunk/server/views/keys/index.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/keys/index.html.haml?rev=1039381&r1=1039380&r2=1039381&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/keys/index.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/keys/index.html.haml Fri Nov 26 14:35:43 2010
@@ -18,7 +18,7 @@
             = "#{key.username} - #{key.password}"
         %td
           - if driver.respond_to?(:destroy_key)
-            =link_to 'Destroy', destroy_key_url(key.id), :class => 'delete'
+            =link_to_action 'Destroy', destroy_key_url(key.id), :delete
   %tfoot
     - if driver.respond_to?(:create_key)
       %tr

Modified: incubator/deltacloud/trunk/server/views/load_balancers/index.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/load_balancers/index.html.haml?rev=1039381&r1=1039380&r2=1039381&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/load_balancers/index.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/load_balancers/index.html.haml Fri Nov 26 14:35:43
2010
@@ -25,7 +25,7 @@
           - balancer.listeners.each do |listener|
             ="#{listener.protocol}[#{listener.load_balancer_port}]<br/>"
         %td
-          =link_to 'Destroy', destroy_load_balancer_url(balancer.id), :class => 'delete'
+          =link_to_action 'Destroy', destroy_load_balancer_url(balancer.id), :delete
   %tfoot
     %tr
       %td{:colspan => 6, :style => "text-align:right;"}

Modified: incubator/deltacloud/trunk/server/views/load_balancers/show.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/load_balancers/show.html.haml?rev=1039381&r1=1039380&r2=1039381&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/load_balancers/show.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/load_balancers/show.html.haml Fri Nov 26 14:35:43
2010
@@ -25,7 +25,7 @@
       - @load_balancer.instances.each do |inst|
         %dd
           =inst.id
-          %a{:class => :post, :href => unregister_load_balancer_url(@load_balancer.id,
:instance_id => inst.id)} Delete
+          =link_to_action, 'Delete', unregister_load_balancer_url(@load_balancer.id, :instance_id
=> inst.id), :post
 
 %form{:action => url_for("/api/load_balancers/#{@load_balancer.id}/register"), :method
=> :post}
   %p



Mime
View raw message