You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@deltacloud.apache.org by lu...@apache.org on 2010/07/09 01:47:01 UTC
svn commit: r962334 - in /incubator/deltacloud/trunk/server:
public/javascripts/application.js views/instances/index.html.haml
views/instances/show.html.haml views/layout.html.haml
Author: lutter
Date: Thu Jul 8 23:47:00 2010
New Revision: 962334
URL: http://svn.apache.org/viewvc?rev=962334&view=rev
Log:
Added JQuery wrapper for POST and DELETE actions
Modified:
incubator/deltacloud/trunk/server/public/javascripts/application.js
incubator/deltacloud/trunk/server/views/instances/index.html.haml
incubator/deltacloud/trunk/server/views/instances/show.html.haml
incubator/deltacloud/trunk/server/views/layout.html.haml
Modified: incubator/deltacloud/trunk/server/public/javascripts/application.js
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/public/javascripts/application.js?rev=962334&r1=962333&r2=962334&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/public/javascripts/application.js (original)
+++ incubator/deltacloud/trunk/server/public/javascripts/application.js Thu Jul 8 23:47:00 2010
@@ -1,2 +1,32 @@
// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
+
+$(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;
+ })
+
+})
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=962334&r1=962333&r2=962334&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/instances/index.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/instances/index.html.haml Thu Jul 8 23:47:00 2010
@@ -26,4 +26,5 @@
%td
= instance.state
%td
- = instance.actions.collect { |a| link_to(a, self.send("#{a}_instance_url", instance.id), :method => :post)}.join(' ')
+ -instance.actions.each do |action|
+ =link_to action, self.send(:"#{action}_instance_url", instance.id), :class => 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=962334&r1=962333&r2=962334&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/instances/show.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/instances/show.html.haml Thu Jul 8 23:47:00 2010
@@ -39,4 +39,5 @@
%di
%dt
%dd
- = @instance.actions.collect { |action| link_to(action, "/api/instances/#{@instance.id}/#{action}") }.join(" ")
+ -@instance.actions.each do |action|
+ =link_to action, self.send(:"#{action}_instance_url", @instance.id), :class => instance_action_method(action)
Modified: incubator/deltacloud/trunk/server/views/layout.html.haml
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/views/layout.html.haml?rev=962334&r1=962333&r2=962334&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/views/layout.html.haml (original)
+++ incubator/deltacloud/trunk/server/views/layout.html.haml Thu Jul 8 23:47:00 2010
@@ -8,6 +8,8 @@
/[if lt IE 8]
= stylesheet_link_tag '/stylesheets/compiled/ie.css', :media => 'screen, projection'
= stylesheet_link_tag '/stylesheets/compiled/application.css', :media => 'screen, projection'
+ %script{:type => "text/javascript", :src => "/javascripts/jquery-1.4.2.min.js" }
+ %script{:type => "text/javascript", :src => "/javascripts/application.js" }
%body
#wrapper
#header