bastion 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/bastion/components/bst-modal.directive.js +13 -9
- data/app/assets/javascripts/bastion/components/views/bst-modal.html +6 -4
- data/app/assets/javascripts/bastion/routing.module.js +13 -3
- data/lib/bastion/version.rb +1 -1
- data/test/components/bst-modal.directive.test.js +14 -0
- data/test/routing.module.test.js +5 -0
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f40e45968eef402e29e6881759d26a013a601dcc
|
4
|
+
data.tar.gz: 605dc9d2da6569ecdb79418c2546b74bac899cba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51c603a77faa26e724ff788b533b98c250d07a42d03c57df783539a3657a1d75f3838a7106c30f95b6b939db7987d0466be2c630d10aab4398543cb46f5c8315
|
7
|
+
data.tar.gz: 69dfb2786cb0556947b2b773ea689a24b69894e2888c33f4112d8a1ef380d27f79a79399f55fc9e841aa70ea7602c8bc6a1823017a7251259589d34ea6467561
|
@@ -15,17 +15,21 @@ angular.module('Bastion.components').directive('bstModal',
|
|
15
15
|
scope: {
|
16
16
|
action: '&bstModal',
|
17
17
|
modelName: '@model',
|
18
|
-
model: '='
|
18
|
+
model: '=',
|
19
|
+
templateUrl: '@'
|
19
20
|
},
|
20
|
-
compile: function(tElement) {
|
21
|
-
var template = angular.element('<div extend-template="components/views/bst-modal.html"></div>'),
|
21
|
+
compile: function(tElement, tAttrs) {
|
22
|
+
var template = angular.element('<div extend-template="components/views/bst-modal.html"></div>'),
|
23
|
+
templateUrl = tAttrs.templateUrl;
|
22
24
|
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
if (!templateUrl) {
|
26
|
+
template.append(tElement.children());
|
27
|
+
tElement.html('');
|
28
|
+
tElement = angular.element(template);
|
26
29
|
|
27
|
-
|
28
|
-
|
30
|
+
templateUrl = 'bstModal%d.html'.replace('%d', Math.random().toString());
|
31
|
+
$templateCache.put(templateUrl, tElement);
|
32
|
+
}
|
29
33
|
|
30
34
|
return function (scope) {
|
31
35
|
var modalInstance, modalController;
|
@@ -44,7 +48,7 @@ angular.module('Bastion.components').directive('bstModal',
|
|
44
48
|
|
45
49
|
scope.openModal = function () {
|
46
50
|
modalInstance = $uibModal.open({
|
47
|
-
templateUrl:
|
51
|
+
templateUrl: templateUrl,
|
48
52
|
controller: modalController,
|
49
53
|
resolve: {
|
50
54
|
model: function () {
|
@@ -9,8 +9,10 @@
|
|
9
9
|
<p data-block="modal-body"></p>
|
10
10
|
</div>
|
11
11
|
<div class="modal-footer">
|
12
|
-
<
|
13
|
-
<
|
14
|
-
|
15
|
-
|
12
|
+
<div data-block="modal-footer">
|
13
|
+
<button class="btn btn-danger" ng-click="ok()">
|
14
|
+
<span data-block="modal-confirm-button" translate>Remove</span>
|
15
|
+
</button>
|
16
|
+
<button class="btn btn-default" ng-click="cancel()" translate>Cancel</button>
|
17
|
+
</div>
|
16
18
|
</div>
|
@@ -14,7 +14,7 @@ angular.module('Bastion.routing', ['ui.router']);
|
|
14
14
|
* Routing configuration for Bastion.
|
15
15
|
*/
|
16
16
|
function bastionRouting($stateProvider, $urlRouterProvider, $locationProvider) {
|
17
|
-
var oldBrowserBastionPath = '/bastion#', getRootPath;
|
17
|
+
var oldBrowserBastionPath = '/bastion#', getRootPath, shouldRemoveTrailingSlash;
|
18
18
|
|
19
19
|
getRootPath = function (path) {
|
20
20
|
var rootPath = null;
|
@@ -25,6 +25,16 @@ angular.module('Bastion.routing', ['ui.router']);
|
|
25
25
|
return rootPath;
|
26
26
|
};
|
27
27
|
|
28
|
+
shouldRemoveTrailingSlash = function (path) {
|
29
|
+
var whiteList = ['pulp'], remove = true;
|
30
|
+
|
31
|
+
if (path.split('/')[1] && whiteList.indexOf(path.split('/')[1]) >= 0) {
|
32
|
+
remove = false;
|
33
|
+
}
|
34
|
+
|
35
|
+
return remove;
|
36
|
+
};
|
37
|
+
|
28
38
|
$stateProvider.state('404', {
|
29
39
|
permission: null,
|
30
40
|
templateUrl: 'layouts/404.html'
|
@@ -39,8 +49,8 @@ angular.module('Bastion.routing', ['ui.router']);
|
|
39
49
|
$window.location.href = oldBrowserBastionPath + $location.path();
|
40
50
|
}
|
41
51
|
|
42
|
-
// removing trailing slash to prevent endless redirect
|
43
|
-
if (path[path.length - 1] === '/') {
|
52
|
+
// removing trailing slash to prevent endless redirect if not in ignore list
|
53
|
+
if (path[path.length - 1] === '/' && shouldRemoveTrailingSlash(path)) {
|
44
54
|
return path.slice(0, -1);
|
45
55
|
}
|
46
56
|
});
|
data/lib/bastion/version.rb
CHANGED
@@ -74,4 +74,18 @@ describe('Directive: bstModal', function() {
|
|
74
74
|
|
75
75
|
expect($uibModal.open).toHaveBeenCalled();
|
76
76
|
});
|
77
|
+
|
78
|
+
it("allows the specification of a modal templateUrl", function() {
|
79
|
+
var html = '<span bst-modal="item.delete(item)" template-url="blah.html"></span>';
|
80
|
+
|
81
|
+
element = angular.element(html);
|
82
|
+
compile(element)(scope);
|
83
|
+
scope.$digest();
|
84
|
+
|
85
|
+
spyOn($uibModal, 'open').and.callThrough();
|
86
|
+
|
87
|
+
elementScope.openModal();
|
88
|
+
|
89
|
+
expect($uibModal.open.calls.mostRecent().args[0].templateUrl).toBe('blah.html');
|
90
|
+
});
|
77
91
|
});
|
data/test/routing.module.test.js
CHANGED
@@ -35,6 +35,11 @@ describe('config: Bastion.routing', function () {
|
|
35
35
|
goTo('/state///');
|
36
36
|
expect($window.location.href).toBe('http://server/state');
|
37
37
|
});
|
38
|
+
|
39
|
+
it("doesn't remove slashes if whitelisted", function () {
|
40
|
+
goTo('/pulp/repos/');
|
41
|
+
expect($window.location.href).toBe('http://server/pulp/repos/');
|
42
|
+
});
|
38
43
|
});
|
39
44
|
|
40
45
|
describe("provides an otherwise method that", function () {
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bastion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric D Helms
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-01-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: angular-rails-templates
|
@@ -29,14 +29,14 @@ dependencies:
|
|
29
29
|
name: uglifier
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
|
-
- -
|
32
|
+
- - '>='
|
33
33
|
- !ruby/object:Gem::Version
|
34
34
|
version: '0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
|
-
- -
|
39
|
+
- - '>='
|
40
40
|
- !ruby/object:Gem::Version
|
41
41
|
version: '0'
|
42
42
|
description: Bastion provides a UI library of AngularJS based components designed
|
@@ -48,8 +48,8 @@ executables: []
|
|
48
48
|
extensions: []
|
49
49
|
extra_rdoc_files: []
|
50
50
|
files:
|
51
|
-
-
|
52
|
-
-
|
51
|
+
- .eslintignore
|
52
|
+
- .jshintrc
|
53
53
|
- Gruntfile.js
|
54
54
|
- LICENSE
|
55
55
|
- README.md
|
@@ -1749,17 +1749,17 @@ require_paths:
|
|
1749
1749
|
- lib
|
1750
1750
|
required_ruby_version: !ruby/object:Gem::Requirement
|
1751
1751
|
requirements:
|
1752
|
-
- -
|
1752
|
+
- - '>='
|
1753
1753
|
- !ruby/object:Gem::Version
|
1754
1754
|
version: '0'
|
1755
1755
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1756
1756
|
requirements:
|
1757
|
-
- -
|
1757
|
+
- - '>='
|
1758
1758
|
- !ruby/object:Gem::Version
|
1759
1759
|
version: '0'
|
1760
1760
|
requirements: []
|
1761
1761
|
rubyforge_project:
|
1762
|
-
rubygems_version: 2.4.
|
1762
|
+
rubygems_version: 2.4.8
|
1763
1763
|
signing_key:
|
1764
1764
|
specification_version: 4
|
1765
1765
|
summary: UI library of AngularJS based components for Foreman
|