run watch page

This commit is contained in:
Ben Ramey
2014-03-14 11:12:42 -05:00
parent 026d98ed23
commit 6f3d47ff6e
6 changed files with 32 additions and 3 deletions

View File

@@ -9,6 +9,10 @@
module.exports = { module.exports = {
attributes: { attributes: {
name: {
type: 'string',
required: true
},
creatorName: { creatorName: {
type: 'string', type: 'string',
required: true required: true

View File

@@ -13,6 +13,8 @@ lunchApp.config ['$routeProvider',
.when '/run/:id', .when '/run/:id',
templateUrl: 'templates/run.html', templateUrl: 'templates/run.html',
controller: 'RunCtrl' controller: 'RunCtrl'
.otherwise
redirectTo: '/'
] ]
lunchApp.config ['$locationProvider', lunchApp.config ['$locationProvider',

View File

@@ -16,4 +16,5 @@ lunchControllers.controller 'CreateRunCtrl', ['$scope', '$http', '$location', 's
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()
] ]

View File

@@ -1,4 +1,13 @@
lunchControllers = angular.module 'lunchControllers' lunchControllers = angular.module 'lunchControllers'
lunchControllers.controller 'RunCtrl', ['$scope', ($scope) -> lunchControllers.controller 'RunCtrl', ['$scope', 'socket', '$routeParams', ($scope, socket, $routeParams) ->
$scope.show = false
socket.get '/run',
where:
id: $routeParams['id'],
(response) ->
$scope.show = true
$scope.run = response[0]
$scope.$apply()
] ]

View File

@@ -1,6 +1,9 @@
div(ng-controller='CreateRunCtrl') div(ng-controller='CreateRunCtrl')
h2 Create a new run yo h2 Create a new run yo
form(name='form',novalidate,role='form') form(name='form',novalidate,role='form')
div.form-group
label(for='name') Name your run
input#name.form-control(type='text',ng-model='run.name',required)
div.form-group div.form-group
label(for='creatorName') Your name label(for='creatorName') Your name
input#creatorName.form-control(type='text',ng-model='run.creatorName',required) input#creatorName.form-control(type='text',ng-model='run.creatorName',required)
@@ -10,7 +13,12 @@ div(ng-controller='CreateRunCtrl')
div.form-group div.form-group
label(for='groupEmails') Group emails label(for='groupEmails') Group emails
span(ng-repeat='i in run.invitees') span(ng-repeat='i in run.invitees')
input#groupEmail.form-control(ng-model='i.email',required) .form-group
label Name
input.form-control(ng-model='i.name',required)
.form-group
label Email
input.form-control(ng-model='i.email',required)
button.btn.btn-default(ng-click='addInvitee()') Add button.btn.btn-default(ng-click='addInvitee()') Add
div.form-group div.form-group
label(for='restaurant') Restaurant label(for='restaurant') Restaurant

View File

@@ -1 +1,6 @@
span hello there folks! div(ng-show="show")
h2 {{ run.name }}
p {{ run.creatorName }}, here's your lunch run! Wait here to see real-time updates of your invitees' orders.
div(ng-repeat="i in run.invitees")
p {{ i.name }}, {{ i.email }}