Styling
This commit is contained in:
@@ -2,15 +2,27 @@ lunchControllers = angular.module 'lunchControllers'
|
||||
|
||||
lunchControllers.controller 'RunCtrl', ['$scope', 'socket', '$routeParams', ($scope, socket, $routeParams) ->
|
||||
$scope.show = false
|
||||
$scope.progress = 0
|
||||
$scope.numOrders = 0
|
||||
$scope.progressClass = 'progress-bar-danger'
|
||||
|
||||
socket.get '/run/' + $routeParams['id'],
|
||||
(response) ->
|
||||
$scope.show = true
|
||||
$scope.run = response
|
||||
$scope.numOrders = $scope.run.invitees.length + 1
|
||||
$scope.setProgress()
|
||||
$scope.$apply()
|
||||
|
||||
socket.on 'message', (m) ->
|
||||
if m.verb is 'update' and m.id is $routeParams.id
|
||||
$scope.run = m.data
|
||||
$scope.setProgress()
|
||||
$scope.$apply()
|
||||
|
||||
$scope.setProgress = () ->
|
||||
numFilledOrders = _.filter($scope.run.invitees, (i) -> i.order).length
|
||||
$scope.progress = (numFilledOrders / $scope.numOrders) * 100
|
||||
if $scope.progress >= 100
|
||||
$scope.progressClass = 'progress-bar-success'
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user