On 2/23/07, Patrick Crowley <[EMAIL PROTECTED]> wrote:
Oooh. If you shorten the helper name to "t", you get some nice
syntactic sugar.
Exactly :)
But if you combine with that earlier title helper I linked to you
could get something even more like the following...
## site/getting_started.rhtml
<h1><%= t "Getting started" %></h1>
## site/layout.rhtml
<title><%= page_title %></title>
## application_helper.rhtml
def page_title
if title
"#{site_name} - #{title}"
else
"#{site_name} - #{programmatic_title}"
end
end
Just make those title and site_name methods simple wrappers around
instance variables.
I want to reuse this stuff! We should pour our collective wisdom into
a sophisticated title_helper plugin at the next hackfest :-)
--
Nick Zadrozny • http://missionsbridge.org/people/nick
_______________________________________________
Sdruby mailing list
[email protected]
http://lists.sdruby.com/mailman/listinfo/sdruby