]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/web/js/ui/default/staff/acq/app.js
tweak embedding of Dojo acquisitions pages
[Evergreen.git] / Open-ILS / web / js / ui / default / staff / acq / app.js
1 angular.module('egAcquisitions',
2     ['ngRoute', 'ui.bootstrap', 'egCoreMod','egUiMod'])
3
4 .config(['$routeProvider','$locationProvider','$compileProvider', 
5  function($routeProvider , $locationProvider , $compileProvider) {
6
7     $locationProvider.html5Mode(true);
8     $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|blob):/); 
9     var resolver = {delay : function(egStartup) {return egStartup.go()}};
10
11     var eframe_template = 
12         '<eg-embed-frame allow-escape="true" min-height="min_height" url="acq_url" handlers="funcs"></eg-embed-frame>';
13
14     $routeProvider.when('/acq/legacy/:noun/:verb', {
15         template: eframe_template,
16         controller: 'EmbedAcqCtl',
17         resolve : resolver
18     });
19
20     // default page 
21     $routeProvider.otherwise({
22         templateUrl : './t_splash',
23         resolve : resolver
24     });
25 }])
26
27 .controller('EmbedAcqCtl', 
28        ['$scope','$routeParams','$location','egCore',
29 function($scope , $routeParams , $location , egCore) {
30
31     $scope.funcs = {
32         ses : egCore.auth.token(),
33     }
34
35     var acq_path = '/eg/acq/' + 
36         $routeParams.noun + '/' + $routeParams.verb + location.search;
37
38     $scope.min_height = 2000; // give lots of space to start
39
40     // embed URL must include protocol/domain or it will be loaded via
41     // push-state, resulting in an infinitely nested pages.
42     $scope.acq_url = 
43         $location.absUrl().replace(/\/eg\/staff.*/, acq_path);
44
45     console.log('Loading Acq URL: ' + $scope.acq_url);
46
47 }])
48