Skip to content

Commit b2f36fa

Browse files
author
Null McNull
committed
Revert "pre/postlink refactor"
This reverts commit e3776ae.
1 parent e3776ae commit b2f36fa

20 files changed

+331
-783
lines changed

bower.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
"showdown": "~0.3.1",
4545
"angular-mocks": "~1.2.22",
4646
"angular-inform": "~0.0.8",
47-
"angular-animate": "~1.2.22",
48-
"animate.css": "~3.2.0"
47+
"angular-animate": "~1.2.22"
4948
},
5049
"overrides": {
5150
"respond": {
Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
var blkUI = angular.module('blockUI', []);
22

3-
blkUI.config(function ($provide, $httpProvider) {
3+
blkUI.config(function($provide, $httpProvider) {
44

55
$provide.decorator('$exceptionHandler', ['$delegate', '$injector',
6-
function ($delegate, $injector) {
6+
function($delegate, $injector) {
77
var blockUI, blockUIConfig;
88

9-
return function (exception, cause) {
9+
return function(exception, cause) {
1010

1111
blockUIConfig = blockUIConfig || $injector.get('blockUIConfig');
1212

@@ -23,17 +23,8 @@ blkUI.config(function ($provide, $httpProvider) {
2323
$httpProvider.interceptors.push('blockUIHttpInterceptor');
2424
});
2525

26-
blkUI.run(function ($document, blockUIConfig, $templateCache) {
27-
if (blockUIConfig.autoInjectBodyBlock) {
26+
blkUI.run(function($document, blockUIConfig, $templateCache) {
27+
if(blockUIConfig.autoInjectBodyBlock) {
2828
$document.find('body').attr('block-ui', 'main');
2929
}
30-
31-
if (blockUIConfig.template) {
32-
33-
// Swap the builtin template with the custom template.
34-
// Create a magic cache key and place the template in the cache.
35-
36-
blockUIConfig.templateUrl = '$$block-ui-template$$';
37-
$templateCache.put(blockUIConfig.templateUrl, blockUIConfig.template);
38-
}
3930
});
Lines changed: 83 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,118 @@
11

22
/* - - - - - - 8-< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
33

4-
.block-ui-anim-fade > .block-ui-container {
4+
.block-ui-fade > .block-ui-container {
55
transition: height 0s ease 200ms, opacity 200ms ease;
66
}
77

8-
.block-ui-anim-fade > .block-ui-container.block-ui-visible {
8+
.block-ui-fade > .block-ui-container.block-ui-visible {
99
/*this resets the initial delay of the height */
1010
/*and sizes the block to full height at once at the start of the block. */
1111
transition-delay: 0s;
12+
/*transition: height 0s ease 0s;*/
1213
}
1314

1415
/* - - - - - - 8-< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
1516

16-
/*@keyframes block-ui-anim-bounce {*/
17-
/*0%, 4%, 10%, 16%, 20% {*/
18-
/*transform: translate3d(0,0,0);*/
19-
/*}*/
17+
@keyframes block-ui-bounce {
18+
0%, 4%, 10%, 16%, 20% {
19+
transform: translate3d(0,0,0);
20+
}
2021

21-
/*8% {*/
22-
/*transform: translate3d(0, -30px, 0);*/
23-
/*}*/
22+
8% {
23+
transform: translate3d(0, -30px, 0);
24+
}
2425

25-
/*14% {*/
26-
/*transform: translate3d(0, -15px, 0);*/
27-
/*}*/
26+
14% {
27+
transform: translate3d(0, -15px, 0);
28+
}
2829

29-
/*18% {*/
30-
/*transform: translate3d(0,-4px,0);*/
31-
/*}*/
30+
18% {
31+
transform: translate3d(0,-4px,0);
32+
}
3233

33-
/*21%, 100% {}*/
34-
/*}*/
34+
21%, 100% {}
35+
}
3536

36-
/*.block-ui-anim-bounce > .block-ui-container.block-ui-visible .block-ui-message {*/
37-
/*animation: block-ui-bounce 4s linear 0s infinite;*/
38-
/*}*/
37+
.block-ui-bounce > .block-ui-container.block-ui-visible .block-ui-message {
38+
animation: block-ui-bounce 4s linear 0s infinite;
39+
}
3940

4041
/* - - - - - - 8-< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
4142

42-
/*@keyframes block-ui-anim-flash {*/
43-
/*0%, 10%, 20% {*/
44-
/*opacity: 1;*/
45-
/*}*/
43+
@keyframes block-ui-flash {
44+
0%, 10%, 20% {
45+
opacity: 1;
46+
}
4647

47-
/*4%, 15% {*/
48-
/*opacity: 0;*/
49-
/*}*/
48+
4%, 15% {
49+
opacity: 0;
50+
}
5051

51-
/*21%, 100% {}*/
52-
/*}*/
52+
21%, 100% {}
53+
}
5354

54-
/*.block-ui-flash > .block-ui-container.block-ui-visible .block-ui-message {*/
55-
/*animation: block-ui-flash 3s linear 0s infinite;*/
56-
/*}*/
55+
.block-ui-flash > .block-ui-container.block-ui-visible .block-ui-message {
56+
animation: block-ui-flash 3s linear 0s infinite;
57+
}
5758

5859
/* - - - - - - 8-< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
5960

60-
/*@keyframes block-ui-anim-pulse {*/
61-
/*0% {*/
62-
/*transform: scale3d(1, 1, 1);*/
63-
/*}*/
61+
@keyframes block-ui-pulse {
62+
0% {
63+
transform: scale3d(1, 1, 1);
64+
}
6465

65-
/*50% {*/
66-
/*transform: scale3d(1.05, 1.05, 1.05);*/
67-
/*}*/
66+
50% {
67+
transform: scale3d(1.05, 1.05, 1.05);
68+
}
6869

69-
/*100% {*/
70-
/*transform: scale3d(1, 1, 1);*/
71-
/*}*/
72-
/*}*/
70+
100% {
71+
transform: scale3d(1, 1, 1);
72+
}
73+
}
7374

74-
/*.block-ui-anim-pulse > .block-ui-container.block-ui-visible .block-ui-message {*/
75-
/*animation: block-ui-pulse 1s ease 0s infinite;*/
76-
/*}*/
75+
.block-ui-pulse > .block-ui-container.block-ui-visible .block-ui-message {
76+
animation: block-ui-pulse 1s ease 0s infinite;
77+
}
7778

7879
/* - - - - - - 8-< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
7980

80-
/*@keyframes block-ui-anim-bounce-in {*/
81-
/*0%, 20%, 40%, 60%, 80%, 100% {*/
82-
/*transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);*/
83-
/*}*/
84-
85-
/*0% {*/
86-
/*opacity: 0;*/
87-
/*transform: scale3d(.3, .3, .3);*/
88-
/*}*/
89-
90-
/*20% {*/
91-
/*transform: scale3d(1.1, 1.1, 1.1);*/
92-
/*}*/
93-
94-
/*40% {*/
95-
/*transform: scale3d(.9, .9, .9);*/
96-
/*}*/
97-
98-
/*60% {*/
99-
/*opacity: 1;*/
100-
/*transform: scale3d(1.03, 1.03, 1.03);*/
101-
/*}*/
102-
103-
/*80% {*/
104-
/*transform: scale3d(.97, .97, .97);*/
105-
/*}*/
106-
107-
/*100% {*/
108-
/*opacity: 1;*/
109-
/*transform: scale3d(1, 1, 1);*/
110-
/*}*/
111-
/*}*/
112-
113-
/*.block-ui-anim-bounce-in > .block-ui-container.block-ui-visible .block-ui-message {*/
114-
/*animation: block-ui-bounce-in 1s ease 0s infinite;*/
115-
/*}*/
81+
@keyframes block-ui-bounce-in {
82+
0%, 20%, 40%, 60%, 80%, 100% {
83+
transition-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
84+
}
85+
86+
0% {
87+
opacity: 0;
88+
transform: scale3d(.3, .3, .3);
89+
}
90+
91+
20% {
92+
transform: scale3d(1.1, 1.1, 1.1);
93+
}
94+
95+
40% {
96+
transform: scale3d(.9, .9, .9);
97+
}
98+
99+
60% {
100+
opacity: 1;
101+
transform: scale3d(1.03, 1.03, 1.03);
102+
}
103+
104+
80% {
105+
transform: scale3d(.97, .97, .97);
106+
}
107+
108+
100% {
109+
opacity: 1;
110+
transform: scale3d(1, 1, 1);
111+
}
112+
}
113+
114+
.block-ui-bounce-in > .block-ui-container.block-ui-visible .block-ui-message {
115+
animation: block-ui-bounce-in 1s ease 0s infinite;
116+
}
116117

117118
/* - - - - - - 8-< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

src/angular-block-ui/block-ui-container-directive.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,16 @@ blkUI.directive('blockUiContainer', function (blockUIConfig, blockUiContainerLin
55
templateUrl: blockUIConfig.templateUrl,
66
link: blockUiContainerLinkFn
77
};
8-
}).factory('blockUiContainerLinkFn', function (blockUI, blockUIConfig, blockUIUtils) {
8+
}).factory('blockUiContainerLinkFn', function (blockUI, blockUIUtils) {
99

1010
return function ($scope, $element, $attrs) {
1111

12-
var ctrl = $ctrls[0];
13-
1412
$element.addClass('block-ui-container');
1513

16-
var srvInstance = ctrl.instance;
17-
var messageClass = ctrl.attrs.cssClassMessage;
18-
19-
if(messageClass) {
20-
var $message = blockUIUtils.findElement($element, 'block-ui-message');
14+
var srvInstance = $element.inheritedData('block-ui');
2115

22-
if($message) {
23-
$message.addClass(messageClass);
24-
}
16+
if (!srvInstance) {
17+
throw new Error('No parent block-ui service instance located.');
2518
}
2619

2720
// Expose the state on the scope

src/angular-block-ui/block-ui-container-directive.test.js

Lines changed: 29 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -56,28 +56,6 @@ describe('block-ui-container-directive', function() {
5656

5757
});
5858

59-
describe('block-ui-message-class', function() {
60-
61-
it('should add classes defined at the parent level', function() {
62-
63-
var className = 'my-custom-class';
64-
$parent.data('block-ui-message-class', className);
65-
66-
$element = $compile($element)($scope);
67-
$scope.$digest();
68-
69-
// <div class="block-ui-overlay"></div>
70-
// <div class="block-ui-message-container" aria-live="assertive" aria-atomic="true">
71-
// <div class="block-ui-message">{{ state.message }}</div>
72-
// </div>
73-
74-
var $message = $($($element.children()[1]).children()[0]);
75-
76-
expect($message.hasClass(className)).toBe(true);
77-
78-
});
79-
});
80-
8159
});
8260

8361
describe('link', function() {
@@ -93,59 +71,55 @@ describe('block-ui-container-directive', function() {
9371
$parent.append($element);
9472
});
9573

96-
describe('element classes', function() {
97-
it('should set the block-ui-container class', function() {
98-
99-
linkFn($scope, $element, $attrs);
100-
101-
expect($element.hasClass('block-ui-container')).toBe(true);
74+
it('should expose the blockstate on the scope', function() {
10275

103-
});
76+
linkFn($scope, $element, $attrs);
10477

105-
it('should set the block-ui-visible class when in blocking state', function() {
78+
expect($scope.state).toBeDefined();
79+
expect($scope.state).toBe(blockInstance.state());
10680

107-
linkFn($scope, $element, $attrs);
108-
expect($element.hasClass('block-ui-visible')).toBe(false);
81+
});
10982

110-
blockInstance.start();
111-
$timeout.flush();
112-
$scope.$digest();
83+
it('should set the block-ui-container class', function() {
11384

114-
expect($element.hasClass('block-ui-visible')).toBe(true);
85+
linkFn($scope, $element, $attrs);
11586

116-
blockInstance.stop();
117-
$scope.$digest();
87+
expect($element.hasClass('block-ui-container')).toBe(true);
11888

119-
expect($element.hasClass('block-ui-visible')).toBe(false);
120-
});
89+
});
12190

122-
it('should set the block-ui-active class when blockcount > 0', function() {
91+
it('should set the block-ui-visible class when in blocking state', function() {
12392

124-
linkFn($scope, $element, $attrs);
125-
expect($element.hasClass('block-ui-active')).toBe(false);
93+
linkFn($scope, $element, $attrs);
94+
expect($element.hasClass('block-ui-visible')).toBe(false);
12695

127-
blockInstance.start();
128-
$scope.$digest();
96+
blockInstance.start();
97+
$timeout.flush();
98+
$scope.$digest();
12999

130-
expect($element.hasClass('block-ui-active')).toBe(true);
100+
expect($element.hasClass('block-ui-visible')).toBe(true);
131101

132-
blockInstance.stop();
133-
$scope.$digest();
102+
blockInstance.stop();
103+
$scope.$digest();
134104

135-
expect($element.hasClass('block-ui-active')).toBe(false);
136-
});
137-
}); // element classes
105+
expect($element.hasClass('block-ui-visible')).toBe(false);
106+
});
138107

139-
it('should expose the blockstate on the scope', function() {
108+
it('should set the block-ui-active class when blockcount > 0', function() {
140109

141110
linkFn($scope, $element, $attrs);
111+
expect($element.hasClass('block-ui-active')).toBe(false);
142112

143-
expect($scope.state).toBeDefined();
144-
expect($scope.state).toBe(blockInstance.state());
113+
blockInstance.start();
114+
$scope.$digest();
145115

146-
});
116+
expect($element.hasClass('block-ui-active')).toBe(true);
147117

118+
blockInstance.stop();
119+
$scope.$digest();
148120

121+
expect($element.hasClass('block-ui-active')).toBe(false);
122+
});
149123

150124
});
151125
});

0 commit comments

Comments
 (0)