mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 20:34:02 +03:00
da4270ce35
- Every route can set a title token that is combined with the blog’s title, resulting in titles like ‘Content - Test Blog’. - Subroutes are supported (‘Settings - General - Test Blog’) - The blog’s name is applied to and taken from the `config` object to spare Ember a REST call via `store.find(‘settings’)`. - Tests have been changed to test for the new titles. - The initially proposed solution (https://github.com/paddle8/ember-document-title) doesn’t play nice with EAK, which is why I went with this solution (https://gist.github.com/machty/8413411) by Ember.JS core dev @Machty.
29 lines
936 B
JavaScript
29 lines
936 B
JavaScript
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(SimpleAuth.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.currentUser()
|
|
.then(this.transitionAuthor())
|
|
.then(this.transitionEditor())
|
|
.then(function () {
|
|
if (!mobileQuery.matches) {
|
|
self.transitionTo('settings.general');
|
|
}
|
|
});
|
|
},
|
|
|
|
desktopTransition: function () {
|
|
this.transitionTo('settings.general');
|
|
}
|
|
});
|
|
|
|
export default SettingsIndexRoute;
|