This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
commit 66cf1caf84165a192424ef58387c89a5b7234096
tree 835b42c7bb50945d9ac1a8f830bf2a9c741db4b9
parent 309412f02447877f243ce2411995bb6a5a1a0b61
tree 835b42c7bb50945d9ac1a8f830bf2a9c741db4b9
parent 309412f02447877f243ce2411995bb6a5a1a0b61
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | Mon Mar 30 16:00:27 -0700 2009 | |
| |
README.textile | Sun Sep 27 04:06:29 -0700 2009 | |
| |
Rakefile | Mon Mar 30 16:00:27 -0700 2009 | |
| |
install.rb | Mon Mar 30 16:00:27 -0700 2009 | |
| |
lib/ | Sun Oct 11 15:20:53 -0700 2009 | |
| |
rails/ | Mon Mar 30 16:00:27 -0700 2009 | |
| |
tasks/ | Mon Mar 30 16:00:27 -0700 2009 | |
| |
test/ | Mon Mar 30 16:00:27 -0700 2009 | |
| |
uninstall.rb | Mon Mar 30 16:00:27 -0700 2009 |
README.textileAnd a neat trick for the
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).
In your view
Eg: app/views/posts/show.html.erb
<% title @post.title %>
<% description @post.description %>
<% keywords @post.tags.join(", ") %>
<% copyright @post.user.full_name %>
In your layout
<html>
<head>
<%= title_tag "optional default title here", :prefix => "optional prefix text", :suffix => "optional suffix text" %>
<%= description_tag "optional default meta description here" %>
<%= keywords_tag "optional default meta keywords here" %>
<%= copyright_tag "optional default meta copyright notice here" %>
</head>
<body>
...
<%= yield %>
...
</body>
</html>
And a neat trick for the <body> tag
A 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”).
<% body do %>
...
<% end %>
Which pushes out something like this:
<body id="posts" class="posts show">
...
</body>
You can set the id and class from your views:
<% body_id "blog" %> <% body_class "whatever" %>
You can override the id and class (or any attribute of the <body> tag) too:
<% body :id => "blog", :class => "whatever", :onload => "party()" do %>
...
<% end %>
There’s always a TODO List
- might write some tests!
- probably try to distill the way I do tabs too
Blah blah blah blah
Copyright © 2009 Justin French, released under the MIT license.







