Commit bce26f39 authored by Dominik Rosiek's avatar Dominik Rosiek

projct managing js

parent 03b553f9
......@@ -34,7 +34,6 @@ Map.prototype.addMarker = function(data){
title: data.title,
beacon: data.beacon
}).addListener('click', function() {
if(!project_data){
$.getJSON("/api/user_project/" + project_id + "/beacons", function(beacon){ return function(data){
project_data = data
project_summary['uuids'] = [];
......@@ -43,10 +42,6 @@ Map.prototype.addMarker = function(data){
}
self.showInfo(beacon)
}}(this.beacon))
}
else{
self.showInfo(this.beacon)
}
})
self.markers.push(marker)
......@@ -117,15 +112,16 @@ Map.prototype.showInfo = function(beacon){
$("#removeFromProjectBtn").click(function(beacon){ return function(){
$.getJSON("/api/user_project/" + project_id, function(beacon){ return function(data){
var index = data['beacon_managers'].indexOf(beacon.beacon_manager_url)
data['beacon_managers'].slice(index, 1);
var index = data['beacon_managers'].indexOf(beacon.beacon_manager)
data['beacon_managers'] = data['beacon_managers'].slice(index, -1);
delete data['url'];
$.ajax({
url: "/api/user_project/" + project_id,
type: 'PUT',
data: data,
dataType: "json",
data: JSON.stringify(data),
contentType: "application/json",
success: function(result) {
alert(result)
alert(JSON.stringify(result))
}
});
......@@ -134,14 +130,15 @@ Map.prototype.showInfo = function(beacon){
$("#addToProjectBtn").click(function(beacon){ return function(){
$.getJSON("/api/user_project/" + project_id, function(beacon){ return function(data){
data['beacon_managers'].push(beacon.beacon_manager_url)
data['beacon_managers'].push(beacon.beacon_manager)
delete data['url'];
$.ajax({
url: "/api/user_project/" + project_id,
type: 'PUT',
data: data,
dataType: "json",
data: JSON.stringify(data),
contentType: "application/json",
success: function(result) {
alert(result)
alert(JSON.stringify(result))
}
});
......
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