Working run save
This commit is contained in:
@@ -17,7 +17,7 @@ module.exports = {
|
||||
type: 'email',
|
||||
required: true
|
||||
},
|
||||
groupEmails: {
|
||||
invitees: {
|
||||
type: 'array'
|
||||
},
|
||||
menuUrl: {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
lunchApp = angular.module 'lunchApp', [
|
||||
'ngRoute',
|
||||
'lunchControllers'
|
||||
'lunchControllers',
|
||||
'lunchServices'
|
||||
]
|
||||
|
||||
lunchApp.config ['$routeProvider',
|
||||
@@ -9,7 +10,7 @@ lunchApp.config ['$routeProvider',
|
||||
.when '/',
|
||||
templateUrl: 'templates/home.html',
|
||||
controller: 'HomeCtrl'
|
||||
.when '/runs',
|
||||
.when '/runs',
|
||||
templateUrl: 'templates/runs.html',
|
||||
controller: 'RunsCtrl'
|
||||
]
|
||||
|
||||
@@ -4,10 +4,16 @@ lunchControllers.controller 'HomeCtrl', ['$scope', ($scope) ->
|
||||
]
|
||||
|
||||
lunchControllers.controller 'CreateRunCtrl', ['$scope', '$http', 'socket', ($scope, $http, socket) ->
|
||||
$scope.stuffs = [{name: 'my name'}]
|
||||
$scope.run =
|
||||
invitees: [{email: ''}]
|
||||
|
||||
$scope.addInvitee = () ->
|
||||
$scope.run.invitees.push { email: '' }
|
||||
|
||||
$scope.create = (run) ->
|
||||
socket.post '/run', run, (response) ->
|
||||
|
||||
data = angular.copy run
|
||||
socket.post '/run', data, (response) ->
|
||||
return
|
||||
]
|
||||
|
||||
lunchControllers.controller 'RunsCtrl', ['$scope', '$http', ($scope, $http) ->
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
socketModule = angular.module 'socketModule', []
|
||||
socketModule.factory 'socket', ()->
|
||||
s = window.io.connect()
|
||||
s.on 'connect', ()->
|
||||
s.on 'message', (message)->
|
||||
console.log 'New comet message received :: ', message
|
||||
lunchServices = angular.module 'lunchServices', []
|
||||
|
||||
return socket
|
||||
lunchServices.factory 'socket', () ->
|
||||
s = window.io.connect()
|
||||
s.on 'connect', () ->
|
||||
s.on 'message', (message) ->
|
||||
console.log 'New comet message received :: '
|
||||
console.log message
|
||||
|
||||
return s
|
||||
|
||||
22
assets/templates/create-run.jade
Normal file
22
assets/templates/create-run.jade
Normal file
@@ -0,0 +1,22 @@
|
||||
div(ng-controller='CreateRunCtrl')
|
||||
h2 Create a new run yo
|
||||
form(name='form',novalidate,role='form')
|
||||
div.form-group
|
||||
label(for='creatorName') Your name
|
||||
input#creatorName.form-control(type='text',ng-model='run.creatorName',required)
|
||||
div.form-group
|
||||
label(for='creatorEmail') Your email
|
||||
input#creatorEmail.form-control(type='email',ng-model='run.creatorEmail',required)
|
||||
div.form-group
|
||||
label(for='groupEmails') Group emails
|
||||
span(ng-repeat='i in run.invitees')
|
||||
input#groupEmail.form-control(ng-model='i.email',required)
|
||||
button.btn.btn-default(ng-click='addInvitee()') Add
|
||||
div.form-group
|
||||
label(for='restaurant') Restaurant
|
||||
input#restaurant.form-control(type='text',ng-model='run.restaurant')
|
||||
div.form-group
|
||||
label(for='menuUrl') Menu URL
|
||||
input#menuUrl.form-control(type='url',ng-model='run.menuUrl')
|
||||
|
||||
button.btn.btn-primary(ng-click="create(run)",ng-disabled="form.$invalid") Create
|
||||
@@ -1,22 +1,3 @@
|
||||
.row
|
||||
.col-xs-12.col-sm-12.col-md-12.col-lg-12
|
||||
div(ng-controller='CreateRunCtrl')
|
||||
h2 Create a new run
|
||||
form(name='form',novalidate,role='form')
|
||||
div.form-group
|
||||
label(for='creatorName') Your name
|
||||
input#creatorName.form-control(type='text',ng-model='run.creatorName',required)
|
||||
div.form-group
|
||||
label(for='creatorEmail') Your email
|
||||
input#creatorEmail.form-control(type='email',ng-model='run.creatorEmail',required)
|
||||
div.form-group
|
||||
label(for='groupEmails') Group emails
|
||||
textarea#groupEmails.form-control(ng-model='run.groupEmails',required)
|
||||
div.form-group
|
||||
label(for='restaurant') Restaurant
|
||||
input#restaurant.form-control(type='text',ng-model='run.restaurant')
|
||||
div.form-group
|
||||
label(for='menuUrl') Menu URL
|
||||
input#menuUrl.form-control(type='url',ng-model='run.menuUrl')
|
||||
|
||||
button.btn.btn-primary(ng-click="create(run)",ng-disabled="form.$invalid") Create
|
||||
include create-run
|
||||
|
||||
Reference in New Issue
Block a user