Customize Jifty Page Layout作者：gugod 發佈於：
I found myself repeating this whenever I started to put styles to my new Jifty app. Maybe it's necessary to make it easier. Actually not hard, but neither it is a trivial task.
To do this, you'll need to do these two steps:
- Write a
etc/config.ymlto enable it
This class can be done by inheriting the default
Jifty::View::Declare::Page class, and then override the
render_page method and optionally override the
render_header method. Jifty emits XHTML strict doctype by default. I started to use HTML5 these days, therefore I always override
Here's one of my example (gist: 168919). I use a 960 grid system so I added a few class names like
grid_16. That's also the reason I'm overriding the default Page class.
Add a key:
framework.View.PageClass with value
MyApp::View::Page. You should be able to find the key
View near the end of the generated
framework: .... ( other configs) TemplateClass: MyApp::View View: PageClass: MyApp::View::Page
I think this is only needed when you're writing Jifty Views with
Template::Declare, which is the recommended template system for Jifty these days. Not sure how does it work for mason users.