active_editors_target
very_active_editors
]>
+
+ core_graph_ids : ["unique_visitors ","pageviews","pageviews_mobile", "new_editors","active_editors", "active_editors_target"]
+
subviews : []
graphs : null
ready : false
initialize: ->
@model or= new Dashboard
BaseView::initialize ...
- @graphs.on 'add', @attachGraphs, this
+ # @graphs.on 'add', @attachGraphs, this
+ @graphs.on 'add', @attachGraph, this
@load()
@attachGraphs()
@trigger 'ready', this
+ attachGraph: (graph) ->
+ console.log 'Attach graph',graph
+
+ return if graph.view.isAttached
+
+ # graphs_el = if graph.id in @core_graph_ids then @$el.find '.core-graphs-pane' else @$el.find '.other-graphs-pane'
+
+ graphs_el = @$el.find '.other-graphs-pane' # @$el.find '.core-graphs-pane'
+
+ console.log graph.id
+ console.log @core_graph_ids
+ console.log "if graph.id in @core_graph_ids" , (graph.id in @core_graph_ids)
+
+ graphs_el.append graph.view.el
+ @subviews.push graph.view
+ graph.view.isAttached = true
+ graph.on 'ready', ->
+ graph.off 'ready', arguments.callee
+ graph.view.renderChart()
+
+ this
+
+
attachGraphs: ->
graphs_el = @$el.find '#graphs'
for id of @graph_ids
section#graphs
+ .row
+ .graphs.tabbable
+ nav
+ ul.nav.subnav.nav-pills
+ li: h3 Graphs
+ li.active: a(href="#core-graphs", data-toggle="tab") Core
+ li: a(href="#other-graphs", data-toggle="tab") Others
+
+ .tab-content
+ .core-graphs-pane.tab-pane.active(id="core-graphs")
+ .other-graphs-pane.tab-pane(id="other-graphs")