discourse/app/assets/javascripts/discourse/controllers/application_controller.js
Robin Ward b794830a25 Replaced Em.run.next with the more proper Em.run.schedule('afterRender')
when we are waiting for rendering to finish.
2013-05-20 12:20:10 -04:00

31 lines
707 B
JavaScript

/*global _gaq:true */
/**
The base controller for all things Discourse
@class ApplicationController
@extends Discourse.Controller
@namespace Discourse
@module Discourse
**/
Discourse.ApplicationController = Discourse.Controller.extend({
needs: ['modal'],
showLogin: function() {
var _ref;
return (_ref = this.get('controllers.modal')) ? _ref.show(Discourse.LoginView.create()) : void 0;
},
routeChanged: function(){
if (window._gaq === undefined) { return; }
if(this.afterFirstHit) {
Em.run.schedule('afterRender', function() {
_gaq.push(['_trackPageview']);
});
} else {
this.afterFirstHit = true;
}
}.observes('currentPath')
});