From e72bd939439db5dd43ccc1a76975fafabaf2efa7 Mon Sep 17 00:00:00 2001 From: hukl Date: Tue, 3 Mar 2009 13:43:23 +0100 Subject: setting the title tag dynamically --- app/helpers/content_helper.rb | 8 ++++++++ app/views/layouts/application.html.erb | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/helpers/content_helper.rb b/app/helpers/content_helper.rb index 9950bda..2cfba02 100644 --- a/app/helpers/content_helper.rb +++ b/app/helpers/content_helper.rb @@ -10,6 +10,14 @@ module ContentHelper page.user ? page.user.login : "Unknown author" end + def page_title page + if @page.title && @page.title != "" + "CCC | #{@page.title}" + else + "CCC | Chaos Computer Club" + end + end + # This method is an output filter for templates. It accepts any kind of text # and checks for an tag within it. If such a tag is found, its # attributes are parsed and converted into parameters for the diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb index 828f5b2..58de77e 100644 --- a/app/views/layouts/application.html.erb +++ b/app/views/layouts/application.html.erb @@ -2,7 +2,7 @@ - CCC Template + <%= page_title @page %> <%= stylesheet_link_tag 'styled' %> <%= stylesheet_link_tag 'safari' %> -- cgit v1.3