server/src/main/webapp/WEB-INF/templates/renkanProjectEdit.html
changeset 77 4f2511a70880
parent 59 69924ca1b233
child 80 5295e118320b
--- a/server/src/main/webapp/WEB-INF/templates/renkanProjectEdit.html	Wed Mar 13 15:47:08 2013 +0100
+++ b/server/src/main/webapp/WEB-INF/templates/renkanProjectEdit.html	Thu Mar 14 00:29:09 2013 +0100
@@ -20,12 +20,13 @@
         <script src="js/twitter-bin.js" th:src="@{/static/js/twitter-bin.js}"></script>
         <script src="js/wikipedia-bin.js" th:src="@{/static/js/wikipedia-bin.js}"></script>
         <script src="js/ldtjson-bin.js" th:src="@{/static/js/ldtjson-bin.js}"></script>
+        <script src="js/list-bin.js" th:src="@{/static/js/list-bin.js}"></script>
         <script src="js/paper-renderer.js" th:src="@{/static/js/paper-renderer.js}"></script>
         <script type="text/javascript" src="js/config.js" th:src="@{/static/js/config.js}"></script>
         <script type="text/javascript" src="lib/dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true" th:src="@{/static/lib/dojo/dojo.js}"></script>                
         <script type="text/javascript" th:inline="javascript">
             $(function() {
-                var _renkan = new Rkns.Renkan({
+            	var renkan_config = {
                     url: /*[[@{/rest/projects/}+${project.id}]]*/ "data/simple-persist.php",
                     static_url : /*[[@{/static/}]]*/ "",
                     bins: [
@@ -67,7 +68,18 @@
                             type: Rkns.Twitter.Search
                         }
                     ],
-                });
+                };
+            	var space_config = /*[[${space.binConfig}?${space.binConfig}:'{}']]*/"{}";
+            	space_config = JSON.parse(space_config);
+            	for ( var i in (('bins' in space_config)?space_config.bins:[])) {
+					var bin_def = space_config.bins[i];
+            		bin_def.bin = eval(bin_def.bin);
+				}
+                for ( var i in (('search' in space_config)?space_config.search:[])) {
+                    var search_def = space_config.search[i];
+                	search_def.type = eval(bin_def.type);
+                }
+                var _renkan = new Rkns.Renkan($.extend({}, renkan_config, space_config));
                 var corenkanConfig = {
         	        projectId: /*[[${project.id}]]*/"new_project",
         	        renkan : _renkan
@@ -76,7 +88,7 @@
                 require({corenkanConfig: corenkanConfig}, ["corenkan"], function(corenkan) {            
                     corenkan.app.onStatusChange = function(status) {
                     	if(status == "ready") {
-                    		_renkan.renderer.autoScale();
+                    	    _renkan.renderer.autoScale();
                     	}
                     };
                 });