Integrating comatose into existing application layout

1 view
Skip to first unread message

opoplawski

unread,
Mar 25, 2008, 12:00:23 AM3/25/08
to Comatose Plugin
I'm trying to integrate comatose into my existing rail application
layout to manage static content. I currently have a app/views/layouts/
application.rhtml file that defines the layout and a "site" controller
that is currently serving up the basic pages:

map.connect '', :controller => "site"

If I change to:

map.comatose_root ''

I get only the basic pages as defined in comatose, not my layout. Is
there a simple way to replace my current site controller with comatose
and get the comatose output integrated into the application layout?

Thanks!

Orion

opoplawski

unread,
Mar 25, 2008, 12:22:59 AM3/25/08
to Comatose Plugin
Here's what I did:

In config/routes.rb:

map.comatose_root '', :layout => "layouts/application"

But I also had to edit /lib/comatose/controller.rb and changed the
base class of the Comatose Controller to be my "ApplicationController"
which includes my ApplicationHelper functions used in my layout. Not
sure if there is a better way.

- Orion

Andrew Kuklewicz

unread,
Mar 25, 2008, 12:26:32 AM3/25/08
to comatos...@googlegroups.com
I think for what you want, all you need to do is specify the layout for comatose to use:

map.comatose_root '', :layout=>'application'

-Andrew
--
Andrew Kuklewicz

vvan

unread,
Apr 29, 2008, 2:20:44 AM4/29/08
to Comatose Plugin
Its not actually clear how to get comatose to load your own layout.
Cant get comatose.root to point to a layout which resides in app/view/
layouts folder.

Any suggestions?

vvan

unread,
Apr 29, 2008, 2:23:08 AM4/29/08
to Comatose Plugin
Also after you point comatose.root to a file do you call it in the
address bar instead of comatose_admin?

Thanks in Advance

Thibaut Barrère

unread,
Apr 30, 2008, 3:32:01 AM4/30/08
to Comatose Plugin
Hi,

> Its not actually clear how to get comatose to load your own layout.
> Cant get comatose.root to point to a layout which resides in app/view/
> layouts folder.

As Andrew stated it, map.comatose_root can include a :layout
parameter. If you write :layout => 'application' like Andrew did, the /
app/views/layouts/application.rhtml will get picked for all the public
part.

Another tip that can be useful: you can also create a named route with
a layout for a specific part of the site, eg:
map.comatose_footer 'information', :index => 'information',:layout =>
'my_specific_layout'

Finally, if you need to customize the admin part, use the rake
comatose:admin:customize task which will copy the necessary files to
your app and public folder. You will get a app/views/comatose_admin
folder with all the default templates, ready to be customized.

cheers!

Thibaut
--
http://blog.logeek.Fr

vvan

unread,
Apr 30, 2008, 8:10:23 PM4/30/08
to Comatose Plugin

thanks for the info
much appreciated
Reply all
Reply to author
Forward
0 new messages