client/js/full-json.js
changeset 414 276042cb477c
parent 370 8dff53b60f4e
child 443 4c7ab16e5845
--- a/client/js/full-json.js	Sat Mar 28 04:28:21 2015 +0100
+++ b/client/js/full-json.js	Mon Mar 30 09:53:48 2015 +0200
@@ -7,35 +7,46 @@
     }
     var _load = function() {
         _renkan.renderer.redrawActive = false;
-        _proj.set({loading_status:true});
+        _proj.set({
+            loading_status : true
+        });
         Rkns.$.getJSON(_opts.url, function(_data) {
-            _proj.set(_data, {validate: true});
-            _proj.set({loading_status:false});
-            _proj.set({save_status:0});
+            _proj.set(_data, {
+                validate : true
+            });
+            _proj.set({
+                loading_status : false
+            });
+            _proj.set({
+                save_status : 0
+            });
             _renkan.renderer.redrawActive = true;
-            _renkan.renderer.autoScale();
+            _renkan.renderer.fixSize();
         });
     };
     var _save = function() {
-    	_proj.set({save_status:2});
+        _proj.set({
+            save_status : 2
+        });
         var _data = _proj.toJSON();
         if (!_renkan.read_only) {
             Rkns.$.ajax({
-                type: _opts.http_method,
-                url: _opts.url,
-                contentType: "application/json",
-                data: JSON.stringify(_data),
-                success: function(data, textStatus, jqXHR) {
-                	_proj.set({save_status:0});
+                type : _opts.http_method,
+                url : _opts.url,
+                contentType : "application/json",
+                data : JSON.stringify(_data),
+                success : function(data, textStatus, jqXHR) {
+                    _proj.set({
+                        save_status : 0
+                    });
                 }
             });
         }
 
     };
-    var _thrSave = Rkns._.throttle(
-        function() {
-            setTimeout(_save, 100);
-        }, 1000);
+    var _thrSave = Rkns._.throttle(function() {
+        setTimeout(_save, 100);
+    }, 1000);
     _proj.on("add:nodes add:edges add:users add:views", function(_model) {
         _model.on("change remove", function(_model) {
             _thrSave();
@@ -43,9 +54,10 @@
         _thrSave();
     });
     _proj.on("change", function() {
-    	if(!(_proj.changedAttributes.length === 1 && _proj.hasChanged('save_status'))) {
-    		_thrSave();
-    	}
+        if (!(_proj.changedAttributes.length === 1 && _proj
+                .hasChanged('save_status'))) {
+            _thrSave();
+        }
     });
 
     _load();