lovely-layouts
lovely-layouts copied to clipboard
A lovely bunch of layout and view helper DSLs for things that I usually find myself doing in every Rails app.
h1. LovelyLayouts
Here's a bunch of helpers I find myself needing every time I start up a new Rails project. Mostly, it's just some nicer DSL wrappers around the @content_for@ patterns we all use to get get content up from the view to the layout in a Rails application (for titles, etc).
h2. In your view
Eg: app/views/posts/show.html.erb
h2. In your layout
"optional prefix text", :suffix => "optional suffix text" %> ... ...
h2. And a neat trick for the @
@ tagA block helper for creating body tags is also in there. The @id@ is generated from @params[:controller]@ (eg "posts"), and the @class@ is generated from @params[:controller]@ name and @params[:action]@ (eg "posts show").
...
Which pushes out something like this:
...
You can set the @id@ and @class@ from your views:
You can override the @id@ and @class@ (or any attribute of the @
@ tag) too:"blog", :class => "whatever", :onload => "party()" do %> ...
h2. There's always a TODO List
- might write some tests!
- probably try to distill the way I do tabs too
h2. Blah blah blah blah
Copyright (c) 2009 "Justin French":http://www.justinfrench.com/, released under the MIT license.