diff options
| author | Owen <despito@MacBook-Pro-de-Despito.local> | 2014-07-22 14:44:46 +0300 |
|---|---|---|
| committer | Owen <despito@MacBook-Pro-de-Despito.local> | 2014-07-22 14:44:46 +0300 |
| commit | 8e115fb2d3ea7eb34a9c3a4307c32034b39d51b1 (patch) | |
| tree | 74ff4a2146af2e332fa131754cc90587f91d8fd6 /scripts/buttons.js | |
| parent | fb95c775d0339c5bf180362c01c6cd433ee3ea97 (diff) | |
Save/UI/gantt changes
save now asks you if you're sure if you've build an unsaved graph
small changes to UI recommended by Yael
took out zooming bug in gantt
Diffstat (limited to 'scripts/buttons.js')
| -rw-r--r-- | scripts/buttons.js | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/scripts/buttons.js b/scripts/buttons.js index 472b58ff..980a51d9 100644 --- a/scripts/buttons.js +++ b/scripts/buttons.js @@ -40,17 +40,22 @@ $('.save').click(function(){ if(j!==links.length-1)jsonsave+=","; } jsonsave+=']}'; - console.log(jsonsave); + console.log(JSON.stringify(jsonsave)); localStorage.setItem(key, JSON.stringify(jsonsave)); }); $('.load').click(function(){ - if (confirm('All unsaved changes will be deleted, are you sure?')) { + var acceptLoad=true; + if (nodes.length>0){ + acceptLoad = confirm('All unsaved changes will be deleted, are you sure?'); + } + + if(acceptLoad){ links=[]; - nodes=[]; - var data = JSON.parse(JSON.parse(localStorage.getItem(key))); - console.log(data); + nodes=[]; + var data = JSON.parse(JSON.parse(localStorage.getItem(key))); + console.log(data); for(var i=0; i<data["nodes"].length; i++){ var node=data.nodes[i]; graph.addNodeComplete(node.id,node.type,"perm",new Date(node.start),new Date(node.end)); |
