Angular stuff

This commit is contained in:
Ben Ramey
2014-03-11 22:11:39 -05:00
parent 93931cf4b2
commit e18e186be0
12 changed files with 18 additions and 77 deletions

1
.gitignore vendored
View File

@@ -48,4 +48,5 @@ config/local.js
# custom ignores # custom ignores
######################## ########################
assets/templates/*.html assets/templates/*.html
*.swp

View File

@@ -17,7 +17,9 @@ module.exports = {
type: 'email', type: 'email',
required: true required: true
}, },
groupEmails: 'String', groupEmails: {
type: 'array'
},
menuUrl: { menuUrl: {
type: 'url' type: 'url'
}, },

Binary file not shown.

View File

@@ -3,10 +3,11 @@ lunchControllers = angular.module 'lunchControllers', []
lunchControllers.controller 'HomeCtrl', ['$scope', ($scope) -> lunchControllers.controller 'HomeCtrl', ['$scope', ($scope) ->
] ]
lunchControllers.controller 'CreateRunCtrl', ['$scope', '$http', ($scope, $http) -> lunchControllers.controller 'CreateRunCtrl', ['$scope', '$http', 'socket', ($scope, $http, socket) ->
$scope.msg = 'im home, yah' $scope.stuffs = [{name: 'my name'}]
$scope.create = (run) -> $scope.create = (run) ->
socket.post '/run', run, (response) ->
] ]
lunchControllers.controller 'RunsCtrl', ['$scope', '$http', ($scope, $http) -> lunchControllers.controller 'RunsCtrl', ['$scope', '$http', ($scope, $http) ->

View File

@@ -1,71 +0,0 @@
/**
* app.js
*
* This file contains some conventional defaults for working with Socket.io + Sails.
* It is designed to get you up and running fast, but is by no means anything special.
*
* Feel free to change none, some, or ALL of this file to fit your needs!
*/
(function (io) {
// as soon as this file is loaded, connect automatically,
var socket = io.connect();
if (typeof console !== 'undefined') {
log('Connecting to Sails.js...');
}
socket.on('connect', function socketConnected() {
// Listen for Comet messages from Sails
socket.on('message', function messageReceived(message) {
///////////////////////////////////////////////////////////
// Replace the following with your own custom logic
// to run when a new message arrives from the Sails.js
// server.
///////////////////////////////////////////////////////////
log('New comet message received :: ', message);
//////////////////////////////////////////////////////
});
///////////////////////////////////////////////////////////
// Here's where you'll want to add any custom logic for
// when the browser establishes its socket connection to
// the Sails.js server.
///////////////////////////////////////////////////////////
log(
'Socket is now connected and globally accessible as `socket`.\n' +
'e.g. to send a GET request to Sails, try \n' +
'`socket.get("/", function (response) ' +
'{ console.log(response); })`'
);
///////////////////////////////////////////////////////////
});
// Expose connected `socket` instance globally so that it's easy
// to experiment with from the browser console while prototyping.
window.socket = socket;
// Simple log function to keep the example simple
function log () {
if (typeof console !== 'undefined') {
console.log.apply(console, arguments);
}
}
})(
// In case you're wrapping socket.io to prevent pollution of the global namespace,
// you can replace `window.io` with your own `io` here:
window.io
);

View File

@@ -0,0 +1,8 @@
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
return socket

Binary file not shown.

Binary file not shown.

View File

@@ -18,5 +18,5 @@
div.form-group div.form-group
label(for='menuUrl') Menu URL label(for='menuUrl') Menu URL
input#menuUrl.form-control(type='url',ng-model='run.menuUrl') input#menuUrl.form-control(type='url',ng-model='run.menuUrl')
button.btn.btn-primary(ng-click="create(run)",ng-disabled="form.$invalid") Create button.btn.btn-primary(ng-click="create(run)",ng-disabled="form.$invalid") Create

Binary file not shown.

View File

@@ -27,5 +27,5 @@ html(lang="en",ng-app="lunchApp")
script(type="text/javascript", src="/linker/js/vendor/angular-route.js") script(type="text/javascript", src="/linker/js/vendor/angular-route.js")
script(type="text/javascript", src="/linker/js/app.js") script(type="text/javascript", src="/linker/js/app.js")
script(type="text/javascript", src="/linker/js/controllers.js") script(type="text/javascript", src="/linker/js/controllers.js")
script(type="text/javascript", src="/linker/js/features/socket.js") script(type="text/javascript", src="/linker/js/services/socket.js")
// SCRIPTS END // SCRIPTS END