开发者

Rails layout for main page width 100% width and others (input forms) with narrow width

I'm building a page where the main page has a left and right bars with fixed width, but the main contents is auto-sized with the width of the browser.

The problem I have is that when I want to view scaffolds I want the page to be just 700px or something like that and not the main layout. So the question is, how can I setup in Rails to have two master layouts?

As I'm talking about two layouts I t开发者_C百科hink it would be best for forms to float on top of the other page (with some JS or something like that).

Regards, Johann


There are many ways to specify different layouts, you can take a look here: Layouts and Rendering.

Basically you can create a new layout example.html.erb inside app/views/layouts/ and use it your controller:

class PagesController < ApplicationController
  layout 'example'
end

All views rendered by this controller will use the example.html.erb layout.

Hoep this helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜