mirror of
https://github.com/openstf/stf
synced 2025-10-05 10:39:25 +02:00
Refactoring to use Google Angular Best Practices.
This commit is contained in:
parent
6df8ed7184
commit
80d0bb7ad2
12 changed files with 29 additions and 49 deletions
|
@ -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/',
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -9,4 +9,4 @@ module.exports = angular.module('device-list', [])
|
|||
controller: 'DeviceListCtrl'
|
||||
})
|
||||
}])
|
||||
.controller('DeviceListCtrl', require('./DeviceListCtrl'));
|
||||
.controller('DeviceListCtrl', require('./device-list-controller'));
|
|
@ -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'
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
//}
|
4
res/app/components/socket/index.js
Normal file
4
res/app/components/socket/index.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
require('angular')
|
||||
|
||||
module.exports = angular.module('socket', [])
|
||||
.factory('SocketService', require('./socket-service'));
|
6
res/app/components/socket/socket-service.js
Normal file
6
res/app/components/socket/socket-service.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
var io = require('socket.io')
|
||||
|
||||
module.exports = function SocketServiceFactory() {
|
||||
var socketService = io.connect()
|
||||
return socketService
|
||||
}
|
0
res/app/device-control/index.js
Normal file
0
res/app/device-control/index.js
Normal file
13
res/app/device-list/index.js
Normal file
13
res/app/device-list/index.js
Normal file
|
@ -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'))
|
Loading…
Add table
Add a link
Reference in a new issue