Move ugly debug to Settings Labs

closes #4534

- Adds new Labs route
- Wires route in settings page
- Move and rename debug templates and logic to labs
- Redirect /debug to settings/labs
This commit is contained in:
cobbspur 2014-12-01 11:39:11 +00:00
parent bb1ee6f7d0
commit 920e36f8e0
8 changed files with 83 additions and 87 deletions

View File

@ -1,4 +1,4 @@
var DebugController = Ember.Controller.extend(Ember.Evented, {
var LabsController = Ember.Controller.extend(Ember.Evented, {
uploadButtonText: 'Import',
importErrors: '',
@ -63,4 +63,4 @@ var DebugController = Ember.Controller.extend(Ember.Evented, {
}
});
export default DebugController;
export default LabsController;

View File

@ -39,8 +39,10 @@ Router.map(function () {
this.route('about');
this.route('tags');
this.route('labs');
});
// Redirect debug to settings labs
this.route('debug');
// Redirect legacy content to posts

View File

@ -1,29 +1,7 @@
import AuthenticatedRoute from 'ghost/routes/authenticated';
import styleBody from 'ghost/mixins/style-body';
import loadingIndicator from 'ghost/mixins/loading-indicator';
var DebugRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator, {
titleToken: 'Debug',
classNames: ['settings'],
beforeModel: function (transition) {
this._super(transition);
var self = this;
this.store.find('user', 'me').then(function (user) {
if (user.get('isAuthor') || user.get('isEditor')) {
self.transitionTo('posts');
var DebugRoute = Ember.Route.extend({
beforeModel: function () {
this.transitionTo('settings.labs');
}
});
},
model: function () {
return this.store.find('setting', {type: 'blog,theme'}).then(function (records) {
return records.get('firstObject');
});
}
});
export default DebugRoute;

View File

@ -0,0 +1,23 @@
import AuthenticatedRoute from 'ghost/routes/authenticated';
import styleBody from 'ghost/mixins/style-body';
import CurrentUserSettings from 'ghost/mixins/current-user-settings';
import loadingIndicator from 'ghost/mixins/loading-indicator';
var LabsRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator, CurrentUserSettings, {
titleToken: 'Labs',
classNames: ['settings'],
beforeModel: function () {
return this.currentUser()
.then(this.transitionAuthor())
.then(this.transitionEditor());
},
model: function () {
return this.store.find('setting', {type: 'blog,theme'}).then(function (records) {
return records.get('firstObject');
});
}
});
export default LabsRoute;

View File

@ -1,60 +0,0 @@
<header class="page-header">
<button class="menu-button js-menu-button" {{action "toggleGlobalMobileNav"}}><span class="sr-only">Menu</span></button>
<h2 class="page-title">Settings</h2>
</header>
<div class="page-content">
<div class="settings-content">
<header class="settings-view-header">
<h2 class="page-title">Ugly Debug Tools</h2>
<div class="js-settings-header-inner settings-header-inner">
{{#link-to 'settings' class='btn btn-default btn-back'}}Back{{/link-to}}
</div>
</header>
<section class="content settings-debug">
<form id="settings-export">
<fieldset>
<div class="form-group">
<label>Export</label>
<a class="btn btn-blue" {{action "exportData"}}>Export</a>
<p>Export the blog settings and data.</p>
</div>
</fieldset>
</form>
{{#gh-form id="settings-import" enctype="multipart/form-data"}}
<fieldset>
<div class="form-group">
<label>Import</label>
{{partial "import-errors"}}
{{gh-file-upload id="importfile" uploadButtonText=uploadButtonText}}
<p>Import from another Ghost installation. If you import a user, this will replace the current user & log you out.</p>
</div>
</fieldset>
{{/gh-form}}
<form id="settings-resetdb">
<fieldset>
<div class="form-group">
<label>Delete all Content</label>
<a href="javascript:void(0);" class="btn btn-red js-delete" {{action "openModal" "deleteAll"}}>Delete</a>
<p>Delete all posts and tags from the database.</p>
</div>
</fieldset>
</form>
<form id="settings-testmail">
<fieldset>
<div class="form-group">
<label>Send a test email</label>
<button type="submit" id="sendtestmail" class="btn btn-blue" {{action "sendTestEmail"}}>Send</button>
<p>Sends a test email to your address.</p>
</div>
</fieldset>
</form>
</section>
</div>
</div>

View File

@ -18,6 +18,7 @@
{{gh-activating-list-item route="settings.users" title="Users" classNames="settings-nav-users icon-users"}}
{{gh-activating-list-item route="settings.labs" title="Labs" classNames="settings-nav-labs icon-atom"}}
{{/unless}}
{{gh-activating-list-item route="settings.about" title="About" classNames="settings-nav-about icon-pacman"}}

View File

@ -0,0 +1,47 @@
<header class="settings-view-header">
<h2 class="page-title">Labs</h2>
<div class="js-settings-header-inner settings-header-inner">
{{#link-to 'settings' class='btn btn-default btn-back'}}Back{{/link-to}}
</div>
</header>
<section class="content settings-debug">
<form id="settings-export">
<fieldset>
<div class="form-group">
<label>Export</label>
<a class="btn btn-blue" {{action "exportData"}}>Export</a>
<p>Export the blog settings and data.</p>
</div>
</fieldset>
</form>
{{#gh-form id="settings-import" enctype="multipart/form-data"}}
<fieldset>
<div class="form-group">
<label>Import</label>
{{partial "import-errors"}}
{{gh-file-upload id="importfile" uploadButtonText=uploadButtonText}}
<p>Import from another Ghost installation. If you import a user, this will replace the current user & log you out.</p>
</div>
</fieldset>
{{/gh-form}}
<form id="settings-resetdb">
<fieldset>
<div class="form-group">
<label>Delete all Content</label>
<a href="javascript:void(0);" class="btn btn-red js-delete" {{action "openModal" "deleteAll"}}>Delete</a>
<p>Delete all posts and tags from the database.</p>
</div>
</fieldset>
</form>
<form id="settings-testmail">
<fieldset>
<div class="form-group">
<label>Send a test email</label>
<button type="submit" id="sendtestmail" class="btn btn-blue" {{action "sendTestEmail"}}>Send</button>
<p>Sends a test email to your address.</p>
</div>
</fieldset>
</form>
</section>

View File

@ -0,0 +1,5 @@
import BaseView from 'ghost/views/settings/content-base';
var SettingsLabsView = BaseView.extend();
export default SettingsLabsView;