1
0
forked from MTSR/mapserver
mapserver/server/static/js/search/SearchInput.js

37 lines
842 B
JavaScript
Raw Normal View History

2019-04-15 08:54:11 +03:00
/* exported SearchInput */
/* globals SearchService: true */
/* globals SearchStore: true */
var SearchInput = {
view: function(){
function handleInput(e){
2019-04-21 22:51:43 +03:00
SearchStore.query = e.target.value;
}
function handleKeyDown(e){
if (e.keyCode == 13){
SearchService.search();
}
}
function handleDoSearch(){
SearchService.search();
}
2019-04-14 20:51:31 +03:00
return m("div", { class: "input-group mb-3" }, [
2019-04-15 08:54:11 +03:00
m("input[type=text]", {
placeholder: "Search",
class: "form-control",
oninput: handleInput,
2019-04-21 22:51:43 +03:00
onkeydown: handleKeyDown,
2019-04-15 08:54:11 +03:00
value: SearchStore.query
2019-04-21 22:51:43 +03:00
}),
m("div", { class: "input-group-append", onclick: handleDoSearch }, [
m("span", { class: "input-group-text" }, [
m("i", { class: "fa fa-search"})
])
])
2019-04-14 20:51:31 +03:00
]);
}
2019-04-15 08:54:11 +03:00
};