Return-Path: Delivered-To: apmail-incubator-deltacloud-commits-archive@minotaur.apache.org Received: (qmail 82476 invoked from network); 26 Nov 2010 14:37:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 26 Nov 2010 14:37:17 -0000 Received: (qmail 49870 invoked by uid 500); 26 Nov 2010 14:37:17 -0000 Delivered-To: apmail-incubator-deltacloud-commits-archive@incubator.apache.org Received: (qmail 49845 invoked by uid 500); 26 Nov 2010 14:37:17 -0000 Mailing-List: contact deltacloud-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-commits@incubator.apache.org Received: (qmail 49838 invoked by uid 99); 26 Nov 2010 14:37:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Nov 2010 14:37:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Nov 2010 14:37:15 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5060923888E7; Fri, 26 Nov 2010 14:35:44 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: deltacloud-commits@incubator.apache.org From: mfojtik@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101126143544.5060923888E7@eris.apache.org> 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 "" 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(""); $.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}]
" %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