bastion 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/app/assets/javascripts/bastion/components/path-selector.directive.js +10 -7
- data/app/assets/javascripts/bastion/components/views/path-selector.html +2 -2
- data/app/views/bastion/layouts/application.html.erb +2 -4
- data/lib/bastion/version.rb +1 -1
- data/lib/bastion.rb +12 -0
- data/test/components/path-selector.directive.test.js +6 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzVmNGUwNmI0Y2IwZTcyMTBiYmMzYWRmYjNhN2NlNTE3MjA1NGYyYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MmZiOWE3M2U4OTFiZWU4MjEyZGU2MmYxNTk2OTIzZTIxYjk4ODZjYQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NGVmYWQ1YWZjZGYxZjI5ZTdlZTUyMjFkZTUwYzY5MTAzODcxNTk5Zjc1ZTI5
|
10
|
+
MTUzMDQwYmQzY2RhN2IyMGYyNTY4Y2NjNDI2MjhlNDdhZWI3MjIyNTBhODVi
|
11
|
+
MjliYmU4MzUxYmQ5MmMwMDczZmJlZWE1MTViNjU1YzRmZDljYjM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
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 &&
|
68
|
-
if (
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
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-
|
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.
|
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]) %>
|
data/lib/bastion/version.rb
CHANGED
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
|
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
|
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
|
-
|
109
|
+
path.click();
|
112
110
|
expect(checkbox.is(':checked')).toBe(true);
|
113
111
|
|
114
|
-
|
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.
|
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-
|
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
|