Commit 022ccd8bd00512f98282ab6a26bde644425d10db
Committed by
Antonio Terceiro
1 parent
d85ef0c3
Exists in
master
and in
29 other branches
Displaying short_name in page title
(ActionItem1283)
Showing
2 changed files
with
18 additions
and
2 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -880,8 +880,8 @@ module ApplicationHelper | @@ -880,8 +880,8 @@ module ApplicationHelper | ||
880 | 880 | ||
881 | def page_title | 881 | def page_title |
882 | (@page ? @page.name + ' - ' : '') + | 882 | (@page ? @page.name + ' - ' : '') + |
883 | - (@profile ? @profile.name + ' - ' : '') + | ||
884 | - @environment.name + | 883 | + (profile ? profile.short_name + ' - ' : '') + |
884 | + environment.name + | ||
885 | (@category ? "→ #{@category.full_name}" : '') | 885 | (@category ? "→ #{@category.full_name}" : '') |
886 | end | 886 | end |
887 | 887 |
test/unit/application_helper_test.rb
@@ -502,6 +502,22 @@ class ApplicationHelperTest < Test::Unit::TestCase | @@ -502,6 +502,22 @@ class ApplicationHelperTest < Test::Unit::TestCase | ||
502 | assert_equal '', optional_field(profile, :field_name, '<html tags>', true) | 502 | assert_equal '', optional_field(profile, :field_name, '<html tags>', true) |
503 | end | 503 | end |
504 | 504 | ||
505 | + should 'display name on page title if profile doesnt have nickname' do | ||
506 | + stubs(:environment).returns(Environment.default) | ||
507 | + | ||
508 | + c = Community.create(:name => 'Comm name', :identifier => 'test_comm') | ||
509 | + stubs(:profile).returns(c) | ||
510 | + assert_match(/Comm name/, page_title) | ||
511 | + end | ||
512 | + | ||
513 | + should 'display nickname on page title if profile has nickname' do | ||
514 | + stubs(:environment).returns(Environment.default) | ||
515 | + | ||
516 | + c = Community.create(:name => 'Community for tests', :nickname => 'Community nickname', :identifier => 'test_comm') | ||
517 | + stubs(:profile).returns(c) | ||
518 | + assert_match(/Community nickname/, page_title) | ||
519 | + end | ||
520 | + | ||
505 | protected | 521 | protected |
506 | 522 | ||
507 | def url_for(args = {}) | 523 | def url_for(args = {}) |