Forum: Rails Engines How to use layout with LoginEngine (or UserEngine) views?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Dcbf676f860477e44b275cae5d6318a4?d=identicon&s=25 Piotr Usewicz (lopmx)
on 2006-01-29 17:45
(Received via mailing list)
Hi

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

Peter
00e3a96684ab390a350b0271e98741d3?d=identicon&s=25 Nshbrown Nshbrown (nshb)
on 2006-01-29 21:47
(Received via mailing list)
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
> engine-users@lists.rails-engines.org
> http://lists.rails-engines.org/listinfo.cgi/engine...
-engines.org
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-01-29 21:53
(Received via mailing list)
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
Dcbf676f860477e44b275cae5d6318a4?d=identicon&s=25 Piotr Usewicz (lopmx)
on 2006-01-29 22:18
(Received via mailing list)
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)
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-01-29 22:21
(Received via mailing list)
Yup. Have a look at the engines documentation for more info....
0eaec4dbefa44a8d5a0592445051ba09?d=identicon&s=25 Jonathan Waddilove (Guest)
on 2006-01-30 12:42
James Adam 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
05d703f649ef1d07e78d7b479fb4c4ac?d=identicon&s=25 James Adam (Guest)
on 2006-01-30 12:47
(Received via mailing list)
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
This topic is locked and can not be replied to.