bastion 5.0.1 → 5.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e498b3f9314e1e489680acad6366863a1da428c6
4
- data.tar.gz: 690293151ee22cf3a8ea88656c26528eeb1bf70b
3
+ metadata.gz: 4fd778842aff7b06645ee880b35c7f27d95ad630
4
+ data.tar.gz: 55c562945c51a2bca62ae18431884e9dac88f4b6
5
5
  SHA512:
6
- metadata.gz: 1188d2ba08d2929c50806efcdf89bf5c4277518d604c2e5bc3c7dc67b45389cca581219854bac57a83efd87b924515377f10b7b9c5fab22ea72903436929b568
7
- data.tar.gz: 21bdb8f140ba3e8bebb023f60fc1ba6b5bd072d5e4d5916d0e67d7580241182b4c303e69f526ff3fc671328e6101934cd56b4b51256156e040eab3d7d7a9f047
6
+ metadata.gz: 1d68b356fe6c601684ba37d4c6cfcc55c2e5a73b20cb69b0a6808154b57a300a2dd7ac53bb7d78347fc43036191b41dc1574f2a671a76cc526e4a3981f87c00b
7
+ data.tar.gz: b6300c92cfb5fff0e9f28862f5ad4159bdcff833eb2c99da324f3eb27541bcb3bbabae6f5400dc3afe893230e539552c726fc41edbcd36a66abcfbbfba117b2f
@@ -327,8 +327,16 @@ angular.module('Bastion.components').factory('Nutupane',
327
327
  return self.table.resource.page === 1;
328
328
  };
329
329
 
330
+ self.table.getLastPage = function () {
331
+ return Math.ceil(self.table.resource.subtotal / self.table.resource.per_page);
332
+ };
333
+
330
334
  self.table.onLastPage = function () {
331
- return self.table.resource.page >= self.table.resource.subtotal / self.table.resource.per_page;
335
+ return self.table.resource.page >= self.table.getLastPage();
336
+ };
337
+
338
+ self.table.pageExists = function (pageNumber) {
339
+ return (pageNumber >= 1) && (pageNumber <= self.table.getLastPage());
332
340
  };
333
341
 
334
342
  self.table.getPageEnd = function () {
@@ -358,18 +366,16 @@ angular.module('Bastion.components').factory('Nutupane',
358
366
  };
359
367
 
360
368
  self.table.lastPage = function () {
361
- var table = self.table,
362
- lastPage = Math.ceil(table.resource.subtotal / table.resource.per_page);
363
- return table.changePage(lastPage);
369
+ var table = self.table;
370
+ return table.changePage(self.table.getLastPage());
364
371
  };
365
372
 
366
373
  self.table.changePage = function (pageNumber) {
367
- if (pageNumber) {
374
+ if (pageNumber && self.table.pageExists(pageNumber)) {
368
375
  params.page = pageNumber;
369
376
  self.table.resource.page = pageNumber;
377
+ return self.load();
370
378
  }
371
-
372
- return self.load();
373
379
  };
374
380
 
375
381
  self.table.pageSizes = _.uniq(_([25, 50, 75, 100, entriesPerPage]).sortBy().value());
@@ -3,8 +3,10 @@
3
3
  ng-click="handleSave(); working = true"
4
4
  ng-disabled="invalid || working">
5
5
 
6
- <i class="fa fa-spinner fa-spin" ng-show="working"></i>
7
- <span ng-show="working" translate>Saving...</span>
6
+ <span ng-show="working">
7
+ <i class="fa fa-spinner fa-spin"></i>
8
+ <span translate>Saving...</span>
9
+ </span>
8
10
  <span ng-hide="working" translate>Save</span>
9
11
  </button>
10
12
 
@@ -3,7 +3,8 @@
3
3
  <li class="path-list-item" ng-repeat="item in path" ng-class="{ 'disabled-item': item.disabled }">
4
4
  <label class="path-list-item-label" ng-disabled="item.disabled" ng-class="{ active: item.selected }" ng-mouseenter="hover" ng-mouseleave="hover = false">
5
5
  <input type="checkbox" ng-model="item.selected" ng-change="itemChanged(item)" ng-disabled="item.disabled"/>
6
- <span ng-class="item.customClass">{{ item.name }}</span>
6
+ <i ng-class="item.iconClass"></i>
7
+ {{ item.name }}
7
8
  </label>
8
9
  </li>
9
10
  </ul>
@@ -100,7 +100,7 @@
100
100
  <label for="currentPage" class="sr-only" translate>
101
101
  Current Page
102
102
  </label>
103
- <input id="currentPage" class="pagination-pf-page" type="text" ng-model="table.params.page" ng-blur="table.changePage()" bst-on-enter="table.changePage()"/>
103
+ <input id="currentPage" class="pagination-pf-page" type="text" ng-model="table.params.page" ng-blur="table.changePage(table.params.page)" bst-on-enter="table.changePage()"/>
104
104
 
105
105
  <span translate>of
106
106
  <span class="pagination-pf-pages">{{ (table.resource.subtotal / table.resource.per_page) | roundUp }}</span>
@@ -0,0 +1,30 @@
1
+ (function () {
2
+ /**
3
+ * @ngdoc directive
4
+ * @name Bastion.utils.directive:disableLink
5
+ *
6
+ * @description
7
+ * Prevents links from being followed based on provided value.
8
+ *
9
+ * @example
10
+ * <a type="text" disable-link="true">Click me</a>
11
+ */
12
+
13
+ function disableLink() {
14
+ return {
15
+ compile: function (tElement, tAttrs) {
16
+ tAttrs.ngClick = "!(" + tAttrs.disableLink + ") && (" + tAttrs.ngClick + ")";
17
+
18
+ return function (scope, iElement, iAttrs) {
19
+ iElement.on("click", function (e) {
20
+ if (scope.$eval(iAttrs.disableLink)) {
21
+ e.preventDefault();
22
+ }
23
+ });
24
+ };
25
+ }
26
+ };
27
+ }
28
+
29
+ angular.module('Bastion.utils').directive('disableLink', disableLink);
30
+ })();
@@ -21,12 +21,6 @@ table.table {
21
21
  background: inherit;
22
22
  }
23
23
 
24
- ul {
25
- -webkit-padding-start: 0;
26
- -moz-padding-start: 0;
27
- padding-start: 0;
28
- }
29
-
30
24
  // Prevent Foreman editable icon from bleeding into our pages
31
25
  .editable {
32
26
  background: inherit;
@@ -9,6 +9,13 @@ $path-active-color: #005870;
9
9
  .path-selector {
10
10
  margin-top: 20px;
11
11
 
12
+ ul {
13
+ -webkit-padding-start: 0;
14
+ -moz-padding-start: 0;
15
+ padding-start: 0;
16
+ }
17
+
18
+
12
19
  .path-list {
13
20
  list-style: none;
14
21
  overflow: hidden;
@@ -1,3 +1,3 @@
1
1
  module Bastion
2
- VERSION = "5.0.1"
2
+ VERSION = "5.0.2"
3
3
  end
@@ -210,6 +210,10 @@ describe('Factory: Nutupane', function() {
210
210
  expect(nutupane.table.onFirstPage()).toBe(true);
211
211
  });
212
212
 
213
+ it("provides a way to get the last page", function () {
214
+ expect(nutupane.table.getLastPage()).toBe(4);
215
+ });
216
+
213
217
  it("provides a way to tell if on the last page", function () {
214
218
  spyOn(nutupane, 'load');
215
219
  nutupane.table.lastPage();
@@ -217,6 +221,13 @@ describe('Factory: Nutupane', function() {
217
221
  expect(nutupane.load).toHaveBeenCalled();
218
222
  });
219
223
 
224
+ it("provides a way to see if a page exists", function () {
225
+ expect(nutupane.table.pageExists(2)).toBe(true);
226
+ expect(nutupane.table.pageExists(4)).toBe(true);
227
+ expect(nutupane.table.pageExists(23524)).toBe(false);
228
+ });
229
+
230
+
220
231
  it("provides a way to get the page end based on offset", function () {
221
232
  expect(nutupane.table.getPageEnd()).toBe(6);
222
233
  });
@@ -0,0 +1,38 @@
1
+ describe('Directive: disableLink', function () {
2
+ var element, $compile, $rootScope, compileDirective;
3
+
4
+ compileDirective = function () {
5
+ var html = '<a ng-click="blah()" ui-sref="blah" disable-link="item.disabled">Click Me</a>';
6
+ element = angular.element(html);
7
+ $rootScope.item = {};
8
+ element = $compile(element)($rootScope);
9
+ $rootScope.$digest();
10
+ };
11
+
12
+ beforeEach(module('Bastion.utils'));
13
+
14
+ beforeEach(inject(function (_$compile_, _$rootScope_) {
15
+ $compile = _$compile_;
16
+ $rootScope = _$rootScope_.$new();
17
+ compileDirective();
18
+ }));
19
+
20
+ describe("stops the link from being followed", function () {
21
+ beforeEach(function () {
22
+ compileDirective();
23
+ $rootScope.item.disabled = true;
24
+ $rootScope.$digest();
25
+ });
26
+
27
+ it("by preventing the click event", function () {
28
+ var event = {
29
+ type: 'click',
30
+ preventDefault: function () {}
31
+ };
32
+
33
+ spyOn(event, 'preventDefault');
34
+ element.trigger(event);
35
+ expect(event.preventDefault).toHaveBeenCalled();
36
+ });
37
+ });
38
+ });
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: 5.0.1
4
+ version: 5.0.2
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: 2017-03-29 00:00:00.000000000 Z
12
+ date: 2017-04-25 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,12 +48,6 @@ executables: []
48
48
  extensions: []
49
49
  extra_rdoc_files: []
50
50
  files:
51
- - ".eslintignore"
52
- - ".jshintrc"
53
- - Gruntfile.js
54
- - LICENSE
55
- - README.md
56
- - Rakefile
57
51
  - app/assets/javascripts/bastion/auth/auth.module.js
58
52
  - app/assets/javascripts/bastion/auth/authorization.service.js
59
53
  - app/assets/javascripts/bastion/bastion-bootstrap.js
@@ -119,10 +113,8 @@ files:
119
113
  - app/assets/javascripts/bastion/features/feature-flag.service.js
120
114
  - app/assets/javascripts/bastion/features/features.module.js
121
115
  - app/assets/javascripts/bastion/features/features.service.js
122
- - app/assets/javascripts/bastion/i18n/README
123
116
  - app/assets/javascripts/bastion/i18n/bastion.pot
124
117
  - app/assets/javascripts/bastion/i18n/i18n.module.js
125
- - app/assets/javascripts/bastion/i18n/locale/README
126
118
  - app/assets/javascripts/bastion/i18n/locale/de.po
127
119
  - app/assets/javascripts/bastion/i18n/locale/es.po
128
120
  - app/assets/javascripts/bastion/i18n/locale/fr.po
@@ -130,9 +122,11 @@ files:
130
122
  - app/assets/javascripts/bastion/i18n/locale/ja.po
131
123
  - app/assets/javascripts/bastion/i18n/locale/ko.po
132
124
  - app/assets/javascripts/bastion/i18n/locale/pt_BR.po
125
+ - app/assets/javascripts/bastion/i18n/locale/README
133
126
  - app/assets/javascripts/bastion/i18n/locale/ru.po
134
127
  - app/assets/javascripts/bastion/i18n/locale/zh_CN.po
135
128
  - app/assets/javascripts/bastion/i18n/locale/zh_TW.po
129
+ - app/assets/javascripts/bastion/i18n/README
136
130
  - app/assets/javascripts/bastion/i18n/translate.service.js
137
131
  - app/assets/javascripts/bastion/i18n/translations.js
138
132
  - app/assets/javascripts/bastion/i18n/zanata.xml
@@ -152,6 +146,7 @@ files:
152
146
  - app/assets/javascripts/bastion/menu/menu.module.js
153
147
  - app/assets/javascripts/bastion/routing.module.js
154
148
  - app/assets/javascripts/bastion/utils/bastion-resource.factory.js
149
+ - app/assets/javascripts/bastion/utils/disable-link.directive.js
155
150
  - app/assets/javascripts/bastion/utils/form-utils.service.js
156
151
  - app/assets/javascripts/bastion/utils/round-up.filter.js
157
152
  - app/assets/javascripts/bastion/utils/stop-event.directive.js
@@ -173,59 +168,12 @@ files:
173
168
  - app/views/bastion/layouts/application.html.erb
174
169
  - app/views/bastion/layouts/application_ie.html.erb
175
170
  - app/views/bastion/layouts/assets.html.erb
176
- - bastion.js
177
- - bower.json
178
- - config/routes.rb
179
171
  - config/routes/mount_engine.rb
180
- - eslint.yaml
181
- - grunt/bower.js
182
- - grunt/eslint.js
183
- - grunt/htmlhint.js
184
- - grunt/karma.js
185
- - grunt/nggettext_compile.js
186
- - grunt/nggettext_extract.js
187
- - lib/bastion.rb
172
+ - config/routes.rb
188
173
  - lib/bastion/engine.rb
189
174
  - lib/bastion/version.rb
190
- - package.json
191
- - test/auth/authorization.service.test.js
192
- - test/bastion/test-constants.js
193
- - test/components/bst-alert.directive.test.js
194
- - test/components/bst-alerts.directive.test.js
195
- - test/components/bst-bookmark.directive.test.js
196
- - test/components/bst-bookmark.factory.test.js
197
- - test/components/bst-dropdown.directive.test.js
198
- - test/components/bst-edit.directive.test.js
199
- - test/components/bst-flyout.directive.test.js
200
- - test/components/bst-form-buttons.directive.test.js
201
- - test/components/bst-form-group.directive.test.js
202
- - test/components/bst-global-notification.directive.test.js
203
- - test/components/bst-menu.directive.test.js
204
- - test/components/bst-modal.directive.test.js
205
- - test/components/bst-table.directive.test.js
206
- - test/components/formatters/array-to-string.filter.test.js
207
- - test/components/formatters/boolean-to-yes-no.filter.test.js
208
- - test/components/formatters/capitalize.filter.test.js
209
- - test/components/formatters/key-value-to-string.filter.test.js
210
- - test/components/formatters/unlimited-filter.filter.test.js
211
- - test/components/global-notification.service.test.js
212
- - test/components/nutupane.factory.test.js
213
- - test/components/page-title.directive.test.js
214
- - test/components/page-title.service.test.js
215
- - test/components/path-selector.directive.test.js
216
- - test/components/table-cache.service.test.js
217
- - test/components/typeahead-empty.directive.test.js
218
- - test/features/bst-feature-flag.directive.test.js
219
- - test/features/feature-flag.service.test.js
220
- - test/i18n/translate.service.test.js
221
- - test/menu/menu-expander.service.test.js
222
- - test/routing.module.test.js
223
- - test/test-mocks.module.js
224
- - test/utils/bastion-resource.factory.test.js
225
- - test/utils/form-utils.service.test.js
226
- - test/utils/round-up.filter.test.js
227
- - test/utils/stop-event.directive.test.js
228
- - test/utils/urlencode.filter.test.js
175
+ - lib/bastion.rb
176
+ - vendor/assets/javascripts/bastion/angular/angular.js
229
177
  - vendor/assets/javascripts/bastion/angular-animate/angular-animate.js
230
178
  - vendor/assets/javascripts/bastion/angular-blocks/angular-blocks.js
231
179
  - vendor/assets/javascripts/bastion/angular-bootstrap/ui-bootstrap-tpls.js
@@ -1736,9 +1684,63 @@ files:
1736
1684
  - vendor/assets/javascripts/bastion/angular-ui-bootstrap/timepicker.js
1737
1685
  - vendor/assets/javascripts/bastion/angular-ui-router/angular-ui-router.js
1738
1686
  - vendor/assets/javascripts/bastion/angular-uuid4/angular-uuid4.js
1739
- - vendor/assets/javascripts/bastion/angular/angular.js
1740
1687
  - vendor/assets/javascripts/bastion/json3/json3.js
1741
1688
  - vendor/assets/javascripts/bastion/ngUpload/ng-upload.js
1689
+ - grunt/bower.js
1690
+ - grunt/eslint.js
1691
+ - grunt/htmlhint.js
1692
+ - grunt/karma.js
1693
+ - grunt/nggettext_compile.js
1694
+ - grunt/nggettext_extract.js
1695
+ - Rakefile
1696
+ - README.md
1697
+ - Gruntfile.js
1698
+ - package.json
1699
+ - bower.json
1700
+ - bastion.js
1701
+ - eslint.yaml
1702
+ - .eslintignore
1703
+ - LICENSE
1704
+ - .jshintrc
1705
+ - test/auth/authorization.service.test.js
1706
+ - test/bastion/test-constants.js
1707
+ - test/components/bst-alert.directive.test.js
1708
+ - test/components/bst-alerts.directive.test.js
1709
+ - test/components/bst-bookmark.directive.test.js
1710
+ - test/components/bst-bookmark.factory.test.js
1711
+ - test/components/bst-dropdown.directive.test.js
1712
+ - test/components/bst-edit.directive.test.js
1713
+ - test/components/bst-flyout.directive.test.js
1714
+ - test/components/bst-form-buttons.directive.test.js
1715
+ - test/components/bst-form-group.directive.test.js
1716
+ - test/components/bst-global-notification.directive.test.js
1717
+ - test/components/bst-menu.directive.test.js
1718
+ - test/components/bst-modal.directive.test.js
1719
+ - test/components/bst-table.directive.test.js
1720
+ - test/components/formatters/array-to-string.filter.test.js
1721
+ - test/components/formatters/boolean-to-yes-no.filter.test.js
1722
+ - test/components/formatters/capitalize.filter.test.js
1723
+ - test/components/formatters/key-value-to-string.filter.test.js
1724
+ - test/components/formatters/unlimited-filter.filter.test.js
1725
+ - test/components/global-notification.service.test.js
1726
+ - test/components/nutupane.factory.test.js
1727
+ - test/components/page-title.directive.test.js
1728
+ - test/components/page-title.service.test.js
1729
+ - test/components/path-selector.directive.test.js
1730
+ - test/components/table-cache.service.test.js
1731
+ - test/components/typeahead-empty.directive.test.js
1732
+ - test/features/bst-feature-flag.directive.test.js
1733
+ - test/features/feature-flag.service.test.js
1734
+ - test/i18n/translate.service.test.js
1735
+ - test/menu/menu-expander.service.test.js
1736
+ - test/routing.module.test.js
1737
+ - test/test-mocks.module.js
1738
+ - test/utils/bastion-resource.factory.test.js
1739
+ - test/utils/disable-link.directive.test.js
1740
+ - test/utils/form-utils.service.test.js
1741
+ - test/utils/round-up.filter.test.js
1742
+ - test/utils/stop-event.directive.test.js
1743
+ - test/utils/urlencode.filter.test.js
1742
1744
  homepage: http://www.github.com/Katello/bastion
1743
1745
  licenses: []
1744
1746
  metadata: {}
@@ -1748,56 +1750,57 @@ require_paths:
1748
1750
  - lib
1749
1751
  required_ruby_version: !ruby/object:Gem::Requirement
1750
1752
  requirements:
1751
- - - ">="
1753
+ - - '>='
1752
1754
  - !ruby/object:Gem::Version
1753
1755
  version: '0'
1754
1756
  required_rubygems_version: !ruby/object:Gem::Requirement
1755
1757
  requirements:
1756
- - - ">="
1758
+ - - '>='
1757
1759
  - !ruby/object:Gem::Version
1758
1760
  version: '0'
1759
1761
  requirements: []
1760
1762
  rubyforge_project:
1761
- rubygems_version: 2.4.6
1763
+ rubygems_version: 2.0.14
1762
1764
  signing_key:
1763
1765
  specification_version: 4
1764
1766
  summary: UI library of AngularJS based components for Foreman
1765
1767
  test_files:
1766
- - test/features/bst-feature-flag.directive.test.js
1767
- - test/features/feature-flag.service.test.js
1768
1768
  - test/auth/authorization.service.test.js
1769
+ - test/bastion/test-constants.js
1770
+ - test/components/bst-alert.directive.test.js
1771
+ - test/components/bst-alerts.directive.test.js
1772
+ - test/components/bst-bookmark.directive.test.js
1773
+ - test/components/bst-bookmark.factory.test.js
1774
+ - test/components/bst-dropdown.directive.test.js
1775
+ - test/components/bst-edit.directive.test.js
1776
+ - test/components/bst-flyout.directive.test.js
1777
+ - test/components/bst-form-buttons.directive.test.js
1769
1778
  - test/components/bst-form-group.directive.test.js
1770
- - test/components/bst-table.directive.test.js
1771
- - test/components/page-title.directive.test.js
1779
+ - test/components/bst-global-notification.directive.test.js
1772
1780
  - test/components/bst-menu.directive.test.js
1773
- - test/components/bst-alerts.directive.test.js
1774
- - test/components/nutupane.factory.test.js
1775
- - test/components/path-selector.directive.test.js
1781
+ - test/components/bst-modal.directive.test.js
1782
+ - test/components/bst-table.directive.test.js
1776
1783
  - test/components/formatters/array-to-string.filter.test.js
1777
- - test/components/formatters/unlimited-filter.filter.test.js
1784
+ - test/components/formatters/boolean-to-yes-no.filter.test.js
1778
1785
  - test/components/formatters/capitalize.filter.test.js
1779
1786
  - test/components/formatters/key-value-to-string.filter.test.js
1780
- - test/components/formatters/boolean-to-yes-no.filter.test.js
1787
+ - test/components/formatters/unlimited-filter.filter.test.js
1788
+ - test/components/global-notification.service.test.js
1789
+ - test/components/nutupane.factory.test.js
1790
+ - test/components/page-title.directive.test.js
1781
1791
  - test/components/page-title.service.test.js
1782
- - test/components/bst-bookmark.factory.test.js
1783
- - test/components/bst-alert.directive.test.js
1784
- - test/components/bst-bookmark.directive.test.js
1785
- - test/components/bst-global-notification.directive.test.js
1786
- - test/components/bst-flyout.directive.test.js
1792
+ - test/components/path-selector.directive.test.js
1787
1793
  - test/components/table-cache.service.test.js
1788
- - test/components/bst-dropdown.directive.test.js
1789
1794
  - test/components/typeahead-empty.directive.test.js
1790
- - test/components/bst-form-buttons.directive.test.js
1791
- - test/components/global-notification.service.test.js
1792
- - test/components/bst-edit.directive.test.js
1793
- - test/components/bst-modal.directive.test.js
1795
+ - test/features/bst-feature-flag.directive.test.js
1796
+ - test/features/feature-flag.service.test.js
1797
+ - test/i18n/translate.service.test.js
1798
+ - test/menu/menu-expander.service.test.js
1794
1799
  - test/routing.module.test.js
1795
1800
  - test/test-mocks.module.js
1796
- - test/menu/menu-expander.service.test.js
1797
- - test/i18n/translate.service.test.js
1798
- - test/bastion/test-constants.js
1801
+ - test/utils/bastion-resource.factory.test.js
1802
+ - test/utils/disable-link.directive.test.js
1799
1803
  - test/utils/form-utils.service.test.js
1804
+ - test/utils/round-up.filter.test.js
1800
1805
  - test/utils/stop-event.directive.test.js
1801
- - test/utils/bastion-resource.factory.test.js
1802
1806
  - test/utils/urlencode.filter.test.js
1803
- - test/utils/round-up.filter.test.js