allow searching for bones

This commit is contained in:
NatureFreshMilk 2019-05-14 08:31:35 +02:00
parent 6e86c2bcf3
commit cb00adae5f
2 changed files with 17 additions and 6 deletions

View File

@ -23,6 +23,7 @@ var SearchResult = {
var description = obj.type; var description = obj.type;
var type = obj.type; var type = obj.type;
// train-line result
if (obj.type == "train"){ if (obj.type == "train"){
description = [ description = [
m("span", obj.attributes.station), m("span", obj.attributes.station),
@ -33,11 +34,19 @@ var SearchResult = {
type = m("i", { class: "fa fa-subway" }); type = m("i", { class: "fa fa-subway" });
} }
// travelnet
if (obj.type == "travelnet"){ if (obj.type == "travelnet"){
description = m("span", obj.attributes.station_name); description = m("span", obj.attributes.station_name);
type = m("img", { src: "pics/travelnet_inv.png" }); type = m("img", { src: "pics/travelnet_inv.png" });
} }
// bones
if (obj.type == "bones"){
description = m("span", obj.attributes.owner);
type = m("img", { src: "pics/bones_top.png" });
}
// poi marker
if (obj.type == "poi"){ if (obj.type == "poi"){
description = m("span", obj.attributes.name); description = m("span", obj.attributes.name);
@ -49,6 +58,7 @@ var SearchResult = {
]); ]);
} }
//shop
if (obj.type == "shop") { if (obj.type == "shop") {
if (obj.attributes.stock == 0){ if (obj.attributes.stock == 0){
row_classes += "table-warning"; row_classes += "table-warning";

View File

@ -29,12 +29,13 @@ var SearchService = {
}); });
} }
var prom_list = []; var prom_list = [
searchFor("shop", "out_item", SearchStore.query),
prom_list.push(searchFor("shop", "out_item", SearchStore.query)); searchFor("poi", "name", SearchStore.query),
prom_list.push(searchFor("poi", "name", SearchStore.query)); searchFor("train", "station", SearchStore.query),
prom_list.push(searchFor("train", "station", SearchStore.query)); searchFor("travelnet", "station_name", SearchStore.query),
prom_list.push(searchFor("travelnet", "station_name", SearchStore.query)); searchFor("bones", "owner", SearchStore.query)
];
Promise.all(prom_list) Promise.all(prom_list)
.then(function(results){ .then(function(results){