bastion 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MWFjYWVkN2QxYTY0ZGMwMDMxN2M1OTU1NjcxN2ZmYWIzODAxMThkZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
N2VlNGVjNjRiNzI1MWE4YWM2NmZiNGVkOTU5YjZiNWJjMzMyNGU3ZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
M2RhMWQ5NDhhZmMyMDU4NTNhNTUwOWRhMmI4ZTgyZTBkZDA4M2VmZDBlZjE0
|
10
|
+
ODRlYzNkNDA4YWVjZjM3NTIxMTU3YjMwODdmMGEwMTEwYzBkYWRmZWRlMDk4
|
11
|
+
YzFiNDVhYWY3YzQ2YzRhZGEzNWVhNDY3ZGE0MzNmZWIzMmUxZmM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODc1NWUwMTRiODkzOTU3ZmJmNmIyNWNmZjgxZTU1YWY2ODhiOTlhNjM2MmMx
|
14
|
+
YzIxOTBiYzYzYzBjNmQ5Njc5MWFjOWRkZmJiZTk2ZDUxNDhkODYzNjEyODlk
|
15
|
+
ZDc2NjdiYWY1OGMyYTA2ZjhjYjY0Yzg3NTZjMTgyZDEyMzczNTc=
|
@@ -25,56 +25,52 @@
|
|
25
25
|
angular.module('Bastion.components').directive('bstModal',
|
26
26
|
['$templateCache', '$modal', function ($templateCache, $modal) {
|
27
27
|
return {
|
28
|
-
|
29
|
-
templateUrl: 'components/views/bst-modal.html',
|
30
|
-
replace: true,
|
28
|
+
transclude: true,
|
31
29
|
scope: {
|
32
30
|
action: '&bstModal',
|
33
31
|
modelName: '@model',
|
34
|
-
model: '='
|
35
|
-
modalHeader: '@',
|
36
|
-
modalBody: '@'
|
32
|
+
model: '='
|
37
33
|
},
|
38
|
-
|
39
|
-
|
40
|
-
var modalInstance, modalController, modalId;
|
34
|
+
link: function (scope, iElement, iAttrs, nullCtrl, transclude) {
|
35
|
+
var modalInstance, modalController, modalId;
|
41
36
|
|
42
|
-
|
37
|
+
modalId = 'bstModal%d.html'.replace('%d', Math.random().toString());
|
43
38
|
|
44
|
-
|
45
|
-
|
46
|
-
$scope.modalHeader = scope.modalHeader;
|
47
|
-
$scope.modalBody = scope.modalBody;
|
39
|
+
modalController = ['$scope', '$modalInstance', 'model', function ($scope, $modalInstance, model) {
|
40
|
+
$scope[scope.modelName] = model;
|
48
41
|
|
49
|
-
|
50
|
-
|
51
|
-
|
42
|
+
$scope.ok = function () {
|
43
|
+
$modalInstance.close();
|
44
|
+
};
|
52
45
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
46
|
+
$scope.cancel = function () {
|
47
|
+
$modalInstance.dismiss('cancel');
|
48
|
+
};
|
49
|
+
}];
|
57
50
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
}
|
51
|
+
scope.openModal = function () {
|
52
|
+
modalInstance = $modal.open({
|
53
|
+
templateUrl: modalId,
|
54
|
+
controller: modalController,
|
55
|
+
resolve: {
|
56
|
+
model: function () {
|
57
|
+
return scope[scope.modelName];
|
66
58
|
}
|
67
|
-
}
|
59
|
+
}
|
60
|
+
});
|
68
61
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
62
|
+
modalInstance.result.then(function () {
|
63
|
+
scope.action();
|
64
|
+
});
|
65
|
+
};
|
73
66
|
|
74
|
-
|
67
|
+
scope.$parent.openModal = scope.openModal;
|
75
68
|
|
76
|
-
|
77
|
-
|
69
|
+
transclude(function (clone) {
|
70
|
+
var template = angular.element('<div extend-template="components/views/bst-modal.html"></div>');
|
71
|
+
template.append(clone);
|
72
|
+
$templateCache.put(modalId, template);
|
73
|
+
});
|
78
74
|
}
|
79
75
|
};
|
80
76
|
}]);
|
@@ -1,13 +1,16 @@
|
|
1
|
-
<
|
2
|
-
<
|
3
|
-
<
|
4
|
-
|
5
|
-
|
6
|
-
<
|
7
|
-
|
8
|
-
|
9
|
-
<
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
</
|
1
|
+
<div class="modal-header">
|
2
|
+
<button type="button" class="close" aria-label="Close" ng-click="cancel()">
|
3
|
+
<span aria-hidden="true">×</span>
|
4
|
+
</button>
|
5
|
+
|
6
|
+
<h3 data-block="modal-header"></h3>
|
7
|
+
</div>
|
8
|
+
<div class="modal-body">
|
9
|
+
<p data-block="modal-body"></p>
|
10
|
+
</div>
|
11
|
+
<div class="modal-footer">
|
12
|
+
<button class="btn btn-danger" ng-click="ok()">
|
13
|
+
<span data-block="modal-confirm-button" translate>Remove</span>
|
14
|
+
</button>
|
15
|
+
<button class="btn btn-default" ng-click="cancel()" translate>Cancel</button>
|
16
|
+
</div>
|
data/lib/bastion/version.rb
CHANGED
@@ -15,8 +15,9 @@ describe('Directive: bstModal', function() {
|
|
15
15
|
var scope,
|
16
16
|
compile,
|
17
17
|
$modal,
|
18
|
+
$templateCache,
|
18
19
|
$q,
|
19
|
-
|
20
|
+
modalId,
|
20
21
|
testItem,
|
21
22
|
element,
|
22
23
|
elementScope;
|
@@ -30,12 +31,6 @@ describe('Directive: bstModal', function() {
|
|
30
31
|
delete: function() {}
|
31
32
|
};
|
32
33
|
|
33
|
-
translate = function() {
|
34
|
-
this.$get = function() {
|
35
|
-
return function() {};
|
36
|
-
};
|
37
|
-
};
|
38
|
-
|
39
34
|
$modal = {
|
40
35
|
$get: function() {
|
41
36
|
return this;
|
@@ -50,25 +45,39 @@ describe('Directive: bstModal', function() {
|
|
50
45
|
}
|
51
46
|
};
|
52
47
|
|
53
|
-
$provide.provider('translateFilter', translate);
|
54
48
|
$provide.provider('$modal', $modal);
|
55
49
|
}));
|
56
50
|
|
57
|
-
beforeEach(inject(function(_$compile_, _$rootScope_, _$q_) {
|
51
|
+
beforeEach(inject(function(_$compile_, _$rootScope_, _$q_, _$templateCache_) {
|
58
52
|
compile = _$compile_;
|
59
53
|
scope = _$rootScope_;
|
60
54
|
$q = _$q_;
|
55
|
+
$templateCache = _$templateCache_;
|
61
56
|
}));
|
62
57
|
|
63
58
|
beforeEach(function() {
|
64
|
-
|
65
|
-
|
66
|
-
|
59
|
+
var html = '<span bst-modal="item.delete(item)">' +
|
60
|
+
'<p data-block="modal-header">Header</p>' +
|
61
|
+
'<p data-block="modal-body">Body</p>' +
|
62
|
+
'</span>';
|
63
|
+
|
64
|
+
element = angular.element(html);
|
65
|
+
spyOn($templateCache, 'put').andCallThrough();
|
67
66
|
|
68
67
|
compile(element)(scope);
|
69
68
|
scope.$digest();
|
70
69
|
|
71
70
|
elementScope = element.scope();
|
71
|
+
modalId = $templateCache.put.mostRecentCall.args[0];
|
72
|
+
});
|
73
|
+
|
74
|
+
it("uses angular-blocks to extend a modal template", function () {
|
75
|
+
var modal = $templateCache.get(modalId);
|
76
|
+
|
77
|
+
expect($templateCache.put).toHaveBeenCalled();
|
78
|
+
expect(modal.attr('extend-template')).toBe('components/views/bst-modal.html');
|
79
|
+
expect(modal.find('[data-block="modal-header"]').html()).toBe('Header');
|
80
|
+
expect(modal.find('[data-block="modal-body"]').html()).toBe('Body');
|
72
81
|
});
|
73
82
|
|
74
83
|
it("allows the opening of a modal dialog via bootstrap ui", function() {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bastion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Katello
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: angular-rails-templates
|