What if we're not looking at a single Content object on the page?
Like, say, the index? Or search results? Then we don't have a single
Content object for @page that we can call html_title on.
On Dec 5, 2006, at 7:39 PM, Piers Cawley wrote:
Ok, revision 1318 modifies the prefix setting to allow you to postfix
the page title instead of prefix. Current prefixes will remain
prefixes, so nobody's blog titles change unexpectedly.
Oi! Not like that it shouldn't. We certainly shouldn't be exposing the
fact that it's implemented as an integer. Here's a suggestion:
class Content
def html_title
blog.title_prefix + title + blog.title_suffix
end
end
class Blog
def title_prefix
prepend_blog_name? ? "#{blog_name} : " : ''
end
def title_suffix
append_blog_name? ? " : #{blog_name}" : ''
end
def prepend_blog_name?
title_decoration == 'prepend'
end
def append_blog_name?
title_decoration == 'append'
end
end
Then the page_title helper simply becomes:
def page_title
@page.html_title
end
Mmm... fat model/thin controller kicks some serious buttock.
--
Kevin Ballard
http://kevin.sb.org
[EMAIL PROTECTED]
http://www.tildesoft.com
_______________________________________________
Typo-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/typo-list