First implementation of status change.
authorymh <ymh.work@gmail.com>
Mon, 25 Mar 2013 19:49:19 +0100
changeset 124 c04232f8cc53
parent 123 daa99448319d
child 125 82fcd1c24cd8
First implementation of status change.
server/src/main/webapp/WEB-INF/templates/renkanProjectEdit.html
server/src/main/webapp/static/js/corenkan.js
--- a/server/src/main/webapp/WEB-INF/templates/renkanProjectEdit.html	Mon Mar 25 19:27:26 2013 +0100
+++ b/server/src/main/webapp/WEB-INF/templates/renkanProjectEdit.html	Mon Mar 25 19:49:19 2013 +0100
@@ -36,6 +36,7 @@
             $(function() {
             	var renkan_config = {
                     static_url : /*[[@{/static/}]]*/ "",
+                    read_only: true,
                     bins: [
                         {
                             type: "Wikipedia",
@@ -90,8 +91,6 @@
 
                 require({corenkanConfig: corenkanConfig}, ["corenkan"], function(corenkan) {            
                     corenkan.app.onStatusChange = function(status) {
-                    	if(status == "ready") {
-                    	}
                     };
                 });
             });
--- a/server/src/main/webapp/static/js/corenkan.js	Mon Mar 25 19:27:26 2013 +0100
+++ b/server/src/main/webapp/static/js/corenkan.js	Mon Mar 25 19:49:19 2013 +0100
@@ -39,6 +39,7 @@
 
 	    	sess.onStatusChange = function(status) {
 	    	    console.log(status);
+	    	    that.onInternalStatusChange(status);
 	    	    if(typeof that.onStatusChange === "function") {
 	    	    	that.onStatusChange(status);
 	    	    }
@@ -117,6 +118,17 @@
     	this.project.set(obj, {validate: true});
     };
     
+    proto.onInternalStatusChange = function(status) {
+    	if(status == "ready") {
+    	    this.renkan.read_only = false;
+    		this.renkan.onStatusChange();
+    	}
+    	else {
+            this.renkan.read_only = true;
+            this.renkan.onStatusChange();                    		
+    	}
+    };
+    
     function prepareValues(obj,c) {
 		values = {};
 		for(var fieldname in c.changes) {