1 angular.module('egSerialsApp', ['ui.bootstrap','ngRoute','egCoreMod','egGridMod','ngToast','egSerialsMod','egMfhdMod','egMarcMod','egSerialsAppDep']);
2 angular.module('egSerialsAppDep', []);
4 angular.module('egSerialsApp')
5 .config(['ngToastProvider', function(ngToastProvider) {
6 ngToastProvider.configure({
7 verticalPosition: 'bottom',
12 .config(function($routeProvider, $locationProvider, $compileProvider) {
13 $locationProvider.html5Mode(true);
14 $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|mailto|blob):/); // grid export
16 var resolver = {delay : function(egStartup) {return egStartup.go()}};
18 $routeProvider.when('/serials/:bib_id', {
19 templateUrl: './serials/t_manage',
20 controller: 'ManageCtrl',
24 $routeProvider.when('/serials/:bib_id/:active_tab', {
25 templateUrl: './serials/t_manage',
26 controller: 'ManageCtrl',
30 $routeProvider.when('/serials/:bib_id/:active_tab/:subscription_id', {
31 templateUrl: './serials/t_manage',
32 controller: 'ManageCtrl',
37 .controller('ManageCtrl',
38 ['$scope','$routeParams','$location','egSerialsCoreSvc',
39 function($scope , $routeParams , $location , egSerialsCoreSvc) {
40 $scope.bib_id = $routeParams.bib_id;
41 $scope.active_tab = $routeParams.active_tab ? $routeParams.active_tab : 'manage-subscriptions';
42 $scope.ssub = {id : null};
43 if ($routeParams.subscription_id) {
44 egSerialsCoreSvc.verify_subscription_id($scope.bib_id, $routeParams.subscription_id)
45 .then(function(verified) {
47 $scope.ssub.id = $routeParams.subscription_id;
49 // subscription ID is no good, so drop it from the URL
50 $location.path('/serials/' + $scope.bib_id + '/' + $scope.active_tab);
54 $scope.$watch('ssub.id', function(newVal, oldVal) {
55 if (oldVal != newVal) {
56 $location.path('/serials/' + $scope.bib_id + '/' + $scope.active_tab +
57 '/' + $scope.ssub.id);
60 $scope.$watch('active_tab', function(newVal, oldVal) {
61 if (oldVal != newVal) {
62 var new_path = '/serials/' + $scope.bib_id + '/' + $scope.active_tab;
63 if ($scope.ssub.id && $scope.active_tab != 'manage-subscriptions') {
64 new_path += '/' + $scope.ssub.id;
66 $location.path(new_path);