update order page udpates

This commit is contained in:
Ben Ramey
2014-05-16 21:25:48 -05:00
parent 42ef462a0c
commit 1c7c71d749
3 changed files with 17 additions and 10 deletions

View File

@@ -22,6 +22,12 @@ lunchControllers.controller 'UpdateOrderCtrl', ['$scope','socket','$routeParams'
$scope.invitees = allResponse
$scope.$apply()
socket.on 'message', (m) ->
if m.verb is 'update' and m.data.run_id is $scope.run.id
invitee = _.findWhere $scope.invitees, run_id: m.data.run_id
_.extend invitee, m.data
$scope.$apply()
$scope.submit = (invitee) ->
socket.put '/invitee/' + $routeParams['inviteeId'], { order: invitee.order }, (response) ->
$location.path '/run/' + $scope.run.id