Permalink
Browse files

set page titles

  • Loading branch information...
1 parent 5064b73 commit 20decb9abca849a31a903a4e2f8493f034a5ade9 Dominik Fijas committed May 14, 2011
Showing with 21 additions and 1 deletion.
  1. +20 −0 app/controllers/application_controller.rb
  2. +1 −1 app/views/layouts/application.html.erb
@@ -13,6 +13,7 @@ class ApplicationController < ActionController::Base
before_filter :set_language
before_filter :get_news
+ before_filter :set_title
def change_language
session[:language] = params[:lang]
@@ -28,6 +29,25 @@ def get_news
@news_items = NewsItem.find(:all, :order => "created_at DESC", :limit => 3)
end
+ def set_title
+ @title = case self.controller_name
+ when 'home'
+ "Drukarnia Stabil"
+ when 'calculations'
+ "Formularz Kalkulacyjny - Drukarnia Stabil"
+ when 'clients'
+ "Klienci - Drukarnia Stabil"
+ when 'contacts'
+ "Kontakt - Drukarnia Stabil"
+ when 'machines'
+ "Maszyny - Drukarnia Stabil"
+ when 'projects'
+ "Projekty - Drukarnia Stabil"
+ else
+ "Drukarnia Stabil"
+ end
+ end
+
def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
@@ -4,7 +4,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html;charset=UTF-8" />
- <title>Stabil: <%= controller.controller_name.capitalize %></title>
+ <title><%= @title ? @title : "Stabil: #{controller.controller_name.capitalize}" %></title>
<%= stylesheet_link_tag 'styles' %>
<%= javascript_include_tag "jquery", "easySlider1.7.js", "application" %>
<script type="text/javascript">

0 comments on commit 20decb9

Please sign in to comment.