2014-05-12 20:08:19 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular.module('ffffng', [
|
|
|
|
'ngSanitize',
|
|
|
|
'ngRoute',
|
|
|
|
'ng',
|
2014-06-06 13:06:31 +02:00
|
|
|
'leaflet-directive',
|
2014-08-10 11:37:05 +02:00
|
|
|
'templates-main',
|
|
|
|
'ui.bootstrap'
|
2014-05-12 20:08:19 +02:00
|
|
|
])
|
2019-08-31 20:23:40 +02:00
|
|
|
.config(function ($logProvider, $locationProvider, $routeProvider) {
|
2016-05-16 21:58:17 +02:00
|
|
|
$logProvider.debugEnabled(false);
|
2019-08-31 20:23:40 +02:00
|
|
|
$locationProvider.hashPrefix('');
|
|
|
|
$locationProvider.html5Mode(false);
|
2014-05-12 20:08:19 +02:00
|
|
|
$routeProvider
|
|
|
|
.when('/', {
|
|
|
|
templateUrl: 'views/main.html',
|
|
|
|
controller: 'MainCtrl',
|
|
|
|
title: 'Willkommen'
|
|
|
|
})
|
|
|
|
.when('/new', {
|
|
|
|
templateUrl: 'views/newNodeForm.html',
|
|
|
|
controller: 'NewNodeCtrl',
|
|
|
|
title: 'Neuen Knoten anmelden'
|
|
|
|
})
|
|
|
|
.when('/update', {
|
|
|
|
templateUrl: 'views/updateNodeForm.html',
|
|
|
|
controller: 'UpdateNodeCtrl',
|
|
|
|
title: 'Knotendaten ändern'
|
|
|
|
})
|
2016-05-16 18:27:03 +02:00
|
|
|
.when('/delete', {
|
|
|
|
templateUrl: 'views/deleteNodeForm.html',
|
|
|
|
controller: 'DeleteNodeCtrl',
|
|
|
|
title: 'Knoten löschen'
|
|
|
|
})
|
2016-05-18 22:50:06 +02:00
|
|
|
.when('/monitoring/confirm', {
|
|
|
|
templateUrl: 'views/confirmMonitoring.html',
|
|
|
|
controller: 'ConfirmMonitoringCtrl',
|
|
|
|
title: 'Versand von Status-E-Mails bestätigen'
|
|
|
|
})
|
2016-05-18 23:15:43 +02:00
|
|
|
.when('/monitoring/disable', {
|
|
|
|
templateUrl: 'views/disableMonitoring.html',
|
|
|
|
controller: 'DisableMonitoringCtrl',
|
|
|
|
title: 'Versand von Status-E-Mails deaktivieren'
|
|
|
|
})
|
2014-05-12 20:08:19 +02:00
|
|
|
.otherwise({
|
2019-08-31 20:23:40 +02:00
|
|
|
resolveRedirectTo: function ($location) {
|
|
|
|
var url = $location.url();
|
|
|
|
if (url.startsWith('/!/')) {
|
|
|
|
return url.substring(3);
|
|
|
|
}
|
|
|
|
return '/';
|
|
|
|
}
|
2014-05-12 20:08:19 +02:00
|
|
|
});
|
|
|
|
})
|
|
|
|
.service('Navigator', function ($location) {
|
|
|
|
return {
|
|
|
|
home: function () {
|
|
|
|
$location.url('/');
|
|
|
|
},
|
|
|
|
newNode: function () {
|
|
|
|
$location.url('/new');
|
|
|
|
},
|
|
|
|
updateNode: function () {
|
|
|
|
$location.url('/update');
|
2016-05-16 18:27:03 +02:00
|
|
|
},
|
|
|
|
deleteNode: function () {
|
|
|
|
$location.url('/delete');
|
2014-05-12 20:08:19 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
})
|
2016-07-19 11:41:32 +02:00
|
|
|
.run(function ($location, $rootScope, $window, config) {
|
2014-05-12 20:08:19 +02:00
|
|
|
$rootScope.$on('$routeChangeSuccess', function (event, current) {
|
2016-07-19 11:41:32 +02:00
|
|
|
$window.scrollTo(0, 0);
|
2016-06-20 22:28:01 +02:00
|
|
|
$rootScope.title = current.$$route ? (current.$$route.title || '') : '';
|
2014-05-31 19:19:36 +02:00
|
|
|
$rootScope.config = config;
|
2014-05-12 20:08:19 +02:00
|
|
|
});
|
2014-05-31 19:19:36 +02:00
|
|
|
});
|