From 8c2a15631a0af09273e2061376dd0111243990a1 Mon Sep 17 00:00:00 2001 From: Moises Machado Date: Fri, 23 Jan 2009 15:48:53 -0300 Subject: [PATCH] ActionItem907: put name of profile and title of article on page title --- app/views/layouts/application.rhtml | 12 ++++++------ test/functional/application_controller_test.rb | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/app/views/layouts/application.rhtml b/app/views/layouts/application.rhtml index 177bcaf..7029d87 100644 --- a/app/views/layouts/application.rhtml +++ b/app/views/layouts/application.rhtml @@ -1,12 +1,12 @@ - - <%= @environment.name() %> - <%- if @category -%> - → <%= @category.full_name -%> - <%- end -%> - + <%= + (@page ? @page.name + ' - ' : '') + + (@profile ? @profile.name + ' - ' : '') + + @environment.name + + (@category ? "→ #{@category.full_name}" : '') + %> diff --git a/test/functional/application_controller_test.rb b/test/functional/application_controller_test.rb index 6592b8f..d16a099 100644 --- a/test/functional/application_controller_test.rb +++ b/test/functional/application_controller_test.rb @@ -388,4 +388,24 @@ class ApplicationControllerTest < Test::Unit::TestCase assert_no_tag :tag => 'a', :content => /Category 2/ end + should 'show name of article as title of page' do + p = create_user('test_user').person + a = p.articles.create!(:name => 'test article') + + @controller.instance_variable_set('@profile', p) + @controller.instance_variable_set('@page', a) + + get :index + assert_tag 'title', :content => 'test article - ' + p.name + ' - ' + p.environment.name + end + + should 'diplay name of profile in the title' do + p = create_user('test_user').person + p.name = 'Some Test User' + p.save! + @controller.instance_variable_set('@profile', p) + + get :index, :profile => p.identifier + assert_tag 'title', :content => p.name + ' - ' + p.environment.name + end end -- libgit2 0.21.2