vhx-quartz 0.8.13 → 0.8.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vhx/quartz/version.rb +1 -1
- data/vendor/assets/javascripts/vhx-quartz.search_input.js +32 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed9c6b706a79dcb829f3486c4698e6a50b4749c7
|
4
|
+
data.tar.gz: 0c24e0ce1ca75435f3bbfb9d29f5631ca9ba8e0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d31a167eb369d139d46a71ce975ef6df4e7629c77effbe7e69c38db6e50eec1bf34c406579025022e6c4db297f7307629dfeeba3ce2300da5ad8cf153bb6da95
|
7
|
+
data.tar.gz: 4ed6c6afb12e6e8ec10bcb353c32c509e93387ed233c37e1c5d941bbc0c349c52fe52be1181831392039eb76882ab56b9e7d40179e840ca1f01de9b18ac55d50
|
data/lib/vhx/quartz/version.rb
CHANGED
@@ -4,6 +4,8 @@ vhxm.components.shared.search_input.controller = function (opts) {
|
|
4
4
|
var self = this;
|
5
5
|
|
6
6
|
self.timeout = null;
|
7
|
+
self.state = new vhxm.components.shared.search_input.state();
|
8
|
+
self.state.value(opts.value ? opts.value : null);
|
7
9
|
|
8
10
|
self.debounceSearch = function (event) {
|
9
11
|
if (self.timeout) {
|
@@ -25,6 +27,25 @@ vhxm.components.shared.search_input.controller = function (opts) {
|
|
25
27
|
opts.callback(data);
|
26
28
|
});
|
27
29
|
};
|
30
|
+
|
31
|
+
self.updateQueryParam = function (query) {
|
32
|
+
var loc = window.location;
|
33
|
+
var search = void 0;
|
34
|
+
var href = loc.pathname;
|
35
|
+
|
36
|
+
if (query.length && window.history && window.history.replaceState) {
|
37
|
+
search = loc.search.length && loc.search.match(/\?/) ? loc.search : '?';
|
38
|
+
href += search.match(/q\=/) ? search.replace(/q\=(\w|\-)*/, 'q=' + query) : search + 'q=' + query;
|
39
|
+
history.replaceState({}, '', href);
|
40
|
+
} else {
|
41
|
+
search = loc.search.replace(/q\=(\w|\-)*/, '');
|
42
|
+
href += search.length === 1 ? '' : loc.search;
|
43
|
+
history.replaceState({}, '', href);
|
44
|
+
}
|
45
|
+
};
|
46
|
+
};
|
47
|
+
vhxm.components.shared.search_input.state = function () {
|
48
|
+
this.value = m.prop(null);
|
28
49
|
};
|
29
50
|
|
30
51
|
vhxm.components.shared.search_input.ui.container = {
|
@@ -35,8 +56,19 @@ vhxm.components.shared.search_input.ui.container = {
|
|
35
56
|
return m('input.c-select--search.padding-right-large.icon-search-navy.icon--xsmall', {
|
36
57
|
config: opts.config ? opts.config : '',
|
37
58
|
type: 'text',
|
59
|
+
value: ctrl.state.value(),
|
38
60
|
placeholder: opts.placeholder ? opts.placeholder : 'Search',
|
61
|
+
onkeydown: function oninput(event) {
|
62
|
+
if (parseInt(event.which, 10) === 13 || parseInt(event.keyCode, 10) === 13) {
|
63
|
+
ctrl.fetchResults(event.target.value);
|
64
|
+
ctrl.timeout = null;
|
65
|
+
}
|
66
|
+
},
|
39
67
|
oninput: function oninput(event) {
|
68
|
+
ctrl.state.value(event.target.value);
|
69
|
+
if (opts.queryParam) {
|
70
|
+
ctrl.updateQueryParam(event.target.value);
|
71
|
+
}
|
40
72
|
if (opts.oninput) {
|
41
73
|
opts.oninput(event);
|
42
74
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vhx-quartz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.14
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Robertson, Courtney Burton, Steven Bone, David Gonzalez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|