display a users username in the final step

This commit is contained in:
maxwell 2010-11-20 15:58:26 -08:00 committed by danielvincent
parent 9f5ba1a1ea
commit 4ce337bbed
4 changed files with 31 additions and 2 deletions

View file

@ -0,0 +1,10 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
module UsersHelper
def first_name_or_username (user)
set_name = user.person.profile.first_name
(set_name.nil? || set_name.empty?) ? user.username : user.person.profile.first_name
end
end

View file

@ -4,7 +4,7 @@
%h1
= t('.set_up', :name => current_user.person.profile.first_name || current_user.username)
= t('.set_up', :name => first_name_or_username(current_user))
.description
= t('.ready_to_share')
%ul.inline_aspect_listing

View file

@ -166,7 +166,7 @@ header
:display block
&:hover
:background
:color #009
:color black
&.active

View file

@ -0,0 +1,19 @@
# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
require 'spec_helper'
describe UsersHelper do
describe '#first_name_or_username' do
let(:user){ make_user }
it 'should display the first name if it is set' do
first_name_or_username(user).should == user.person.profile.first_name
end
it 'should display the username if the first name is empty' do
user.person.profile.first_name = ""
first_name_or_username(user).should == user.username
end
end
end