From 7bc9218b3c37d336239cdccf0f86965f6676cbc8 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Mon, 14 Sep 2015 12:08:05 +0100 Subject: [PATCH] Fix up a bunch of issues with the track-changes list view. - not crash when a user is null - fix alignment of user color square - if first and last name are absent, display email instead - truncate overly long display name with '...' --- .../web/app/views/project/editor/track-changes.jade | 2 +- .../ide/track-changes/TrackChangesManager.coffee | 2 +- .../controllers/TrackChangesListController.coffee | 10 +++++++++- .../public/stylesheets/app/editor/track-changes.less | 7 +++++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/services/web/app/views/project/editor/track-changes.jade b/services/web/app/views/project/editor/track-changes.jade index eacf7b982e..305be2ac03 100644 --- a/services/web/app/views/project/editor/track-changes.jade +++ b/services/web/app/views/project/editor/track-changes.jade @@ -76,7 +76,7 @@ div#trackChanges(ng-show="ui.view == 'track-changes'") div.user(ng-repeat="update_user in update.meta.users") .color-square(ng-if="update_user != null", ng-style="{'background-color': 'hsl({{ update_user.hue }}, 70%, 50%)'}") .color-square(ng-if="update_user == null", ng-style="{'background-color': 'hsl(100, 70%, 50%)'}") - .name(ng-if="update_user.id != user.id") {{update_user.first_name}} {{update_user.last_name}} + .name(ng-if="update_user.id != user.id" ng-bind="displayName(update_user)") .name(ng-if="update_user.id == user.id") You .name(ng-if="update_user == null") #{translate("anonymous")} div.user(ng-if="update.meta.users.length == 0") diff --git a/services/web/public/coffee/ide/track-changes/TrackChangesManager.coffee b/services/web/public/coffee/ide/track-changes/TrackChangesManager.coffee index 4098f860f4..5270754db7 100644 --- a/services/web/public/coffee/ide/track-changes/TrackChangesManager.coffee +++ b/services/web/public/coffee/ide/track-changes/TrackChangesManager.coffee @@ -250,5 +250,5 @@ define [ _updateContainsUserId: (update, user_id) -> for user in update.meta.users - return true if user.id == user_id + return true if user?.id == user_id return false diff --git a/services/web/public/coffee/ide/track-changes/controllers/TrackChangesListController.coffee b/services/web/public/coffee/ide/track-changes/controllers/TrackChangesListController.coffee index 2a32196a21..9aa050199a 100644 --- a/services/web/public/coffee/ide/track-changes/controllers/TrackChangesListController.coffee +++ b/services/web/public/coffee/ide/track-changes/controllers/TrackChangesListController.coffee @@ -103,4 +103,12 @@ define [ $scope.trackChanges.hoveringOverListSelectors = false $scope.resetHoverState() - ] \ No newline at end of file + $scope.displayName = (user) -> + full_name = "#{user.first_name} #{user.last_name}" + if full_name != " " + full_name + else if user.email + user.email + else + "Unknown" + ] diff --git a/services/web/public/stylesheets/app/editor/track-changes.less b/services/web/public/stylesheets/app/editor/track-changes.less index 39f3ff0740..6723d5bbfc 100644 --- a/services/web/public/stylesheets/app/editor/track-changes.less +++ b/services/web/public/stylesheets/app/editor/track-changes.less @@ -139,11 +139,14 @@ width: 12px; border-radius: 3px; position: absolute; - top: 3px; left: 0; + bottom: 3px; } .name { - display: inline-block; + width: 94%; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; } } }