Angular stuff
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -48,4 +48,5 @@ config/local.js
|
|||||||
# custom ignores
|
# custom ignores
|
||||||
########################
|
########################
|
||||||
assets/templates/*.html
|
assets/templates/*.html
|
||||||
|
*.swp
|
||||||
|
|
||||||
|
|||||||
@@ -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.
Binary file not shown.
@@ -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) ->
|
||||||
|
|||||||
@@ -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
|
|
||||||
|
|
||||||
);
|
|
||||||
8
assets/linker/js/services/socket.coffee
Normal file
8
assets/linker/js/services/socket.coffee
Normal 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.
Binary file not shown.
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user