0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00
ghost/core/client/routes/settings/index.js

30 lines
1,008 B
JavaScript
Raw Normal View History

import {mobileQuery} from 'ghost/utils/mobile';
var SettingsIndexRoute = Ember.Route.extend(SimpleAuth.AuthenticatedRouteMixin, {
// redirect to general tab, unless on a mobile phone
beforeModel: function () {
if (!mobileQuery.matches) {
this.transitionTo('settings.general');
} else {
//fill the empty {{outlet}} in settings.hbs if the user
//goes to fullscreen
//fillOutlet needs special treatment so that it is
//properly bound to this when called from a MQ event
this.set('fillOutlet', _.bind(function fillOutlet(mq) {
if (!mq.matches) {
this.transitionTo('settings.general');
}
}, this));
mobileQuery.addListener(this.fillOutlet);
}
},
deactivate: function () {
if (this.get('fillOutlet')) {
mobileQuery.removeListener(this.fillOutlet);
}
}
});
export default SettingsIndexRoute;