Run status page styles

This commit is contained in:
Ben Ramey
2014-04-10 07:24:46 -05:00
parent cfd39be771
commit 6fd2034dbb
4 changed files with 49 additions and 23 deletions

View File

@@ -11,6 +11,7 @@ lunchControllers.controller 'RunCtrl', ['$scope', 'socket', '$routeParams', ($sc
$scope.show = true
$scope.run = response
$scope.numOrders = $scope.run.invitees.length
$scope.setStatusClasses()
$scope.setProgress()
$scope.$apply()
@@ -18,8 +19,16 @@ lunchControllers.controller 'RunCtrl', ['$scope', 'socket', '$routeParams', ($sc
if m.verb is 'update' and m.id is $routeParams.id
$scope.run = m.data
$scope.setProgress()
$scope.setStatusClasses()
$scope.$apply()
$scope.setStatusClasses = () ->
for i in $scope.run.invitees
if i.order
i.statusClass = 'done'
else
i.statusClass = 'incomplete'
$scope.setProgress = () ->
numFilledOrders = _.filter($scope.run.invitees, (i) -> i.order).length
$scope.progress = (numFilledOrders / $scope.numOrders) * 100