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