Oui, je suis d'accord (mais fainéant :) Merci à vous deux pour les astuces.
On 1 sep, 10:28, "Michel Belleville" <[EMAIL PROTECTED]> wrote: > Ca dépend de ce que tu veux dire par "simplement". Indiquer dans le render > de l'action quel layout utiliser, je trouve ça plutôt simple... > > 2008/9/1 Pierre Valade <[EMAIL PROTECTED]> > > > > > > > Merci Michel. Donc effectivement aucune solution pour faire simplement > > ce que je voulais :) > > > On 1 sep, 07:33, "Michel Belleville" <[EMAIL PROTECTED]> > > wrote: > > > Tiens, au fait, qu'en dit la doc ?... > > > > Conditional layouts > > > > If you have a layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho.. > > .>that > > > by default is applied to all the actions of a controller, you still > > > have the option of rendering a given action or set of actions without a > > > layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho...>, > > > or restricting a > > > layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho.. > > .>to > > > only a single action or a set of actions. The > > > :only and :except options can be passed to the > > > layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho.. > > .>call. > > > For example: > > > > class WeblogController < ActionController::Base > > > layout "weblog_standard", :except => :rss > > > > # ... > > > > end > > > > This will assign "weblog_standard" as the WeblogController's > > > layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho.. > > .>except > > > for the > > > rss action, which will not wrap a > > > layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho.. > > .>around > > > the rendered view. > > > > Both the :only and :except condition can accept an arbitrary number of > > > method references, so #:except => [ :rss, :text_only ] is valid, as is > > :except > > > => :rss. > > > Using a different > > > layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho.. > > .>in > > > the action render call > > > > If most of your actions use the same > > > layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho...>, > > > it makes perfect sense to define a controller-wide > > > layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho.. > > .>as > > > described above. Sometimes you'll have exceptions where one action > > > wants > > > to use a different > > > layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho.. > > .>than > > > the rest of the controller. You can do this by passing a > > > :layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho.. > > .>option > > > to the > > > render call. For example: > > > > class WeblogController < ActionController::Base > > > layout "weblog_standard" > > > > def help > > > render :action => "help", :layout => "help" > > > end > > > end > > > > This will render the help action with the "help" > > > layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho.. > > .>instead > > > of the controller-wide "weblog_standard" > > > layout< > >http://api.rubyonrails.org/classes/ActionController/Layout/ClassMetho...>. > > > > -- > > > Michel Belleville > > -- > Michel Belleville --~--~---------~--~----~------------~-------~--~----~ Vous avez reçu ce message, car vous êtes abonné au groupe "Railsfrance" de Google Groups. Pour transmettre des messages à ce groupe, envoyez un e-mail à l'adresse [email protected] Pour résilier votre abonnement envoyez un e-mail à l'adresse [EMAIL PROTECTED] -~----------~----~----~----~------~----~------~--~---
