40 lines
1.2 KiB
JavaScript
40 lines
1.2 KiB
JavaScript
var app = angular.module('infoApp', ['ngAnimate', 'ngRoute']);
|
|
|
|
app.controller('infoscreen_main', function($scope,$http,$timeout){
|
|
var templates = [];
|
|
$scope.init = function(rot){
|
|
$scope.rotation = rot;
|
|
get_rotation();
|
|
}
|
|
var get_rotation = function(){
|
|
$scope.index = -1;
|
|
$http.get('/infoscreen/rotation/'+$scope.rotation).then(function(response){
|
|
templates = response.data.instances;
|
|
$scope.next();
|
|
});
|
|
}
|
|
|
|
$scope.next = function(){
|
|
$scope.index++;
|
|
if ($scope.index >= templates.length){
|
|
return get_rotation();
|
|
}
|
|
var temp = templates[$scope.index];
|
|
$scope.active = {
|
|
template: temp.item.template_url,
|
|
onload: function(){
|
|
for (key in temp.item.options){
|
|
$scope[key] = temp.item.options[key]
|
|
}
|
|
}
|
|
};
|
|
$timeout($scope.next, temp.duration * 1000);
|
|
}
|
|
});
|
|
app.controller('ABBController', function($scope, $http){
|
|
$scope.jobs = [];
|
|
$http.get("/infoscreen/abbjobs").then(function(response){
|
|
$scope.jobs = response.data;
|
|
})
|
|
});
|