Skip to content

Instantly share code, notes, and snippets.

@dandehavilland
Created May 19, 2015 16:10
Show Gist options
  • Save dandehavilland/dee2d45ae241e4af1a8f to your computer and use it in GitHub Desktop.
Save dandehavilland/dee2d45ae241e4af1a8f to your computer and use it in GitHub Desktop.
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