travis-web/app/components/user-avatar.js
2016-03-14 13:09:32 +01:00

22 lines
460 B
JavaScript

import Ember from 'ember';
export default Ember.Component.extend({
tagName: 'span',
classNameBindings: ['small:avatar--small:avatar'],
userInitials: function() {
var name = this.get('name');
var arr = name.split(' ');
var initials = '';
if (arr.length >= 2) {
initials = arr[0].split('')[0] + arr[1].split('')[0];
} else {
initials = arr[0].split('')[0];
}
return initials;
}.property('userInitials')
});