import Ember from 'ember';
import ApplicationRouteMixin from 'simple-auth/mixins/application-route-mixin';
/* global ga */
/* global mixpanel */

export default Ember.Route.extend(ApplicationRouteMixin).extend({
  activate: function() {
    return this.store.find('word_list');
  },
  notifyGoogleAnalytics: function() {
    return ga('send', 'pageview', {
      'page': this.get('url'),
      'title': this.get('url')
    });
  }.on('didTransition'),
  didTransition: function(paths){
    this._super(paths);
    Ember.run.next(function(){
      path = window.location.href;
      mixpanel.track("pageview", {"url": path });
    });
  },
  actions: {
    willTransition: function() {
      this.controller.set("showMenu", false);
      Ember.$(document).attr('title', 'Wordset – the Collaborative Dictionary');
    }
  }
});

@@ -451,63 +451,35 @@
 ,%0A  
-didTransition: function(paths)%7B%0A    this._super(paths);
+notifyMixpanel: function()%7B
 %0A   
@@ -598,24 +598,44 @@
 %0A    %7D);%0A  %7D
+.on('didTransition')
 ,%0A  actions:

fix mixpanel tracking