Add user data into changes

This commit is contained in:
James Allen 2016-11-09 16:23:08 +00:00
parent e0fbb45844
commit b44f1cde10
2 changed files with 22 additions and 4 deletions

View file

@ -56,13 +56,15 @@ div.full-size(
ng-style="{'top': top}" ng-style="{'top': top}"
) )
div(ng-if="entry.type == 'insert' || entry.type == 'delete'") div(ng-if="entry.type == 'insert' || entry.type == 'delete'")
div(style="float: right; background-color: hsl({{ users[entry.metadata.user_id].hue }}, 70%, 50%); width: 40px; height: 40px;") {{ users[entry.metadata.user_id].avatar_text }}
div.small(style="color: hsl({{ users[entry.metadata.user_id].hue }}, 70%, 50%)") {{ users[entry.metadata.user_id].name }}
div.small {{ entry.metadata.ts }} div.small {{ entry.metadata.ts }}
{{ entry.content }} | {{ entry.content }}
div(ng-if="entry.type == 'comment'") div(ng-if="entry.type == 'comment'")
div(ng-repeat="comment in entry.thread", class="comment-thread__comment") div(ng-repeat="comment in entry.thread", class="comment-thread__comment")
div.small {{ comment.ts }} div.small {{ comment.ts }}
div.small {{ comment.user_id }} div.small {{ comment.user_id }}
{{ comment.content }} | {{ comment.content }}
div(ng-if="entry.replying") div(ng-if="entry.replying")
textarea(ng-model="entry.replyContent") textarea(ng-model="entry.replyContent")
a.btn.btn-sm.btn-primary(href, ng-click="submitReply(entry)") Submit a.btn.btn-sm.btn-primary(href, ng-click="submitReply(entry)") Submit

View file

@ -1,7 +1,8 @@
define [ define [
"base", "base",
"utils/EventEmitter" "utils/EventEmitter"
], (App, EventEmitter) -> "ide/colors/ColorManager"
], (App, EventEmitter, ColorManager) ->
App.controller "ReviewPanelController", ($scope, $element, ide) -> App.controller "ReviewPanelController", ($scope, $element, ide) ->
$scope.reviewPanel = $scope.reviewPanel =
entries: {} entries: {}
@ -93,3 +94,18 @@ define [
entry.replying = false entry.replying = false
entry.replyContent = "" entry.replyContent = ""
$scope.$broadcast "review-panel:layout" $scope.$broadcast "review-panel:layout"
refreshUsers = () ->
$scope.users = {}
for member in $scope.project.members.concat($scope.project.owner)
$scope.users[member._id] = {
email: member.email
name: "#{member.first_name} #{member.last_name}"
hue: ColorManager.getHueForUserId(member._id)
avatar_text: [member.first_name, member.last_name].filter((n) -> n?).map((n) -> n[0]).join ""
}
console.log "REFRESHED USERS", $scope.project.members, $scope.users
$scope.$watch "project.members", (members) ->
return if !members?
refreshUsers()