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

45 lines
1.0 KiB
JavaScript
Raw Normal View History

2019-04-15 08:54:11 +03:00
/* exported SearchResult */
/* globals SearchStore: true */
/* globals layerMgr: true */
var SearchResult = {
view: function(){
function getLayer(obj){
var layer = layerMgr.getLayerByY(obj.y);
return layer ? layer.name : "<unknown>";
}
function getPos(obj){
var layer = layerMgr.getLayerByY(obj.y);
var link = (layer ? layer.id : "0") + "/" + obj.x + "/" + obj.z + "/" + 12;
var text = obj.x + "/" + obj.y + "/" + obj.z;
return m("a", { href: "#" + link }, text);
}
var rows = SearchStore.result.map(function(obj){
return m("tr", [
m("td", obj.type),
m("td", obj.attributes.owner),
m("td", getLayer(obj)),
m("td", getPos(obj)),
m("td", "stuff")
]);
});
return m("table", {class:"table"}, [
m("thead", [
m("tr", [
m("th", "Type"),
m("th", "Owner"),
m("th", "Layer"),
m("th", "Position"),
m("th", "Description")
])
]),
m("tbody", rows)
]);
}
};