2014-09-15 23:55:37 -05:00
|
|
|
import MobileIndexRoute from 'ghost/routes/mobile-index-route';
|
2014-07-25 02:52:17 -05:00
|
|
|
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
|
2014-09-15 23:55:37 -05:00
|
|
|
import mobileQuery from 'ghost/utils/mobile';
|
2014-03-20 21:55:32 -05:00
|
|
|
|
2014-09-15 23:55:37 -05:00
|
|
|
var SettingsIndexRoute = MobileIndexRoute.extend(SimpleAuth.AuthenticatedRouteMixin, CurrentUserSettings, {
|
|
|
|
// Redirect users without permission to view settings,
|
|
|
|
// and show the settings.general route unless the user
|
|
|
|
// is mobile
|
2014-07-13 12:03:48 -05:00
|
|
|
beforeModel: function () {
|
2014-07-25 02:52:17 -05:00
|
|
|
var self = this;
|
2014-09-15 23:55:37 -05:00
|
|
|
return this.currentUser()
|
2014-07-25 02:52:17 -05:00
|
|
|
.then(this.transitionAuthor())
|
|
|
|
.then(this.transitionEditor())
|
|
|
|
.then(function () {
|
|
|
|
if (!mobileQuery.matches) {
|
|
|
|
self.transitionTo('settings.general');
|
2014-07-13 12:03:48 -05:00
|
|
|
}
|
2014-07-25 02:52:17 -05:00
|
|
|
});
|
2014-07-13 12:03:48 -05:00
|
|
|
},
|
2014-09-15 23:55:37 -05:00
|
|
|
|
|
|
|
desktopTransition: function () {
|
|
|
|
this.transitionTo('settings.general');
|
2014-03-09 22:44:08 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-06-19 21:29:49 -05:00
|
|
|
export default SettingsIndexRoute;
|