Integration of Ray' modifications

This commit is contained in:
chris2tof committed 2011-11-17 20:02:58 +08:00
1 parent c4810274ec
commit 861237d65b
39 files changed
+804 -175

No files matched your search

+11
View File
@@ -64,6 +64,17 @@ class User
(self.active_roles.nil? || self.active_roles.empty?) ? '-' : self.active_roles.map{|role| I18nVariable.first(:conditions => {:key => role})[I18n.locale] rescue role}.join(' / ')
end
def name
infos = self.user_infos.detect {|info| info.key.to_s.eql?('profile') }
if infos
first_name = infos.attribute_values.detect {|value| value.key.to_s.eql?('first_name') }[I18n.locale.to_s] rescue nil
last_name = infos.attribute_values.detect {|value| value.key.to_s.eql?('last_name') }[I18n.locale.to_s] rescue nil
return "#{first_name} #{last_name}"
else
return nil
end
end
protected
# Remove empty values