diff -r 03e8815a012d -r 18b9be54174d client/js/save-once.js --- a/client/js/save-once.js Fri May 22 17:50:10 2015 +0200 +++ b/client/js/save-once.js Tue Jun 02 16:42:02 2015 +0200 @@ -20,12 +20,12 @@ url: _opts.url, data: getdata, beforeSend: function(){ - _proj.set({loading_status:true}); + _proj.set({loadingStatus:true}); }, success: function(_data) { - _proj.set(_data, {validate: true}); - _proj.set({loading_status:false}); - _proj.set({save_status:0}); + _renkan.dataloader.load(_data); + _proj.set({loadingStatus:false}); + _proj.set({saveStatus:0}); _renkan.renderer.autoScale(); } }); @@ -39,20 +39,20 @@ contentType: "application/json", data: JSON.stringify(_data), beforeSend: function(){ - _proj.set({save_status:2}); + _proj.set({saveStatus:2}); }, success: function(data, textStatus, jqXHR) { $(window).off("beforeunload", _onLeave); _saveWarn = false; - _proj.set({save_status:0}); + _proj.set({saveStatus:0}); //document.location.hash = "#id=" + data.id; //$(".Rk-Notifications").text("Saved as "+document.location.href).fadeIn().delay(2000).fadeOut(); } }); }; var _checkLeave = function() { - _proj.set({save_status:1}); - + _proj.set({saveStatus:1}); + var title = _proj.get("title"); if (title && _proj.get("nodes").length) { $(".Rk-Save-Button").removeClass("disabled"); @@ -69,14 +69,14 @@ }; _load(); _proj.on("add:nodes add:edges add:users change", function(_model) { - _model.on("change remove", function(_model) { - if(!(_model.changedAttributes.length === 1 && _model.hasChanged('save_status'))) { - _checkLeave(); - } - }); - if(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('save_status'))) { - _checkLeave(); - } + _model.on("change remove", function(_model) { + if(!(_model.changedAttributes.length === 1 && _model.hasChanged('saveStatus'))) { + _checkLeave(); + } + }); + if(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('saveStatus'))) { + _checkLeave(); + } }); _renkan.renderer.save = function() { if ($(".Rk-Save-Button").hasClass("disabled")) {