|
@@ -6,7 +6,9 @@ angular.module('luticateUtils')
|
6
|
6
|
.directive('luBusy', ['$compile', '$http', 'luticatePromises', '$templateCache', function($compile, $http, luticatePromises, $templateCache){
|
7
|
7
|
return {
|
8
|
8
|
restrict: 'A',
|
9
|
|
- scope: {},
|
|
9
|
+ scope: {
|
|
10
|
+ luBusy: '&'
|
|
11
|
+ },
|
10
|
12
|
link: function($scope, element, attrs) {
|
11
|
13
|
|
12
|
14
|
var position = element.css('position');
|
|
@@ -17,17 +19,29 @@ angular.module('luticateUtils')
|
17
|
19
|
$scope.isLoading = false;
|
18
|
20
|
$scope.hasError = false;
|
19
|
21
|
|
|
22
|
+ var options = {
|
|
23
|
+ group: attrs.luBusy,
|
|
24
|
+ templateLoader: "luticate-loader.html",
|
|
25
|
+ templateError: "luticate-error.html"
|
|
26
|
+ };
|
|
27
|
+
|
|
28
|
+ var o = $scope.luBusy();
|
|
29
|
+ if (o != null) {
|
|
30
|
+ angular.extend(options, o);
|
|
31
|
+ }
|
|
32
|
+
|
|
33
|
+ console.log(options);
|
|
34
|
+
|
20
|
35
|
$scope.update = function()
|
21
|
36
|
{
|
22
|
|
- var group = attrs.luBusy;
|
23
|
|
- var loaders = luticatePromises.getLoadersGroup(group);
|
|
37
|
+ var loaders = luticatePromises.getLoadersGroup(options.group);
|
24
|
38
|
$scope.isLoading = false;
|
25
|
39
|
if (loaders != null) {
|
26
|
40
|
$scope.isLoading = loaders.some(function (promise) {
|
27
|
41
|
return promise.status == 0;
|
28
|
42
|
});
|
29
|
43
|
}
|
30
|
|
- var errors = luticatePromises.getErrorsGroup(group);
|
|
44
|
+ var errors = luticatePromises.getErrorsGroup(options.group);
|
31
|
45
|
$scope.hasError = false;
|
32
|
46
|
if (errors != null) {
|
33
|
47
|
$scope.hasError = errors.some(function (promise) {
|
|
@@ -61,8 +75,8 @@ angular.module('luticateUtils')
|
61
|
75
|
throw new Error('Template specified for luBusy (' + template + ') could not be loaded. ' + data);
|
62
|
76
|
});
|
63
|
77
|
}
|
64
|
|
- addTemplate('luticate-busy.html', 'loaderSplashIsActive()');
|
65
|
|
- addTemplate('luticate-error.html', 'errorSplashIsActive()');
|
|
78
|
+ addTemplate(options.templateLoader, 'loaderSplashIsActive()');
|
|
79
|
+ addTemplate(options.templateError, 'errorSplashIsActive()');
|
66
|
80
|
}
|
67
|
81
|
};
|
68
|
82
|
}
|
|
@@ -71,7 +85,7 @@ angular.module('luticateUtils')
|
71
|
85
|
angular.module('luticateUtils').run(['$templateCache', function($templateCache) {
|
72
|
86
|
'use strict';
|
73
|
87
|
|
74
|
|
- $templateCache.put('luticate-busy.html',
|
|
88
|
+ $templateCache.put('luticate-loader.html',
|
75
|
89
|
"<div class=\"lu-busy-default-wrapper\" style=\"position: absolute; top: 0px; left: 0px; right: 0px; bottom: 0px;\">\n" +
|
76
|
90
|
"\n" +
|
77
|
91
|
" <div class=\"lu-busy-default-sign\">\n" +
|