How to use layout with LoginEngine (or UserEngine) views?


#1

Hi

How to use layout with LoginEngine (or UserEngine) views without
overwriting the engine files?

Peter


#2

Or alternatively, use the code-mixing feature. Create your own layout
in /app/views/layouts/whatever.rhtml, and then if you want it to be
used everywhere, set it in your /app/controllers/application.rb file.
If you want to be able to use your custom layout on only specific
controllers from within an engine, just create the correctly-named
controller in your /app/controllers directory, i.e.

/app/controllers/user_controller.rb

class UserController < ApplicationController
layout :whatever
end

… it should be that easy.

  • james

#3

So i just create a normal ‘copy’ of a Engine controller? I’d like to use
a special template for login action in UserController, so i just setup
an empty UserController and force the action to use a different view?
(using layout method)


#4

Create a layout in app/views/layouts/application.rhtml which will wrap
around the default views for each of the engines.

-Nb

 Nathaniel S. H. Brown                           http://nshb.net

How to use layout with LoginEngine (or UserEngine) views
without overwriting the engine files?

Peter


engine-users mailing list
removed_email_address@domain.invalid
http://lists.rails-engines.org/listinfo.cgi/engine-users-rails
-engines.org


#5

James A. wrote:

  • James, Great, just what I needed to know as well…

Do you have a Wiki (or something) where these snips are documented, I
(and I’m sure others) would be happy to help.

  • Jonathan

Or alternatively, use the code-mixing feature. Create your own layout
in /app/views/layouts/whatever.rhtml, and then if you want it to be
used everywhere, set it in your /app/controllers/application.rb file.
If you want to be able to use your custom layout on only specific
controllers from within an engine, just create the correctly-named
controller in your /app/controllers directory, i.e.

/app/controllers/user_controller.rb

class UserController < ApplicationController
layout :whatever
end

… it should be that easy.

  • james

#6

The rails engines site (which is a wiki) should be your first port of
call:

http://rails-engines.org

If you feel any documentation is lacking, please do insert some there.
The primary source of documentation for engines lies within the
engines themselves in the form of rdoc (which you can generate using
rake engine_doc), and is also available at
http://api.rails-engines.org/

  • james

#7

Yup. Have a look at the engines documentation for more info…