Rearrange controllers

This commit is contained in:
Ben Ramey
2014-03-14 13:49:19 -05:00
parent da466969ba
commit fc0ed457a6
3 changed files with 26 additions and 23 deletions

View File

@@ -1,11 +1,12 @@
lunchControllers = angular.module 'lunchControllers' lunchControllers = angular.module 'lunchControllers'
lunchControllers.controller 'CreateOrderCtrl', ['$scope','socket','$routeParams', ($scope, socket, $routeParams) -> lunchControllers.controller 'CreateOrderCtrl', ['$scope','socket','$routeParams',
$scope.show = false CreateOrderController = ($scope, socket, $routeParams) ->
$scope.show = false
socket.get '/run/' + $routeParams['id'], socket.get '/run/' + $routeParams['id'],
(response) -> (response) ->
$scope.show = true $scope.show = true
$scope.invitee = _.find response.invitees, (i) -> i.name.toLowerCase() == $routeParams['inviteeName'] $scope.invitee = _.find response.invitees, (i) -> i.name.toLowerCase() == $routeParams['inviteeName']
$scope.$apply() $scope.$apply()
] ]

View File

@@ -1,20 +1,21 @@
lunchControllers = angular.module 'lunchControllers' lunchControllers = angular.module 'lunchControllers'
lunchControllers.controller 'CreateRunCtrl', ['$scope', '$http', '$location', 'socket', ($scope, $http, $location, socket) -> lunchControllers.controller 'CreateRunCtrl', ['$scope', '$http', '$location', 'socket',
$scope.run = CreateRunController = ($scope, $http, $location, socket) ->
creatorName: 'ben ramey' $scope.run =
creatorEmail: 'ben.ramey@gmail.com' creatorName: 'ben ramey'
invitees: [{email: 'bob@bob.com'}] creatorEmail: 'ben.ramey@gmail.com'
restaurant: 'subway' invitees: [{email: 'bob@bob.com'}]
restaurant: 'subway'
$scope.addInvitee = () -> $scope.addInvitee = () ->
$scope.run.invitees.push { email: '' } $scope.run.invitees.push { email: '' }
$scope.create = (run) -> $scope.create = (run) ->
data = angular.copy run data = angular.copy run
socket.post '/run', data, (response) -> socket.post '/run', data, (response) ->
console.log response.id console.log response.id
console.log $location console.log $location
$location.path '/run/' + response.id $location.path '/run/' + response.id
$scope.$apply() $scope.$apply()
] ]

View File

@@ -1,4 +1,5 @@
lunchControllers = angular.module 'lunchControllers' lunchControllers = angular.module 'lunchControllers'
lunchControllers.controller 'HomeCtrl', ['$scope', ($scope) -> lunchControllers.controller 'HomeCtrl', ['$scope',
HomeController = ($scope) ->
] ]