2019-04-15 08:54:11 +03:00
|
|
|
/* exported SearchMenu */
|
|
|
|
/* globals SearchResult: true */
|
|
|
|
/* globals SearchService: true */
|
|
|
|
/* globals SearchStore: true */
|
2019-04-14 20:17:43 +03:00
|
|
|
|
|
|
|
var SearchMenu = {
|
2019-04-20 18:59:22 +03:00
|
|
|
view: function(vnode){
|
|
|
|
|
2019-04-14 20:17:43 +03:00
|
|
|
var style = {};
|
|
|
|
|
2019-04-21 22:51:43 +03:00
|
|
|
if (!SearchStore.show) {
|
2019-04-14 20:17:43 +03:00
|
|
|
style.display = "none";
|
|
|
|
}
|
|
|
|
|
2019-04-14 20:51:31 +03:00
|
|
|
function close(){
|
2019-04-15 08:54:11 +03:00
|
|
|
SearchService.clear();
|
2019-04-14 20:51:31 +03:00
|
|
|
}
|
|
|
|
|
2019-04-21 22:51:43 +03:00
|
|
|
function getContent(){
|
|
|
|
if (SearchStore.busy){
|
|
|
|
return m("div", m("i", { class: "fa fa-spinner"}));
|
|
|
|
} else {
|
|
|
|
return m(SearchResult, { map: vnode.attrs.map });
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-14 20:17:43 +03:00
|
|
|
return m("div", { class: "card", id: "search-menu", style: style }, [
|
2019-04-14 20:51:31 +03:00
|
|
|
m("div", { class: "card-header" }, [
|
|
|
|
m("i", { class: "fa fa-search"}),
|
|
|
|
"Search",
|
|
|
|
m("i", { class: "fa fa-times float-right", onclick: close }),
|
|
|
|
]),
|
2019-04-21 22:51:43 +03:00
|
|
|
m("div", { class: "card-body", style: {overflow: "auto"} }, getContent())
|
2019-04-14 20:17:43 +03:00
|
|
|
]);
|
|
|
|
}
|
2019-04-15 08:54:11 +03:00
|
|
|
};
|