gugguson
gugguson

Reputation: 819

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 think it would be best for forms to float on top of the other page (with some JS or something like that).

Regards, Johann

Upvotes: 0

Views: 228

Answers (1)

JCorcuera
JCorcuera

Reputation: 6834

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.

Upvotes: 1

Related Questions