Hi all, Dose layout supports "on" condition?, according to the api doc, layout method in ActionController supports exception and only conditions, It seems not support "on" I think we consider to add support of "on" for example, I want my actions render without layout when they were requested via xml_http, and with layout when via normal request. Without "on" I have to put code like this in every action method: if @request.xhr? render_without_layout end With "on", I only need to write one code in top of the Application Controller class layout "application",:on=>!@request.xhr? -- Regards. Yufan ==========================Feed-Tank.com : Easy to use online feeds aggregator and reader. FT80off: Use this code to get up to $80 off for any dreamhost hosting plan.
Not sure about :on, but typically I do layouts for different actions with a decisive helper method: layout :decide_layout ... def decide_layout params[:action] == "list" ? "layout_a" : "layout_b" end You can use if/else expressions, cases, etc. I''m sure you can adapt that to your current situation :) Justin French On 07/09/2005, at 6:17 PM, yufan shi wrote:> Hi all, > Dose layout supports "on" condition?, according to the api doc, layout > method in ActionController supports exception and only conditions, It > seems not support "on" > I think we consider to add support of "on" > for example, > I want my actions render without layout when they were requested via > xml_http, and with layout when via normal request. > Without "on" > I have to put code like this in every action method: > > if @request.xhr? > render_without_layout > end > With "on", > I only need to write one code in top of the Application Controller > class > layout "application",:on=>!@request.xhr? > > -- > Regards. > > Yufan > ==========================> Feed-Tank.com : Easy to use online feeds aggregator and reader. > FT80off: Use this code to get up to $80 off for any dreamhost > hosting plan. > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >--- Justin French, Indent.com.au justin.french-zULN+VWqVOIpAS55Wn97og@public.gmane.org Web Application Development & Graphic Design
Yeah, sounds greate, I will try it. Thanks Justin. 2005/9/7, Justin French <justin.french-zULN+VWqVOIpAS55Wn97og@public.gmane.org>:> Not sure about :on, but typically I do layouts for different actions > with a decisive helper method: > > layout :decide_layout > > ... > > def decide_layout > params[:action] == "list" ? "layout_a" : "layout_b" > end > > You can use if/else expressions, cases, etc. I''m sure you can adapt > that to your current situation :) > > Justin French > > > On 07/09/2005, at 6:17 PM, yufan shi wrote: > > > Hi all, > > Dose layout supports "on" condition?, according to the api doc, layout > > method in ActionController supports exception and only conditions, It > > seems not support "on" > > I think we consider to add support of "on" > > for example, > > I want my actions render without layout when they were requested via > > xml_http, and with layout when via normal request. > > Without "on" > > I have to put code like this in every action method: > > > > if @request.xhr? > > render_without_layout > > end > > With "on", > > I only need to write one code in top of the Application Controller > > class > > layout "application",:on=>!@request.xhr? > > > > -- > > Regards. > > > > Yufan > > ==========================> > Feed-Tank.com : Easy to use online feeds aggregator and reader. > > FT80off: Use this code to get up to $80 off for any dreamhost > > hosting plan. > > _______________________________________________ > > Rails mailing list > > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails > > > > --- > Justin French, Indent.com.au > justin.french-zULN+VWqVOIpAS55Wn97og@public.gmane.org > Web Application Development & Graphic Design > > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Regards. Yufan ==========================Feed-Tank.com : Easy to use online feeds aggregator and reader. FT80off: Use this code to get up to $80 off for any dreamhost hosting plan.