Created
May 19, 2015 16:10
-
-
Save dandehavilland/dee2d45ae241e4af1a8f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
import AuthenticatedRoute from 'dashboard/routes/authenticated'; | |
import DateRangedMixin from 'dashboard/routes/mixins/date-ranged'; | |
import ChartMixin from 'dashboard/routes/mixins/chart'; | |
export default AuthenticatedRoute.extend(DateRangedMixin, ChartMixin, { | |
model: function(options) { | |
var _this = this; | |
return this.store.findQueryOne( | |
'poi', | |
options['poi_id'], | |
{ | |
from: this.get('analytics.from'), | |
to: this.get('analytics.to'), | |
visitors: true | |
}) | |
.then(function(poi) { | |
var analytics = _this.get('analytics'); | |
return Ember.RSVP.hash({ | |
poi: poi, | |
timeseriesData: analytics.fetchTimeseries(poi, 'visitor_series'), | |
histogramData: analytics.fetchHistogram(poi, 'dwell_time_histogram') | |
}); | |
}); | |
}, | |
afterModel: function(resolvedModel) { | |
this.set('storage.selectedPoiId', resolvedModel.poi.get('id')); | |
}, | |
setupController: function(controller) { | |
this._super.apply(this, arguments); | |
controller.set('allPoi', this.store.all('poi')); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment