Commit 2e32bf95 authored by Dominik Rosiek's avatar Dominik Rosiek

usuwanie linkóœ

parent 590511d8
...@@ -38,13 +38,21 @@ Map.prototype.addMarker = function(data){ ...@@ -38,13 +38,21 @@ Map.prototype.addMarker = function(data){
icon: image, icon: image,
title: data.title, title: data.title,
beacon: data.beacon beacon: data.beacon
}).addListener('click', function() { })
marker.addListener('click', function() {
self.showInfo(this.beacon) self.showInfo(this.beacon)
}) })
self.markers.push(marker) self.markers.push(marker)
} }
Map.prototype.clearMarkers = function(){
for(var i=0; i<this.markers.length; i++){
this.markers[i].setMap(null);
}
}
Map.prototype.getAllBeacons = function(){ Map.prototype.getAllBeacons = function(){
var self = this; var self = this;
$.getJSON("/api/user_project/" + project_id + "/beacons", function(data){ $.getJSON("/api/user_project/" + project_id + "/beacons", function(data){
...@@ -68,6 +76,7 @@ Map.prototype.getAllBeacons = function(){ ...@@ -68,6 +76,7 @@ Map.prototype.getAllBeacons = function(){
} }
Map.prototype.showInfo = function(beacon){ Map.prototype.showInfo = function(beacon){
var self = true;
$("#myModalLabel").text([beacon.name, " (", beacon.uuid, ")"].join("")) $("#myModalLabel").text([beacon.name, " (", beacon.uuid, ")"].join(""))
$("#modal-content").html([ $("#modal-content").html([
'<div class="col-md-6">', '<div class="col-md-6">',
...@@ -126,7 +135,9 @@ Map.prototype.showInfo = function(beacon){ ...@@ -126,7 +135,9 @@ Map.prototype.showInfo = function(beacon){
data: JSON.stringify(data), data: JSON.stringify(data),
contentType: "application/json", contentType: "application/json",
success: function(result) { success: function(result) {
alert(JSON.stringify(result)) map.clearMarkers();
map.getAllBeacons();
$("#myModal").modal("hide");
} }
}); });
...@@ -143,7 +154,9 @@ Map.prototype.showInfo = function(beacon){ ...@@ -143,7 +154,9 @@ Map.prototype.showInfo = function(beacon){
data: JSON.stringify(data), data: JSON.stringify(data),
contentType: "application/json", contentType: "application/json",
success: function(result) { success: function(result) {
alert(JSON.stringify(result)) map.clearMarkers();
map.getAllBeacons();
$("#myModal").modal("hide");
} }
}); });
......
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