diff --git a/app/components/user-avatar.js b/app/components/user-avatar.js new file mode 100644 index 00000000..f37d9f93 --- /dev/null +++ b/app/components/user-avatar.js @@ -0,0 +1,21 @@ +import Ember from 'ember'; + +export default Ember.Component.extend({ + + tagName: 'span', + classNames: ['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.toUpperCase(); + }.property('userInitials') + +}); diff --git a/app/controllers/top.js b/app/controllers/top.js index de6962d5..2fca30cf 100644 --- a/app/controllers/top.js +++ b/app/controllers/top.js @@ -11,12 +11,6 @@ export default Ember.Controller.extend({ return this.get('user.name') || this.get('user.login'); }.property('user.login', 'user.name'), - gravatarUrl: function() { - if (this.get('user.gravatarId')) { - return location.protocol + "//www.gravatar.com/avatar/" + (this.get('user.gravatarId')) + "?s=36&d=mm"; - } - }.property('user.gravatarId'), - defineTowerColor(broadcastArray) { if (!broadcastArray) { return ''; diff --git a/app/models/user.js b/app/models/user.js index 294b5549..1954cde7 100644 --- a/app/models/user.js +++ b/app/models/user.js @@ -3,6 +3,7 @@ import Model from 'travis/models/model'; import config from 'travis/config/environment'; import attr from 'ember-data/attr'; import { hasMany, belongsTo } from 'ember-data/relationships'; +import {gravatarImage} from '../utils/urls'; export default Model.extend({ ajax: Ember.inject.service(), @@ -132,5 +133,9 @@ export default Model.extend({ user = JSON.parse(this.get('sessionStorage').getItem('travis.user')); user[name.underscore()] = this.get(name); return this.get('sessionStorage').setItem('travis.user', JSON.stringify(user)); - } + }, + + avatarUrl: function() { + return gravatarImage(this.get('email'), 36); + }.property('email') }); diff --git a/app/styles/app/layouts/profile.sass b/app/styles/app/layouts/profile.sass index e3e84e36..6c95e01a 100644 --- a/app/styles/app/layouts/profile.sass +++ b/app/styles/app/layouts/profile.sass @@ -87,14 +87,10 @@ .media-elem width: 14% - img - width: 2.6rem - height: 2.6rem - border-radius: 50% .media-body width: 86% p - margin: 0 + margin: .1em 0 ul @include resetul li @@ -261,4 +257,4 @@ p.profile-user-last #unadministerable-hooks p - margin-top: 2em \ No newline at end of file + margin-top: 2em diff --git a/app/styles/app/modules/avatar.sass b/app/styles/app/modules/avatar.sass index bf2af64d..71933ce0 100644 --- a/app/styles/app/modules/avatar.sass +++ b/app/styles/app/modules/avatar.sass @@ -1,43 +1,58 @@ -%avatar - position: relative - background-color: #a0a0a0 - border-radius: 50% - overflow: hidden - &:before - content: "" - display: block - width: 40% - height: 40% - border-radius: 50% - background: $cream-light - position: absolute - top: 20% - margin: auto - left: 0 - right: 0 +=absoluteCenter + position: absolute + top: 0 + right: 0 + bottom: 0 + left: 0 + margin: auto - &:after - content: "" - display: block - width: 66% - height: 70% - border-radius: 50% - background: $cream-light - position: absolute - top: 55% - margin: auto - left: 0 - right: 0 - -.default-avatar--profile - @extend %avatar - width: 2.6rem - height: 2.6rem - -.default-avatar--topbar - @extend %avatar - width: 2.7rem - height: 2.7rem +.avatar display: inline-block + width: 2.3em + height: 2.3em + position: relative vertical-align: middle - margin-left: 0.3em + border-radius: 50% + background-color: white + overflow: hidden + + .pseudo-avatar + +absoluteCenter + border: 1px solid $grey + border-radius: 50% + background: white + z-index: 1 + &:after + content: attr(data-initials) + +absoluteCenter + color: $grey + font-weight: 600 + text-align: center + font-size: 1.4em + line-height: 1.6 + + .real-avatar + +absoluteCenter + z-index: 2 + border-radius: 50% + +.profile + .avatar + margin-left: 1em + top: -3px + +.commit-author + .avatar + width: 20px + height: 20px + .pseudo-avatar:after + font-size: .7em + line-height: 1.7 + +.row-committer + .avatar + width: 18px + height: 18px + .pseudo-avatar:after + font-size: .7em + line-height: 1.6 diff --git a/app/styles/app/modules/build-header.sass b/app/styles/app/modules/build-header.sass index e9a31e37..b84ef377 100644 --- a/app/styles/app/modules/build-header.sass +++ b/app/styles/app/modules/build-header.sass @@ -75,11 +75,6 @@ .commit-author margin: 1rem 0 .7rem - img - width: 20px - height: 20px - margin-right: .5em - border-radius: 50% .commit-description margin: 1rem 0 diff --git a/app/styles/app/modules/navigation.sass b/app/styles/app/modules/navigation.sass index 71e00214..a588770f 100644 --- a/app/styles/app/modules/navigation.sass +++ b/app/styles/app/modules/navigation.sass @@ -32,14 +32,9 @@ $nav-line-height: 35px text-align: right line-height: $top-height float: right - img - border-radius: 50% - width: 2.7rem - height: 2.7rem - margin-left: 1rem @media #{$medium-up} margin-right: 0 - + .navigation-anchor display: block diff --git a/app/templates/components/branch-row.hbs b/app/templates/components/branch-row.hbs index e2c07287..d6cd40b4 100644 --- a/app/templates/components/branch-row.hbs +++ b/app/templates/components/branch-row.hbs @@ -1,5 +1,5 @@
Token: +
Token:
{{#if tokenIsVisible}}
{{auth.currentUser.token}}
{{/if}}
diff --git a/app/templates/components/user-avatar.hbs b/app/templates/components/user-avatar.hbs
new file mode 100644
index 00000000..ce49589c
--- /dev/null
+++ b/app/templates/components/user-avatar.hbs
@@ -0,0 +1,4 @@
+
+{{#if url}}
+
+{{/if}}
diff --git a/app/templates/top.hbs b/app/templates/top.hbs
index f3e14815..c5df2481 100644
--- a/app/templates/top.hbs
+++ b/app/templates/top.hbs
@@ -56,8 +56,9 @@
{{/if}}
{{#if auth.signedIn}}
- {{#link-to "profile" class="navigation-anchor signed-in"}}{{userName}}
- {{#if gravatarUrl }}
{{else}}