Skip to content

Instantly share code, notes, and snippets.

@AndyMoreland
Created August 5, 2014 01:31
Show Gist options
  • Save AndyMoreland/b647652a4b51f0ad3f9e to your computer and use it in GitHub Desktop.
Save AndyMoreland/b647652a4b51f0ad3f9e to your computer and use it in GitHub Desktop.
_ = require 'underscore'
Query = require '../../models/query'
# Intended to compute various properties about a report model
# This should keep view logic out of the model, hopefully.
module.exports =
class ReportPresenter extends window.Backbone.Model
@AxisProvider: null
initialize: ({@report}) ->
# Proxy model events through the presenter
@listenTo @report, 'all', =>
@trigger.apply this, arguments
getWeekOverWeekChange: =>
throw new Error 'Abstract method.'
getData: =>
@report.get 'data'
getDomain: =>
throw new Error 'Abstract method.'
getRange: =>
throw new Error 'Abstract method.'
buildAxisProvider: =>
new @AxisProvider({reportPresenter: this})
getLineData: =>
throw new Error 'Abstract method.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment