Permalink
Browse files

content(:page_title) now returns blank rather than nil when not

provided, so update the code accordingly. Thanks mirlord.

Closes #17.
  • Loading branch information...
1 parent f28427f commit 758709f3b020d544cae2edf95abdf4e5674eff42 @xaviershay xaviershay committed Dec 18, 2010
@@ -15,6 +15,14 @@ def page_title(page)
compose_title(page.title)
end
+ def html_title(content)
+ if content.present?
+ content
+ else
+ enki_config[:title]
+ end
+ end
+
private
def compose_title(*parts)
@@ -2,7 +2,7 @@
<html dir="ltr" lang="en-US">
<head>
<meta charset="utf-8">
- <title><%= yield(:page_title) || enki_config[:title] %></title>
+ <title><%= html_title yield(:page_title) %></title>
<%= stylesheet_link_tag 'application' %>
<%= javascript_include_tag 'jquery' %>
<%= open_id_delegation_link_tags(enki_config[:open_id_delegation, :server], enki_config[:open_id_delegation, :delegate]) if enki_config[:open_id_delegation] %>
@@ -36,4 +36,15 @@ def enki_config
posts_title("My Page").should == "My Page - Blog Title"
end
end
+
+ describe '#html_title' do
+ it 'uses the given string when present' do
+ html_title('a').should == "a"
+ end
+
+ it 'defaults to the configured title if nothing is supplied' do
+ html_title('' ).should == "Blog Title"
+ html_title(nil).should == "Blog Title"
+ end
+ end
end

0 comments on commit 758709f

Please sign in to comment.