mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-13 22:41:32 -05:00
e9326f6f6e
No issue - ember-simple-auth@0.8.0-beta.2. - Switch from SimpleAuth global to ember-cli-simple-auth and ES6 imports. - Refactor controllers to handle changes in 0.8. - Introduces a new initializer to override some configuration items that are set in environment.js but need to be set with information that's only (easily) available at runtime.
29 lines
1,015 B
JavaScript
29 lines
1,015 B
JavaScript
import AuthenticatedRouteMixin from 'simple-auth/mixins/authenticated-route-mixin';
|
|
import MobileIndexRoute from 'ghost/routes/mobile-index-route';
|
|
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
|
|
import mobileQuery from 'ghost/utils/mobile';
|
|
|
|
var SettingsIndexRoute = MobileIndexRoute.extend(AuthenticatedRouteMixin, CurrentUserSettings, {
|
|
titleToken: 'Settings',
|
|
|
|
// Redirect users without permission to view settings,
|
|
// and show the settings.general route unless the user
|
|
// is mobile
|
|
beforeModel: function () {
|
|
var self = this;
|
|
return this.get('session.user')
|
|
.then(this.transitionAuthor())
|
|
.then(this.transitionEditor())
|
|
.then(function () {
|
|
if (!mobileQuery.matches) {
|
|
self.transitionTo('settings.general');
|
|
}
|
|
});
|
|
},
|
|
|
|
desktopTransition: function () {
|
|
this.transitionTo('settings.general');
|
|
}
|
|
});
|
|
|
|
export default SettingsIndexRoute;
|