On 03/12/10 12:04, Ladislav Martincik wrote: > > On Dec 2, 2010, at 6:16 PM, [email protected] <mailto:[email protected]> > wrote: > >> On 02/12/10 18:15, Ladislav Martincik wrote: >>> >>> On Dec 2, 2010, at 3:56 PM, [email protected] >>> <mailto:[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] >>>>>> <mailto:[email protected]> wrote: >>>>>>> From: Jozef Zigmund<[email protected] <mailto:[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. >> >> Well, in this case, it is mapped to POST > > I don't think so. As long as I understand this if you're not using > XHTML1.0 or HTML4[1] (which in our case we are not) it's not the case.
Ok, now I'm confused. I thought you said " >>> 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." I thought we are talking about a HTML form here, for a browser? > In those 2 cases DTD specifies only "GET" and "POST" and would make > sense to worry about "PUT" support. If we want to support different > tools like curl, wget than it's different story[2]. > same as above, are you guys talking about a web browser? >> >>> so still there's no need to worry. At least I would be very surprised >> that something like this simple doesn't work. ;) >> >> It *will* work, because its doing a *POST* so in all likelyhood the >> intended outcome is the same. > > It really isn't doing just "POST". You can use "PUT" and it will map > correctly to HTTP/1.1 PUT method[3]. > >> >>> 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. >> >> I would argue that the question should be, do you need to do a PUT? If >> yes, use method_override. If you are fine with doing a POST, then leave >> it as it is, > > Of course we don't have to use PUT if we don't require app to be RESTful > styled. But I would prefer to use RESTful style because Rails just very > good at it. And IMHO it's very clean style of programming. Ok, I didn't say anything different and have not mentioned REST at all. My intent here is not to cause an argument. I do not know the context of this patch and have not tried to apply or use it. I am merely asserting that IF you are using a HTML form and you want to do a PUT, then 'standard' HTML 4 does not support this. marios >> >> marios >> > > -- Ladislav > > [1] http://rest.blueoxen.net/cgi-bin/wiki.pl?HttpMethodsSupport > [2] http://curl.haxx.se/docs/comparison-table.html > [3] http://annevankesteren.nl/2007/10/http-method-support _______________________________________________ deltacloud-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/deltacloud-devel
