kea-rails 1.0.6 → 1.0.7
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/popover.js +66 -0
- data/app/assets/javascripts/kea/bindings/sherlock.js +2 -1
- data/app/assets/javascripts/kea/kea.js +2 -0
- data/app/assets/javascripts/kea/overlay/close_overlay.js +16 -0
- data/app/assets/javascripts/kea/viewmodels/sherlock.js +10 -0
- data/lib/kea-rails/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3aa013e5c44870c868d67d3fd66427ab6f076c1c
|
4
|
+
data.tar.gz: 629e172acfeb6784562c7e58093b5fa6ea3203ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9a6f3eb0e2d9ea58e4b3ab79ea4f71e9030396731854616cb12d0606217a1d27b55b1d146ecb9acf10003b829c8f470ffa9e7c04ffad3aa57327feb8de252da
|
7
|
+
data.tar.gz: 695f3a9528477f023468e3a4c631a2eca29e9f993631f95ce822695c8f61e30a2b2d73883352783a91f491828081affe279c1954d8b9a77e774480ee735d9431
|
@@ -0,0 +1,66 @@
|
|
1
|
+
(function(ko, $) {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
ko.bindingHandlers.popover = {
|
5
|
+
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
6
|
+
var options,
|
7
|
+
childVmName,
|
8
|
+
parentVm,
|
9
|
+
childVmSetupContext,
|
10
|
+
childVm,
|
11
|
+
clickHandler;
|
12
|
+
|
13
|
+
if (typeof ko.unwrap(valueAccessor()) === 'string') {
|
14
|
+
childVmName = ko.unwrap(valueAccessor());
|
15
|
+
parentVm = bindingContext.$parent;
|
16
|
+
childVmSetupContext = bindingContext.$data;
|
17
|
+
|
18
|
+
} else {
|
19
|
+
options = ko.unwrap(valueAccessor());
|
20
|
+
|
21
|
+
childVmName = options.name;
|
22
|
+
parentVm = options.parentVm ? options.parentVm : bindingContext.$parent;
|
23
|
+
childVmSetupContext = options.setupContext ? options.setupContext : bindingContext.$data;
|
24
|
+
}
|
25
|
+
|
26
|
+
childVm = parentVm.getVm(childVmName);
|
27
|
+
|
28
|
+
if (typeof childVm.setup === 'function') {
|
29
|
+
|
30
|
+
clickHandler = function clickHandler() {
|
31
|
+
childVm.setup(childVmSetupContext);
|
32
|
+
};
|
33
|
+
|
34
|
+
ko.bindingHandlers.click.init(element, function() { return clickHandler; }, allBindingsAccessor, viewModel, bindingContext);
|
35
|
+
}
|
36
|
+
|
37
|
+
return ko.bindingHandlers.attache.init(element, function() { return childVm; }, allBindingsAccessor, viewModel, bindingContext);
|
38
|
+
},
|
39
|
+
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
40
|
+
var options,
|
41
|
+
childVmName,
|
42
|
+
parentVm,
|
43
|
+
childVm,
|
44
|
+
submitComplete;
|
45
|
+
|
46
|
+
if (typeof ko.unwrap(valueAccessor()) === 'string') {
|
47
|
+
childVmName = ko.unwrap(valueAccessor());
|
48
|
+
parentVm = bindingContext.$parent;
|
49
|
+
|
50
|
+
} else {
|
51
|
+
options = ko.unwrap(valueAccessor());
|
52
|
+
|
53
|
+
childVmName = options.name;
|
54
|
+
parentVm = options.parentVm ? options.parentVm : bindingContext.$parent;
|
55
|
+
}
|
56
|
+
|
57
|
+
childVm = parentVm.getVm(childVmName);
|
58
|
+
submitComplete = ko.unwrap(childVm.submitComplete);
|
59
|
+
|
60
|
+
if (submitComplete) {
|
61
|
+
$(element).attache().hide();
|
62
|
+
}
|
63
|
+
}
|
64
|
+
};
|
65
|
+
|
66
|
+
})(ko, $);
|
@@ -9,12 +9,13 @@
|
|
9
9
|
sherlockVm;
|
10
10
|
|
11
11
|
sherlockVm = new app.sherlock.SherlockVm();
|
12
|
-
sherlockVm.setup(options);
|
13
12
|
|
14
13
|
sherlockVm.params.subscribe(function(params) {
|
15
14
|
bindingContext.$data.sherlockParams(params);
|
16
15
|
});
|
17
16
|
|
17
|
+
sherlockVm.setup(options);
|
18
|
+
|
18
19
|
ko.renderTemplate('sherlock-container-template', sherlockVm, {}, element);
|
19
20
|
|
20
21
|
$container.addClass('sherlock-search-bar');
|
@@ -1,4 +1,5 @@
|
|
1
1
|
//= require_directory ./bindings
|
2
|
+
//= require attachejs/attache-knockout
|
2
3
|
//= require_directory ./extenders
|
3
4
|
//= require_directory ./components
|
4
5
|
//= require ./models/base
|
@@ -8,6 +9,7 @@
|
|
8
9
|
//= require ./overlay/overlay_control
|
9
10
|
//= require ./overlay/overlay_template
|
10
11
|
//= require ./overlay/child_vm_overlay
|
12
|
+
//= require ./overlay/close_overlay
|
11
13
|
|
12
14
|
//= require ./viewmodels/sherlock
|
13
15
|
//= require ./sherlock/base_provider
|
@@ -0,0 +1,16 @@
|
|
1
|
+
(function(ko, $, Veil, Overlay, app) {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
ko.bindingHandlers.closeOverlay = {
|
5
|
+
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
6
|
+
var $element = $(element);
|
7
|
+
|
8
|
+
$element.on('click', function(e) {
|
9
|
+
bindingContext.overlay.hide();
|
10
|
+
|
11
|
+
e.preventDefault();
|
12
|
+
});
|
13
|
+
}
|
14
|
+
};
|
15
|
+
|
16
|
+
})(ko, $, window.Veil, window.Overlay, window.app);
|
@@ -27,6 +27,16 @@
|
|
27
27
|
}
|
28
28
|
});
|
29
29
|
|
30
|
+
if ( this.options() ) {
|
31
|
+
if (this.options().presetParameters) {
|
32
|
+
params = $.extend({}, this.options().presetParameters, params);
|
33
|
+
}
|
34
|
+
|
35
|
+
if (this.options().fixedParameters) {
|
36
|
+
params = $.extend({}, params, this.options().fixedParameters);
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
30
40
|
return params;
|
31
41
|
|
32
42
|
}, this, {deferEvaluation: true});
|
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: 1.0.
|
4
|
+
version: 1.0.7
|
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-02-
|
11
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -37,6 +37,7 @@ files:
|
|
37
37
|
- app/assets/javascripts/kea/bindings/activity.js
|
38
38
|
- app/assets/javascripts/kea/bindings/child_vm.js
|
39
39
|
- app/assets/javascripts/kea/bindings/komplete.js
|
40
|
+
- app/assets/javascripts/kea/bindings/popover.js
|
40
41
|
- app/assets/javascripts/kea/bindings/sherlock.js
|
41
42
|
- app/assets/javascripts/kea/bindings/sherlock_provider_search.js
|
42
43
|
- app/assets/javascripts/kea/bindings/submit_button.js
|
@@ -59,6 +60,7 @@ files:
|
|
59
60
|
- app/assets/javascripts/kea/kea_init.js
|
60
61
|
- app/assets/javascripts/kea/models/base.js
|
61
62
|
- app/assets/javascripts/kea/overlay/child_vm_overlay.js
|
63
|
+
- app/assets/javascripts/kea/overlay/close_overlay.js
|
62
64
|
- app/assets/javascripts/kea/overlay/overlay_control.js
|
63
65
|
- app/assets/javascripts/kea/overlay/overlay_template.js
|
64
66
|
- app/assets/javascripts/kea/services/base.js
|