bastion 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MjNkNjc4M2NjMDdkMDlmZDVkOTc1MTI5MTJmMTlmNWNiOGY4N2E4Nw==
4
+ MzVmNGUwNmI0Y2IwZTcyMTBiYmMzYWRmYjNhN2NlNTE3MjA1NGYyYg==
5
5
  data.tar.gz: !binary |-
6
- YmNiMTgwNmM2ZDBhZThjNTcyOWI3NjQ5NjdhNTZhNTI0MmNlNjljNw==
6
+ MmZiOWE3M2U4OTFiZWU4MjEyZGU2MmYxNTk2OTIzZTIxYjk4ODZjYQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTIxNGNjOTczMGQ3NGRiODA4OTFiNGU4NjNiYjk1YmY2ZTk4YmZjNmJjMWYz
10
- OGJjMmU5Mzg1YTEzZGNjN2I1NGI2M2IyMmU2NTJlYmNiYmIyNDNiOTJhYjUy
11
- MGJlYjljZDk4NjVmYTkyMzRmZjYyYWZiN2UxYjAxNmRkMWU3Yjk=
9
+ NGVmYWQ1YWZjZGYxZjI5ZTdlZTUyMjFkZTUwYzY5MTAzODcxNTk5Zjc1ZTI5
10
+ MTUzMDQwYmQzY2RhN2IyMGYyNTY4Y2NjNDI2MjhlNDdhZWI3MjIyNTBhODVi
11
+ MjliYmU4MzUxYmQ5MmMwMDczZmJlZWE1MTViNjU1YzRmZDljYjM=
12
12
  data.tar.gz: !binary |-
13
- ZDA3ODRhNDdhNjkwNTE3MDkyZDQzYTlhODEyNTU5Nzk5YTA0ZjFlMWM4YzUw
14
- Mzc0OWIxMDU4ZjczMzdiNWIyNjBmMWVmNGM4NTBhYTUxMWMyNjI4Y2Q0OGMx
15
- YzNjMzkzMGY3Y2U3Y2NiZjU3ZWJjY2EwNjg0MDVjYzYzZjhmN2Y=
13
+ NWUyZTIyMmU5ZjNkMDJjOTI4MDEyMjM4ZTU2MjM3Yzc5NzQ3NWI3N2UyM2Y5
14
+ ZjExNjFhMDBjZjliNmJlZTZlZjhiNzEyODY4MjExZmRjODI5MzUxMTAyYzJj
15
+ MmYwYzI4ZGViODRkNDE1YmViYTAwNmRiN2E5NTg0MmFhOWIwOWI=
@@ -64,13 +64,16 @@ angular.module('Bastion.components').directive('pathSelector',
64
64
  }
65
65
 
66
66
  scope.itemChanged = function (item) {
67
- if (item && scope.mode === 'singleSelect') {
68
- if (item.selected || selectionRequired) {
69
- unselectActive();
70
- selectById(item.id);
71
- activeItemId = item.id;
72
- } else {
73
- ngModel.$setViewValue(undefined);
67
+ if (item && !item.disabled) {
68
+ if (scope.mode === 'singleSelect') {
69
+ item.selected = !item.selected;
70
+ if (item.selected || selectionRequired) {
71
+ unselectActive();
72
+ selectById(item.id);
73
+ activeItemId = item.id;
74
+ } else {
75
+ ngModel.$setViewValue(undefined);
76
+ }
74
77
  }
75
78
  }
76
79
  };
@@ -1,9 +1,9 @@
1
1
 
2
2
  <div class="path-selector" ng-repeat="path in paths">
3
3
  <ul class="path-list">
4
- <li class="path-list-item" ng-repeat="item in path" ng-class="{ 'disabled-item': item.disabled }">
4
+ <li class="path-list-item" ng-click="itemChanged(item)" ng-repeat="item in path" ng-class="{ 'disabled-item': item.disabled }">
5
5
  <label class="path-list-item-label" ng-disabled="item.disabled" ng-class="{ active: item.selected }" ng-mouseenter="hover" ng-mouseleave="hover = false">
6
- <input type="checkbox" ng-model="item.selected" ng-change="itemChanged(item)" ng-disabled="item.disabled"/>
6
+ <input type="checkbox" ng-model="item.selected" ng-checked="item.selected" ng-disabled="item.disabled"/>
7
7
  {{ item.name }}
8
8
  </label>
9
9
  </li>
@@ -21,15 +21,13 @@
21
21
  angular.module('Bastion.features').value('FeatureSettings', angular.fromJson(<%= SETTINGS[:features].nil? ? {} : SETTINGS[:features].to_json.html_safe %>));
22
22
  angular.module('Bastion').value('currentLocale', '<%= I18n.locale %>');
23
23
  angular.module('Bastion').value('CurrentOrganization', "<%= Organization.current.id if Organization.current %>");
24
- angular.module('Bastion').value('Permissions', angular.fromJson('<%= User.current.roles.collect { |role| role.permissions }.flatten.to_json.html_safe %>'));
24
+ angular.module('Bastion').value('Permissions', angular.fromJson('<%= User.current.cached_roles.collect { |role| role.permissions }.flatten.to_json.html_safe %>'));
25
25
  angular.module('Bastion').value('CurrentUser', {
26
26
  id: <%= User.current.id %>,
27
27
  admin: <%= User.current.admin %>
28
28
  });
29
29
  angular.module('Bastion').value('markActiveMenu', mark_active_menu);
30
- angular.module('Bastion').constant('BastionConfig', {
31
- markTranslated: <%= SETTINGS[:mark_translated] || false %>
32
- });
30
+ angular.module('Bastion').constant('BastionConfig', angular.fromJson('<%= Bastion.config.to_json.html_safe %>'));
33
31
  </script>
34
32
  <% Bastion.plugins.each do |name, plugin| %>
35
33
  <%= javascript_include_tag(plugin[:javascript]) %>
@@ -1,3 +1,3 @@
1
1
  module Bastion
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
data/lib/bastion.rb CHANGED
@@ -18,4 +18,16 @@ module Bastion
18
18
  @@plugins[plugin[:name]] = plugin
19
19
  end
20
20
 
21
+ def self.config
22
+ base_config = {
23
+ 'markTranslated' => SETTINGS[:mark_translated] || false
24
+ }
25
+
26
+ Bastion.plugins.each do |name, plugin|
27
+ base_config.merge!(plugin[:config]) if plugin[:config]
28
+ end
29
+
30
+ base_config
31
+ end
32
+
21
33
  end
@@ -72,12 +72,9 @@ describe('Directive: pathSelector', function() {
72
72
  });
73
73
 
74
74
  it("should select both items if two items with the same id exist", function() {
75
- var checkbox = element.find('.path-list:first .path-list-item:first').find('input');
76
-
77
- checkbox.trigger('click');
78
- checkbox.attr('checked', 'checked');
79
- checkbox.prop('checked', true);
75
+ var path = element.find('.path-list:first .path-list-item:first');
80
76
 
77
+ path.trigger('click');
81
78
  expect(element.find('.path-list:eq(1)').find('.path-list-item:first input').is(':checked')).toBe(true);
82
79
  });
83
80
 
@@ -104,14 +101,15 @@ describe('Directive: pathSelector', function() {
104
101
  });
105
102
 
106
103
  it ("should not unselect by default", function () {
107
- var checkbox = element.find('.path-list:first .path-list-item:first').find('input');
104
+ var path = element.find('.path-list:first .path-list-item:first'),
105
+ checkbox = path.find('input');
108
106
 
109
107
  expect(checkbox.is(':checked')).toBe(false);
110
108
 
111
- checkbox.click();
109
+ path.click();
112
110
  expect(checkbox.is(':checked')).toBe(true);
113
111
 
114
- checkbox.click();
112
+ path.click();
115
113
  expect(checkbox.is(':checked')).toBe(true);
116
114
  });
117
115
 
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.5
4
+ version: 0.2.6
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-12 00:00:00.000000000 Z
11
+ date: 2015-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: angular-rails-templates