On 02/12/10 14:27 +0100, [email protected] wrote:
>From: Jozef Zigmund <[email protected]>
>
>---
> src/app/views/providers/_providers.haml |   16 ++++++++++++++++
> src/app/views/providers/edit.haml       |    2 +-
> src/app/views/providers/show.haml       |    2 +-
> 3 files changed, 18 insertions(+), 2 deletions(-)
>
>diff --git a/src/app/views/providers/_providers.haml 
>b/src/app/views/providers/_providers.haml
>index 5587a34..07b5e40 100644
>--- a/src/app/views/providers/_providers.haml
>+++ b/src/app/views/providers/_providers.haml
>@@ -12,3 +12,19 @@
>     %input{ :type => 'submit', :value => t(:add), :disabled => ('disabled' 
> unless controller.action_name == 'index') }
>   - form_tag({:controller => 'providers', :action => 'destroy', :id => 
> @provider}, {:method => :delete , :class => 'buttononly'}) do
>     = submit_tag 'delete', :disabled => ('disabled' unless @provider and 
> controller.action_name == 'show')
>+
>+:javascript
>+  jQuery.ajaxSetup({ 'beforeSend': function(xhr) 
>{xhr.setRequestHeader("Accept", "text/javascript")}
>+  })
>+  $(document).ready( function () {
>+    $("a.button").click(function (event) {
>+      event.preventDefault()
>+      if (!$(this).attr("disabled")) {
>+        $.get(($(this).attr("href")), function (response) {
>+          form = $(response).find('#edit_dcloud_form')
>+          $("#show_dcloud").replaceWith(form)
>+          $('a.button').attr('disabled', true)
>+        });
>+      }
>+    })
>+  })
>diff --git a/src/app/views/providers/edit.haml 
>b/src/app/views/providers/edit.haml
>index 199a73a..2691bfa 100644
>--- a/src/app/views/providers/edit.haml
>+++ b/src/app/views/providers/edit.haml
>@@ -2,6 +2,6 @@
> #details.grid_13
>   %nav.subsubnav
>     = render_navigation(:level => 4)
>-  - form_for :provider, @provider, :url => provider_path(@provider), :html => 
>{ :method => 'put', :class => "dcloud_form" } do |f|
>+  - form_for :provider, @provider, :url => provider_path(@provider), :html => 
>{ :id => 'edit_dcloud_form', :method => 'put', :class => "dcloud_form" } do |f|

I'm not sure if 'PUT' method is actually supported by browsers. For this
case I recommending to use 'method overide' in Rails.

>     = render :partial => 'form', :locals => { :f => f }
>     %input{ :type => 'submit', :value => t(:save), :name => 'save_provider', 
> :id => 'save_provider' }
>diff --git a/src/app/views/providers/show.haml 
>b/src/app/views/providers/show.haml
>index 574aed8..44c3612 100644
>--- a/src/app/views/providers/show.haml
>+++ b/src/app/views/providers/show.haml
>@@ -3,7 +3,7 @@
>   %nav.subsubnav
>     = render_navigation(:level => 4)
>     %br
>-    %table
>+    %table#show_dcloud
>       %thead
>         %tr
>           %th{:scope => "col"} Provider Name
>--
>1.7.2.3
>
>_______________________________________________
>deltacloud-devel mailing list
>[email protected]
>https://fedorahosted.org/mailman/listinfo/deltacloud-devel

-- 
--------------------------------------------------------
Michal Fojtik, [email protected]
Deltacloud API: http://deltacloud.org
--------------------------------------------------------
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to