Commit bb88002a authored by Piotr Gawron's avatar Piotr Gawron
Browse files

comments checkbox moved from customMap

parent 4fe8d1d9
...@@ -291,43 +291,8 @@ CustomMap.prototype.createMapMenu = function() { ...@@ -291,43 +291,8 @@ CustomMap.prototype.createMapMenu = function() {
var rightHeaderMenu = document.createElement('div'); var rightHeaderMenu = document.createElement('div');
rightHeaderMenu.className = "rightHeaderMenu"; rightHeaderMenu.className = "rightHeaderMenu";
var submenuDiv = document.createElement('div');
submenuDiv.className = "div4checkboxes";
var commentCheckbox = document.createElement('input');
commentCheckbox.type = "checkbox";
commentCheckbox.name = "Comments";
commentCheckbox.id = ControlType.COMMENT_CHECKBOX;
commentCheckbox.onclick = function() {
ServerConnector.getSessionData(selfMap.getProject()).setShowComments(commentCheckbox.checked);
if (commentCheckbox.checked) {
document.getElementById('refresh_comments_button').style.display = 'inline';
} else {
document.getElementById('refresh_comments_button').style.display = 'none';
}
return selfMap.refreshComments();
};
this.addControl(commentCheckbox);
var element = document.createElement('label');
element.innerHTML = "COMMENTS";
element.setAttribute("for", ControlType.COMMENT_CHECKBOX);
submenuDiv.appendChild(commentCheckbox);
submenuDiv.appendChild(element);
var submenuButtonDiv = document.createElement('button'); var submenuButtonDiv = document.createElement('button');
submenuButtonDiv.id = "refresh_comments_button";
submenuButtonDiv.innerHTML = "<i class='fa fa-refresh' style='font-size:21px; font-weight:400;'></i>";
submenuButtonDiv.className = "overview_button";
submenuButtonDiv.style.display = 'none';
submenuButtonDiv.onclick = (function() {
return function() {
selfMap.refreshComments();
return false;
};
})();
submenuDiv.appendChild(submenuButtonDiv);
rightHeaderMenu.appendChild(submenuDiv);
submenuButtonDiv = document.createElement('button');
submenuButtonDiv.id = "clear_button"; submenuButtonDiv.id = "clear_button";
submenuButtonDiv.className = "overview_button"; submenuButtonDiv.className = "overview_button";
submenuButtonDiv.innerHTML = "<i class='fa fa-times' style='font-size:18px; font-weight:300; padding-right:10px;'></i> CLEAR"; submenuButtonDiv.innerHTML = "<i class='fa fa-times' style='font-size:18px; font-weight:300; padding-right:10px;'></i> CLEAR";
......
...@@ -265,6 +265,24 @@ function create(params) { ...@@ -265,6 +265,24 @@ function create(params) {
project = params.getProject(); project = params.getProject();
} }
document.getElementsByName("versionDiv")[0].innerHTML=project.getVersion(); document.getElementsByName("versionDiv")[0].innerHTML=project.getVersion();
var commentCheckbox = document.getElementsByName("commentCheckbox")[0];
var refreshCommentButton = document.getElementsByName("refreshCommentButton")[0];
commentCheckbox.onclick = function() {
ServerConnector.getSessionData(project).setShowComments(commentCheckbox.checked);
if (commentCheckbox.checked) {
refreshCommentButton.style.display = 'inline';
} else {
refreshCommentButton.style.display = 'none';
}
return result.refreshComments();
};
refreshCommentButton.onclick = (function() {
return function() {
result.refreshComments();
return false;
};
})();
if (ServerConnector.getSessionData().getShowComments()) { if (ServerConnector.getSessionData().getShowComments()) {
result.getControl(ControlType.COMMENT_CHECKBOX).checked=true; result.getControl(ControlType.COMMENT_CHECKBOX).checked=true;
......
...@@ -35,7 +35,7 @@ Helper.prototype.createMenuDiv = function() { ...@@ -35,7 +35,7 @@ Helper.prototype.createMenuDiv = function() {
result.appendChild(hideDiv); result.appendChild(hideDiv);
var versionDiv = document.createElement("div"); var versionDiv = document.createElement("div");
result.setAttribute("name", "versionDiv"); versionDiv.setAttribute("name", "versionDiv");
result.appendChild(versionDiv); result.appendChild(versionDiv);
var button = document.createElement("button"); var button = document.createElement("button");
...@@ -51,7 +51,16 @@ Helper.prototype.createMenuDiv = function() { ...@@ -51,7 +51,16 @@ Helper.prototype.createMenuDiv = function() {
legendCheckbox.setAttribute("type", "checkbox"); legendCheckbox.setAttribute("type", "checkbox");
legendCheckbox.setAttribute("name", "legendCheckbox"); legendCheckbox.setAttribute("name", "legendCheckbox");
result.appendChild(legendCheckbox); result.appendChild(legendCheckbox);
var commentCheckbox = document.createElement("input");
commentCheckbox.setAttribute("type", "checkbox");
commentCheckbox.setAttribute("name", "commentCheckbox");
result.appendChild(commentCheckbox);
var refreshCommentButton = document.createElement("button");
refreshCommentButton.setAttribute("name", "refreshCommentButton");
result.appendChild(refreshCommentButton);
return result; return result;
}; };
......
...@@ -524,12 +524,6 @@ describe('CustomMap', function() { ...@@ -524,12 +524,6 @@ describe('CustomMap', function() {
}); });
}); });
it("showComments", function() {
var map = helper.createCustomMap();
map.getControl(ControlType.COMMENT_CHECKBOX).click();
assert.ok(ServerConnector.getSessionData(map.getProject()).getShowComments());
});
it("changed coords in map", function() { it("changed coords in map", function() {
var map = helper.createCustomMap(); var map = helper.createCustomMap();
var oldCenter = map.getGoogleMap().getCenter(); var oldCenter = map.getGoogleMap().getCenter();
......
...@@ -39,6 +39,14 @@ describe('minerva global', function() { ...@@ -39,6 +39,14 @@ describe('minerva global', function() {
}); });
}); });
it("showComments", function() {
var options = helper.createCustomMapOptions();
return minerva.create(options).then(function() {
document.getElementsByName("commentCheckbox")[0].click();
assert.ok(ServerConnector.getSessionData(options.getProject()).getShowComments());
});
});
it("contructor with GET zoom param", function() { it("contructor with GET zoom param", function() {
var options = helper.createCustomMapOptions(); var options = helper.createCustomMapOptions();
GuiConnector.getParams["zoom"] = "5"; GuiConnector.getParams["zoom"] = "5";
......
...@@ -117,16 +117,29 @@ function initMap(){ ...@@ -117,16 +117,29 @@ function initMap(){
<div style="display: table-cell;height:100%;width:100%;"> <div style="display: table-cell;height:100%;width:100%;">
<div class="menuBelt"> <div class="menuBelt">
<div class="headerHideDivButton"> <div class="headerHideDivButton">
<button name="hideButton" class="headerHideButton"> <button name="hideButton" class="headerHideButton">
<i name="hideButtonIcon" class='fa fa-chevron-left'/> <i name="hideButtonIcon" class='fa fa-chevron-left'/>
</button> </button>
</div>
<div name="versionDiv" class="headerTextBold"/>
<div class="rightHeaderMenu">
<div class="div4checkboxes">
<input type="checkbox" name ="legendCheckbox" />
<label for ="legendCheckbox" >LEGEND</label>
<input type="checkbox" name="commentCheckbox"/>
<label for ="commentCheckbox" >COMMENTS</label>
<button class="overview_button" name="refreshCommentButton" style="display:none">
<i class='fa fa-refresh' style='font-size:21px; font-weight:400;'></i>
</button>
</div>
</div> </div>
<input type="checkbox" name ="legendCheckbox" />
<label for ="legendCheckbox" >LEGEND</label>
</div> </div>
<div id="mapElement" class="mapClass"/> <div id="mapElement" class="mapClass"/>
<div id="legend" class="carousel slide legendBox" style="display:none"> <div class="legendBox">
<div id="legend" class="carousel slide" style="display:none">
<ol name="indicators" class="carousel-indicators"> <ol name="indicators" class="carousel-indicators">
</ol> </ol>
...@@ -142,6 +155,7 @@ function initMap(){ ...@@ -142,6 +155,7 @@ function initMap(){
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span> <span class="sr-only">Next</span>
</a> </a>
</div>
</div> </div>
</div> </div>
......
Markdown is supported
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