Geo code coffe script
authordeclerambaul <fabian.kaelin@gmail.com>
Tue, 17 Apr 2012 02:08:02 +0000 (22:08 -0400)
committerdeclerambaul <fabian.kaelin@gmail.com>
Tue, 17 Apr 2012 02:08:02 +0000 (22:08 -0400)
lib/main-geo.co [new file with mode: 0644]

diff --git a/lib/main-geo.co b/lib/main-geo.co
new file mode 100644 (file)
index 0000000..32cabf4
--- /dev/null
@@ -0,0 +1,52 @@
+Seq      = require 'seq'
+Backbone = require 'backbone'
+
+{ _, op,
+} = require 'kraken/util'
+{ BaseView, BaseModel, BaseList,
+} = require 'kraken/base'
+{ ChartType, DygraphsChartType,
+} = require 'kraken/chart'
+{ Graph, GraphList, GraphDisplayView,
+} = require 'kraken/graph'
+{ DashboardView,
+} = require 'kraken/dashboard'
+
+
+
+root = this
+CHART_OPTIONS_SPEC    = []
+CHART_DEFAULT_OPTIONS = {}
+
+
+# Create the Graph Scaffold
+main = ->
+    # Set up Dygraph chart type spec
+    # TODO: load this on-demand
+    dyglib = new DygraphsChartType CHART_OPTIONS_SPEC
+    
+    # _.dump _.clone(data.options), 'data.options'
+    
+    # Instantiate model & view
+    dashboard = root.dashboard = new DashboardView do
+        graph_spec : root.CHART_OPTIONS_SPEC # FIXME: necessary?
+    
+    $ '#content .inner' .append dashboard.el
+
+
+
+# Load data files
+Seq([   <[ CHART_OPTIONS_SPEC /schema/dygraph.json ]>
+])
+.parEach_ (next, [key, url]) ->
+    jQuery.ajax do
+        url : url,
+        dataType : 'json'
+        success : (res) ->
+            root[key] = res
+            next.ok()
+        error : (err) -> console.error err
+.seq ->
+    console.log 'All data loaded!'
+    jQuery main
+