Commit 07f6f73a authored by Piotr Gawron's avatar Piotr Gawron
Browse files

overlay name doesn't contain order number for public overlays

parent 5aa7d144
...@@ -98,6 +98,23 @@ AliasInfoWindow.prototype.init = function () { ...@@ -98,6 +98,23 @@ AliasInfoWindow.prototype.init = function () {
}); });
}; };
/**
*
* @param {DataOverlay} overlay
* @return {string}
* @package
*/
AliasInfoWindow.prototype._getPrintableOverlayName = function (overlay) {
var name = overlay.getName();
if (name.length > 20) {
name = name.substr(0, 20) + "...";
}
if (!overlay.getPublicOverlay()) {
name = "[" + overlay.getOrder() + "] " + name;
}
return name;
};
/** /**
* Creates and returns chart representing data related to alias on different * Creates and returns chart representing data related to alias on different
* overlays. * overlays.
...@@ -132,11 +149,7 @@ AliasInfoWindow.prototype.createChartDiv = function (params) { ...@@ -132,11 +149,7 @@ AliasInfoWindow.prototype.createChartDiv = function (params) {
} else { } else {
rowDiv.className = "minerva-chart-row-odd"; rowDiv.className = "minerva-chart-row-odd";
} }
var name = overlays[i].getName(); var name = self._getPrintableOverlayName(overlays[i]);
if (name.length > 20) {
name = name.substr(0, 20) + "...";
}
name = "[" + overlays[i].getOrder() + "] " + name;
var nameDiv = document.createElement("div"); var nameDiv = document.createElement("div");
nameDiv.className = "minerva-chart-name"; nameDiv.className = "minerva-chart-name";
nameDiv.innerHTML = name + " "; nameDiv.innerHTML = name + " ";
......
...@@ -362,6 +362,23 @@ describe('AliasInfoWindow', function () { ...@@ -362,6 +362,23 @@ describe('AliasInfoWindow', function () {
assert.ok(functions.isDomElement(aliasWindow.createWaitingContentDiv())); assert.ok(functions.isDomElement(aliasWindow.createWaitingContentDiv()));
}); });
it("getPrintableOverlayName", function () {
var map = helper.createCustomMap();
var alias = helper.createAlias(map);
alias.setIsComplete(true);
var aliasWindow = new AliasInfoWindow({
alias: alias,
map: map,
marker: helper.createMarker({element: alias, map: map})
});
var overlay = helper.createOverlay();
overlay.setPublicOverlay(true);
overlay.setOrder(137778);
assert.equal(-1, aliasWindow._getPrintableOverlayName(overlay).indexOf(overlay.getOrder() + ""));
});
describe("createChartDiv ", function () { describe("createChartDiv ", function () {
it("on submap map", function () { it("on submap map", function () {
helper.setUrl("http://test/?id=complex_model_with_submaps"); helper.setUrl("http://test/?id=complex_model_with_submaps");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment