On Dec 2, 2010, at 3:56 PM, [email protected] wrote:
> On 02/12/10 16:31, Ladislav Martincik wrote:
>>
>> On Dec 2, 2010, at 3:10 PM, Michal Fojtik wrote:
>>
>>> 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.
>>>
>>
>> I believe it should be fine. All new browsers (even IE6) supports HTTP/1.1.
>
> not sure if i misunderstood - Michal is referring to HTML forms - they
> support only 'GET' and 'POST' for the method attribute (i think HTML 5
> will add support for all CRUD methods). So in this case, if this is
> really a html form and you want to do a put using the form then you need
> to use method_override... if it is working its because it defaults to
> 'post' and so you might not notice it,
>
> marios
HTML forms are mapped to HTTP protocol so still there's no need to worry. At
least I would be very surprised that something like this simple doesn't work.
;) The questions maybe should be what is the software we have to support (I
mean browsers mainly) in order to determine if this is the case.
>
>>
>>>> = 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
>>
>> _______________________________________________
>> deltacloud-devel mailing list
>> [email protected]
>> https://fedorahosted.org/mailman/listinfo/deltacloud-devel
>
> _______________________________________________
> deltacloud-devel mailing list
> [email protected]
> https://fedorahosted.org/mailman/listinfo/deltacloud-devel
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel