diff --git a/lib/roles/webpack-config.js b/lib/roles/webpack-config.js index 9d4a9567..d7cb40c7 100644 --- a/lib/roles/webpack-config.js +++ b/lib/roles/webpack-config.js @@ -6,7 +6,8 @@ var pathutil = require('../util/pathutil') module.exports = webpackMiddleware(webpack({ cache: true, debug: true, - devtool: 'eval-source-map', +// devtool: 'eval-source-map', + devtool: 'eval', entry: pathutil.resource('app') + '/app.js', output: { path: '/static/build/', diff --git a/res/app/components/device-control/index.js b/res/app/app-styles.js similarity index 100% rename from res/app/components/device-control/index.js rename to res/app/app-styles.js diff --git a/res/app/app.js b/res/app/app.js index 9122ecec..2084dc23 100644 --- a/res/app/app.js +++ b/res/app/app.js @@ -1,9 +1,11 @@ require('angular') require('angular-route') +require('./app-styles') + angular.module('app', [ 'ngRoute', - require('./components/device-list').name + require('./device-list').name ]) .config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) { diff --git a/res/app/components/device-list/index.js b/res/app/components/control/index.js similarity index 80% rename from res/app/components/device-list/index.js rename to res/app/components/control/index.js index 17b7ed9c..97cbdc2e 100644 --- a/res/app/components/device-list/index.js +++ b/res/app/components/control/index.js @@ -9,4 +9,4 @@ module.exports = angular.module('device-list', []) controller: 'DeviceListCtrl' }) }]) - .controller('DeviceListCtrl', require('./DeviceListCtrl')); + .controller('DeviceListCtrl', require('./device-list-controller')); diff --git a/res/app/components/device-list/DeviceListCtrl.js b/res/app/components/device-list/DeviceListCtrl.js deleted file mode 100644 index 918bce44..00000000 --- a/res/app/components/device-list/DeviceListCtrl.js +++ /dev/null @@ -1,46 +0,0 @@ -module.exports = function DeviceListCtrl($scope) { - - $scope.devices = [ - {serial: '1231231', present: true, owner: {email: 'fefe@f.com'}}, - {serial: '123122', present: true, owner: {email: 'fefe2@f.com'}} - ]; - - $scope.invite = function (device) { - groupService.invite({ - serial: { - value: device.serial, match: 'exact' - } - }) - } - - $scope.kick = function (device) { - groupService.kick({ - serial: { - value: device.serial, match: 'exact' - } - }) - } - -}; - - -//module.exports = function DeviceListCtrl($scope, deviceService, groupService) { -// -// $scope.devices = deviceService.devices -// -// $scope.invite = function (device) { -// groupService.invite({ -// serial: { -// value: device.serial, match: 'exact' -// } -// }) -// } -// -// $scope.kick = function (device) { -// groupService.kick({ -// serial: { -// value: device.serial, match: 'exact' -// } -// }) -// } -//} diff --git a/res/app/components/socket/index.js b/res/app/components/socket/index.js new file mode 100644 index 00000000..cc3d1e6b --- /dev/null +++ b/res/app/components/socket/index.js @@ -0,0 +1,4 @@ +require('angular') + +module.exports = angular.module('socket', []) + .factory('SocketService', require('./socket-service')); diff --git a/res/app/components/socket/socket-service.js b/res/app/components/socket/socket-service.js new file mode 100644 index 00000000..995f16c2 --- /dev/null +++ b/res/app/components/socket/socket-service.js @@ -0,0 +1,6 @@ +var io = require('socket.io') + +module.exports = function SocketServiceFactory() { + var socketService = io.connect() + return socketService +} diff --git a/res/app/device-control/index.js b/res/app/device-control/index.js new file mode 100644 index 00000000..e69de29b diff --git a/res/app/components/device-list/device-list.css b/res/app/device-list/device-list.css similarity index 100% rename from res/app/components/device-list/device-list.css rename to res/app/device-list/device-list.css diff --git a/res/app/components/device-list/device-list.jade b/res/app/device-list/device-list.jade similarity index 100% rename from res/app/components/device-list/device-list.jade rename to res/app/device-list/device-list.jade diff --git a/res/app/device-list/index.js b/res/app/device-list/index.js new file mode 100644 index 00000000..08bcbdd7 --- /dev/null +++ b/res/app/device-list/index.js @@ -0,0 +1,13 @@ +require('angular') +require('./device-list.css') + +module.exports = angular.module('device-list', [ + require('./../components/socket').name +]) + .config(['$routeProvider', function ($routeProvider) { + $routeProvider.when('/devices', { + template: require('./device-list.jade'), + controller: 'DeviceListCtrl' + }) + }]) + .controller('DeviceListCtrl', require('./device-list-controller')) diff --git a/res/app/components/device-screen/index.js b/res/app/device-screen/index.js similarity index 100% rename from res/app/components/device-screen/index.js rename to res/app/device-screen/index.js