mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Fix route for About page
No Issue - Routes, views and controllers updated for about page - fix up tests and add redirect check
This commit is contained in:
parent
33444fe09c
commit
2515a8769e
7 changed files with 47 additions and 34 deletions
|
@ -1,5 +1,5 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
var SettingsAboutController = Ember.Controller.extend({
|
var AboutController = Ember.Controller.extend({
|
||||||
updateNotificationCount: 0,
|
updateNotificationCount: 0,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
|
@ -9,4 +9,4 @@ var SettingsAboutController = Ember.Controller.extend({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export default SettingsAboutController;
|
export default AboutController;
|
|
@ -20,6 +20,7 @@ Router.map(function () {
|
||||||
this.route('signout');
|
this.route('signout');
|
||||||
this.route('signup', {path: '/signup/:token'});
|
this.route('signup', {path: '/signup/:token'});
|
||||||
this.route('reset', {path: '/reset/:token'});
|
this.route('reset', {path: '/reset/:token'});
|
||||||
|
this.route('about', {path: '/about'});
|
||||||
|
|
||||||
this.resource('posts', {path: '/'}, function () {
|
this.resource('posts', {path: '/'}, function () {
|
||||||
this.route('post', {path: ':post_id'});
|
this.route('post', {path: ':post_id'});
|
||||||
|
@ -37,6 +38,7 @@ Router.map(function () {
|
||||||
this.route('user', {path: '/:slug'});
|
this.route('user', {path: '/:slug'});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Redirect about page
|
||||||
this.route('about');
|
this.route('about');
|
||||||
this.route('tags');
|
this.route('tags');
|
||||||
this.route('labs');
|
this.route('labs');
|
||||||
|
|
35
ghost/admin/app/routes/about.js
Normal file
35
ghost/admin/app/routes/about.js
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
import AuthenticatedRoute from 'ghost/routes/authenticated';
|
||||||
|
import loadingIndicator from 'ghost/mixins/loading-indicator';
|
||||||
|
import styleBody from 'ghost/mixins/style-body';
|
||||||
|
|
||||||
|
var AboutRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator, {
|
||||||
|
titleToken: 'About',
|
||||||
|
|
||||||
|
classNames: ['view-about'],
|
||||||
|
|
||||||
|
cachedConfig: false,
|
||||||
|
model: function () {
|
||||||
|
var cachedConfig = this.get('cachedConfig'),
|
||||||
|
self = this;
|
||||||
|
if (cachedConfig) {
|
||||||
|
return cachedConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ic.ajax.request(this.get('ghostPaths.url').api('configuration'))
|
||||||
|
.then(function (configurationResponse) {
|
||||||
|
var configKeyValues = configurationResponse.configuration;
|
||||||
|
cachedConfig = {};
|
||||||
|
configKeyValues.forEach(function (configKeyValue) {
|
||||||
|
cachedConfig[configKeyValue.key] = configKeyValue.value;
|
||||||
|
});
|
||||||
|
self.set('cachedConfig', cachedConfig);
|
||||||
|
return cachedConfig;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
renderTemplate: function () {
|
||||||
|
this.render('about', {into: 'application'});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default AboutRoute;
|
|
@ -3,32 +3,8 @@ import loadingIndicator from 'ghost/mixins/loading-indicator';
|
||||||
import styleBody from 'ghost/mixins/style-body';
|
import styleBody from 'ghost/mixins/style-body';
|
||||||
|
|
||||||
var SettingsAboutRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator, {
|
var SettingsAboutRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator, {
|
||||||
titleToken: 'About',
|
beforeModel: function () {
|
||||||
|
this.transitionTo('about');
|
||||||
classNames: ['settings-view-about'],
|
|
||||||
|
|
||||||
cachedConfig: false,
|
|
||||||
model: function () {
|
|
||||||
var cachedConfig = this.get('cachedConfig'),
|
|
||||||
self = this;
|
|
||||||
if (cachedConfig) {
|
|
||||||
return cachedConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ic.ajax.request(this.get('ghostPaths.url').api('configuration'))
|
|
||||||
.then(function (configurationResponse) {
|
|
||||||
var configKeyValues = configurationResponse.configuration;
|
|
||||||
cachedConfig = {};
|
|
||||||
configKeyValues.forEach(function (configKeyValue) {
|
|
||||||
cachedConfig[configKeyValue.key] = configKeyValue.value;
|
|
||||||
});
|
|
||||||
self.set('cachedConfig', cachedConfig);
|
|
||||||
return cachedConfig;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
renderTemplate: function () {
|
|
||||||
this.render('settings/about', {into: 'application'});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<header class="gh-about-header">
|
<header class="gh-about-header">
|
||||||
<img class="gh-logo" src="{{gh-path 'admin' '/img/ghost-logo.png'}}" alt="Ghost" />
|
<img class="gh-logo" src="{{gh-path 'admin' '/img/ghost-logo.png'}}" alt="Ghost" />
|
||||||
<!-- TODO: fix about notifications -->
|
<!-- TODO: fix about notifications -->
|
||||||
{{gh-notifications location="settings-about-upgrade" notify="updateNotificationChange"}}
|
{{gh-notifications location="about-upgrade" notify="updateNotificationChange"}}
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
<section class="gh-env-details">
|
<section class="gh-env-details">
|
5
ghost/admin/app/views/about.js
Normal file
5
ghost/admin/app/views/about.js
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import BaseView from 'ghost/views/settings/content-base';
|
||||||
|
|
||||||
|
var AboutView = BaseView.extend();
|
||||||
|
|
||||||
|
export default AboutView;
|
|
@ -1,5 +0,0 @@
|
||||||
import BaseView from 'ghost/views/settings/content-base';
|
|
||||||
|
|
||||||
var SettingsAboutView = BaseView.extend();
|
|
||||||
|
|
||||||
export default SettingsAboutView;
|
|
Loading…
Add table
Reference in a new issue