Loading template/app/Application.js +5 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ Ext.define('Docs.Application', { requires: [ 'Docs.History', 'Docs.Auth', 'Docs.Settings' ], Loading Loading @@ -40,6 +41,10 @@ Ext.define('Docs.Application', { Docs.History.init(); if (Docs.enableComments) { Docs.Auth.init(); } // When google analytics event tracking script present on page if (Docs.initEventTracking) { Docs.initEventTracking(); Loading template/app/Auth.js +16 −9 Original line number Diff line number Diff line Loading @@ -3,23 +3,30 @@ */ Ext.define('Docs.Auth', { singleton: true, mixins: { observable: "Ext.util.Observable" }, requires: [ 'Ext.Ajax', 'Ext.JSON', 'Ext.util.Cookies' ], /** * @event initialized * Fired after the connection to comments server is successfully * established. */ constructor: function(config) { this.mixins.observable.constructor.call(this, config); }, /** * Checks if a user is logged in server side and sets up a local * session if they are. * @param {Function} callback * @param {Object} scope */ init: function(callback, scope) { if (!Docs.enableComments) { return; } init: function() { Ext.Ajax.request({ url: Docs.baseUrl + '/session_new', params: { sid: this.getSid() }, Loading @@ -37,11 +44,11 @@ Ext.define('Docs.Auth', { this.currentUser = data; } callback && callback.call(scope); this.fireEvent("initialized"); } else { // when comments server is down or something else // is seriously wrong, don't fire the callback. // is seriously wrong, don't fire the event. // By this we stop the whole comments system. } }, Loading template/app/controller/Auth.js +8 −11 Original line number Diff line number Diff line Loading @@ -18,17 +18,7 @@ Ext.define('Docs.controller.Auth', { ], init: function() { this.control({ 'authForm': { afterrender: this.initSession, login: this.login, logout: this.logout } }); }, initSession: function() { Docs.Auth.init(function() { Docs.Auth.on("initialized", function() { if (Docs.Auth.isLoggedIn()) { this.setLoggedIn(); } Loading @@ -36,6 +26,13 @@ Ext.define('Docs.controller.Auth', { this.setLoggedOut(); } }, this); this.control({ 'authForm': { login: this.login, logout: this.logout } }); }, login: function(username, password, remember) { Loading Loading
template/app/Application.js +5 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ Ext.define('Docs.Application', { requires: [ 'Docs.History', 'Docs.Auth', 'Docs.Settings' ], Loading Loading @@ -40,6 +41,10 @@ Ext.define('Docs.Application', { Docs.History.init(); if (Docs.enableComments) { Docs.Auth.init(); } // When google analytics event tracking script present on page if (Docs.initEventTracking) { Docs.initEventTracking(); Loading
template/app/Auth.js +16 −9 Original line number Diff line number Diff line Loading @@ -3,23 +3,30 @@ */ Ext.define('Docs.Auth', { singleton: true, mixins: { observable: "Ext.util.Observable" }, requires: [ 'Ext.Ajax', 'Ext.JSON', 'Ext.util.Cookies' ], /** * @event initialized * Fired after the connection to comments server is successfully * established. */ constructor: function(config) { this.mixins.observable.constructor.call(this, config); }, /** * Checks if a user is logged in server side and sets up a local * session if they are. * @param {Function} callback * @param {Object} scope */ init: function(callback, scope) { if (!Docs.enableComments) { return; } init: function() { Ext.Ajax.request({ url: Docs.baseUrl + '/session_new', params: { sid: this.getSid() }, Loading @@ -37,11 +44,11 @@ Ext.define('Docs.Auth', { this.currentUser = data; } callback && callback.call(scope); this.fireEvent("initialized"); } else { // when comments server is down or something else // is seriously wrong, don't fire the callback. // is seriously wrong, don't fire the event. // By this we stop the whole comments system. } }, Loading
template/app/controller/Auth.js +8 −11 Original line number Diff line number Diff line Loading @@ -18,17 +18,7 @@ Ext.define('Docs.controller.Auth', { ], init: function() { this.control({ 'authForm': { afterrender: this.initSession, login: this.login, logout: this.logout } }); }, initSession: function() { Docs.Auth.init(function() { Docs.Auth.on("initialized", function() { if (Docs.Auth.isLoggedIn()) { this.setLoggedIn(); } Loading @@ -36,6 +26,13 @@ Ext.define('Docs.controller.Auth', { this.setLoggedOut(); } }, this); this.control({ 'authForm': { login: this.login, logout: this.logout } }); }, login: function(username, password, remember) { Loading