From 022ccd8bd00512f98282ab6a26bde644425d10db Mon Sep 17 00:00:00 2001 From: Daniela Soares Feitosa Date: Mon, 19 Oct 2009 12:40:21 -0300 Subject: [PATCH] Displaying short_name in page title --- app/helpers/application_helper.rb | 4 ++-- test/unit/application_helper_test.rb | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index dcb88bf..e0786c7 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -880,8 +880,8 @@ module ApplicationHelper def page_title (@page ? @page.name + ' - ' : '') + - (@profile ? @profile.name + ' - ' : '') + - @environment.name + + (profile ? profile.short_name + ' - ' : '') + + environment.name + (@category ? "→ #{@category.full_name}" : '') end diff --git a/test/unit/application_helper_test.rb b/test/unit/application_helper_test.rb index f16dbe3..3ca1162 100644 --- a/test/unit/application_helper_test.rb +++ b/test/unit/application_helper_test.rb @@ -502,6 +502,22 @@ class ApplicationHelperTest < Test::Unit::TestCase assert_equal '', optional_field(profile, :field_name, '', true) end + should 'display name on page title if profile doesnt have nickname' do + stubs(:environment).returns(Environment.default) + + c = Community.create(:name => 'Comm name', :identifier => 'test_comm') + stubs(:profile).returns(c) + assert_match(/Comm name/, page_title) + end + + should 'display nickname on page title if profile has nickname' do + stubs(:environment).returns(Environment.default) + + c = Community.create(:name => 'Community for tests', :nickname => 'Community nickname', :identifier => 'test_comm') + stubs(:profile).returns(c) + assert_match(/Community nickname/, page_title) + end + protected def url_for(args = {}) -- libgit2 0.21.2