Ghost/ghost/admin/app/routes/setup.js
Peter Zimon c51bce7358 🎨 Updated admin area design and usability (#1232)
refs. https://github.com/TryGhost/Team/issues/205

Major update to Ghost Admin UI including:
- improved general consistency (typography, colors and contrast, UI components, icons)
- new design for post and pages lists, improved discoverability of filters 
- search moved to modal
- account menu is decoupled from ghost logo
- further usability fixes
2019-06-18 11:47:20 +01:00

58 lines
1.7 KiB
JavaScript

import Route from '@ember/routing/route';
import {inject as service} from '@ember/service';
export default Route.extend({
ghostPaths: service(),
session: service(),
ajax: service(),
config: service(),
// use the beforeModel hook to check to see whether or not setup has been
// previously completed. If it has, stop the transition into the setup page.
beforeModel() {
this._super(...arguments);
if (this.get('session.isAuthenticated')) {
return this.transitionTo('home');
}
let authUrl = this.get('ghostPaths.url').api('authentication', 'setup');
// check the state of the setup process via the API
return this.ajax.request(authUrl)
.then((result) => {
let [setup] = result.setup;
if (setup.status) {
return this.transitionTo('signin');
} else {
let controller = this.controllerFor('setup/two');
if (setup.title) {
controller.set('blogTitle', setup.title.replace(/'/gim, '\''));
}
if (setup.name) {
controller.set('name', setup.name.replace(/'/gim, '\''));
}
if (setup.email) {
controller.set('email', setup.email);
}
}
});
},
deactivate() {
this._super(...arguments);
this.controllerFor('setup/two').set('password', '');
},
buildRouteInfoMetadata() {
return {
titleToken: 'Setup',
bodyClasses: ['unauthenticated-route'],
mainClasses: ['gh-main-white']
};
}
});