kea-rails 2.0.0.pre.alpha11 → 2.0.0.pre.alpha12
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/kea/bindings/confirm.js +22 -0
- data/app/assets/javascripts/kea/bindings/dropdown.js +51 -0
- data/app/assets/javascripts/kea/bindings/src.js +19 -0
- data/app/assets/javascripts/kea/kea_init.js +14 -0
- data/app/assets/javascripts/kea/overlay/overlay_control.js +3 -1
- data/lib/kea-rails/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0afa075fd7d495cfcff98e7f4f87cb758b07983
|
4
|
+
data.tar.gz: a4515d68e13f502bce2b9417ef2c73f90cab4b56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0b39991f86689a25daaa11e5195554f9a3a2f7bb7efb492f28612110594811684d0f94d2f44742e33965d3b58dccce53a3b773d7b22568fc2e5012e40c5c543
|
7
|
+
data.tar.gz: cf8887145351e64fbfe0db2302cae8e53b34c0544951bd9f9b3cc7f143212bd029eb4b840b93bbf8a7b5b55f1055a5f8318552741cd65f5f112fde125c8feb75
|
@@ -0,0 +1,22 @@
|
|
1
|
+
(function(ko, $) {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
ko.bindingHandlers.confirm = {
|
5
|
+
preprocess: function(value, name, addBinding) {
|
6
|
+
addBinding('attacheOptions', "{popoverClass: 'confirm'}");
|
7
|
+
|
8
|
+
return value;
|
9
|
+
},
|
10
|
+
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
11
|
+
var $element = $(element),
|
12
|
+
onConfirmCallback = ko.unwrap(valueAccessor()),
|
13
|
+
confirmContext = allBindingsAccessor().confirmContext || bindingContext,
|
14
|
+
templateName = allBindingsAccessor().confirmTemplate || 'cancel-confirmation';
|
15
|
+
|
16
|
+
confirmContext = confirmContext.extend({ onConfirmCallback: onConfirmCallback });
|
17
|
+
|
18
|
+
ko.bindingHandlers.dropdown.init(element, function() { return templateName; }, allBindingsAccessor, viewModel, confirmContext);
|
19
|
+
}
|
20
|
+
};
|
21
|
+
|
22
|
+
})(ko, $);
|
@@ -0,0 +1,51 @@
|
|
1
|
+
(function(ko, $) {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
ko.bindingHandlers.dropdown = {
|
5
|
+
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
6
|
+
var $element = $(element),
|
7
|
+
templateName = ko.unwrap(valueAccessor()),
|
8
|
+
dropdownContext = allBindingsAccessor().dropdownContext || bindingContext,
|
9
|
+
options,
|
10
|
+
defaultOptions,
|
11
|
+
contentCallback;
|
12
|
+
|
13
|
+
defaultOptions = {
|
14
|
+
allowParallelUse: false,
|
15
|
+
appendTo: 'afterElement',
|
16
|
+
popoverClass: '',
|
17
|
+
position: 'center bottom'
|
18
|
+
};
|
19
|
+
|
20
|
+
options = $.extend({}, defaultOptions, allBindingsAccessor().attacheOptions);
|
21
|
+
options.popoverClass = options.popoverClass + ' dropdown';
|
22
|
+
|
23
|
+
contentCallback = function(anchor, popover) {
|
24
|
+
ko.renderTemplate(templateName, dropdownContext, {}, popover.get(0));
|
25
|
+
};
|
26
|
+
|
27
|
+
$element.attache(options);
|
28
|
+
$element.attache().addCallback('afterCreate', contentCallback);
|
29
|
+
|
30
|
+
$element.on('click', function(ev) {
|
31
|
+
if ($element.attache().isActive()) {
|
32
|
+
$element.attache().hide();
|
33
|
+
} else {
|
34
|
+
$element.attache().show();
|
35
|
+
$('body').one('click', function() { $element.attache().hide(); } );
|
36
|
+
}
|
37
|
+
|
38
|
+
ev.stopPropagation();
|
39
|
+
});
|
40
|
+
|
41
|
+
ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
|
42
|
+
try {
|
43
|
+
$(element).attache().destroy();
|
44
|
+
} catch (e) {
|
45
|
+
|
46
|
+
}
|
47
|
+
});
|
48
|
+
}
|
49
|
+
};
|
50
|
+
|
51
|
+
})(ko, $);
|
@@ -0,0 +1,19 @@
|
|
1
|
+
(function(ko, $) {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
ko.bindingHandlers.src = {
|
5
|
+
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
6
|
+
var value = valueAccessor(),
|
7
|
+
newValueAccessor;
|
8
|
+
|
9
|
+
newValueAccessor = function newValueAccessor() {
|
10
|
+
return {
|
11
|
+
src: value
|
12
|
+
};
|
13
|
+
};
|
14
|
+
|
15
|
+
ko.bindingHandlers.attr.update(element, newValueAccessor, allBindingsAccessor, viewModel, bindingContext);
|
16
|
+
}
|
17
|
+
};
|
18
|
+
|
19
|
+
})(ko, $);
|
@@ -56,5 +56,19 @@ window.kea.u = {
|
|
56
56
|
string = string.replace(_regex_dash_prefix, '');
|
57
57
|
|
58
58
|
return string.toLowerCase();
|
59
|
+
},
|
60
|
+
|
61
|
+
eventOffsetXY: function eventOffsetXY(event) {
|
62
|
+
"use strict";
|
63
|
+
|
64
|
+
var target = event.target || event.srcElement,
|
65
|
+
rect = target.getBoundingClientRect(),
|
66
|
+
offsetX = event.clientX - rect.left,
|
67
|
+
offsetY = event.clientY - rect.top;
|
68
|
+
|
69
|
+
return {
|
70
|
+
x: offsetX,
|
71
|
+
y: offsetY
|
72
|
+
};
|
59
73
|
}
|
60
74
|
};
|
data/lib/kea-rails/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kea-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0.pre.
|
4
|
+
version: 2.0.0.pre.alpha12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan-Christian Foeh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -36,11 +36,14 @@ files:
|
|
36
36
|
- Rakefile
|
37
37
|
- app/assets/javascripts/kea/bindings/activity.js
|
38
38
|
- app/assets/javascripts/kea/bindings/child_vm.js
|
39
|
+
- app/assets/javascripts/kea/bindings/confirm.js
|
39
40
|
- app/assets/javascripts/kea/bindings/date_picker.js
|
41
|
+
- app/assets/javascripts/kea/bindings/dropdown.js
|
40
42
|
- app/assets/javascripts/kea/bindings/komplete.js
|
41
43
|
- app/assets/javascripts/kea/bindings/popover.js
|
42
44
|
- app/assets/javascripts/kea/bindings/sherlock.js
|
43
45
|
- app/assets/javascripts/kea/bindings/sherlock_provider_search.js
|
46
|
+
- app/assets/javascripts/kea/bindings/src.js
|
44
47
|
- app/assets/javascripts/kea/bindings/submit_button.js
|
45
48
|
- app/assets/javascripts/kea/bindings/validation_state.js
|
46
49
|
- app/assets/javascripts/kea/bindings/wait_for_vm.js
|