From 920e36f8e04c6184ff01e341015099386f23a511 Mon Sep 17 00:00:00 2001 From: cobbspur Date: Mon, 1 Dec 2014 11:39:11 +0000 Subject: [PATCH] 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 --- .../{debug.js => settings/labs.js} | 4 +- ghost/admin/router.js | 2 + ghost/admin/routes/debug.js | 28 +-------- ghost/admin/routes/settings/labs.js | 23 +++++++ ghost/admin/templates/debug.hbs | 60 ------------------- ghost/admin/templates/settings.hbs | 1 + ghost/admin/templates/settings/labs.hbs | 47 +++++++++++++++ ghost/admin/views/settings/labs.js | 5 ++ 8 files changed, 83 insertions(+), 87 deletions(-) rename ghost/admin/controllers/{debug.js => settings/labs.js} (95%) create mode 100644 ghost/admin/routes/settings/labs.js delete mode 100644 ghost/admin/templates/debug.hbs create mode 100644 ghost/admin/templates/settings/labs.hbs create mode 100644 ghost/admin/views/settings/labs.js diff --git a/ghost/admin/controllers/debug.js b/ghost/admin/controllers/settings/labs.js similarity index 95% rename from ghost/admin/controllers/debug.js rename to ghost/admin/controllers/settings/labs.js index 8b2fc29ffd..e586f23358 100644 --- a/ghost/admin/controllers/debug.js +++ b/ghost/admin/controllers/settings/labs.js @@ -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; diff --git a/ghost/admin/router.js b/ghost/admin/router.js index f0bbfd031b..4d1fa9b974 100644 --- a/ghost/admin/router.js +++ b/ghost/admin/router.js @@ -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 diff --git a/ghost/admin/routes/debug.js b/ghost/admin/routes/debug.js index d91ba7fa02..618a9f9773 100644 --- a/ghost/admin/routes/debug.js +++ b/ghost/admin/routes/debug.js @@ -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'); - } - }); - }, - - model: function () { - return this.store.find('setting', {type: 'blog,theme'}).then(function (records) { - return records.get('firstObject'); - }); +var DebugRoute = Ember.Route.extend({ + beforeModel: function () { + this.transitionTo('settings.labs'); } - }); export default DebugRoute; diff --git a/ghost/admin/routes/settings/labs.js b/ghost/admin/routes/settings/labs.js new file mode 100644 index 0000000000..727fb4bb30 --- /dev/null +++ b/ghost/admin/routes/settings/labs.js @@ -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; diff --git a/ghost/admin/templates/debug.hbs b/ghost/admin/templates/debug.hbs deleted file mode 100644 index 25936f04be..0000000000 --- a/ghost/admin/templates/debug.hbs +++ /dev/null @@ -1,60 +0,0 @@ - - -
- -
- -
-

Ugly Debug Tools

-
- {{#link-to 'settings' class='btn btn-default btn-back'}}Back{{/link-to}} -
-
- -
- -
-
-
- - Export -

Export the blog settings and data.

-
-
-
- {{#gh-form id="settings-import" enctype="multipart/form-data"}} -
-
- - {{partial "import-errors"}} - {{gh-file-upload id="importfile" uploadButtonText=uploadButtonText}} -

Import from another Ghost installation. If you import a user, this will replace the current user & log you out.

-
-
- {{/gh-form}} -
-
-
- - Delete -

Delete all posts and tags from the database.

-
-
-
-
-
-
- - -

Sends a test email to your address.

-
-
-
-
- -
- -
\ No newline at end of file diff --git a/ghost/admin/templates/settings.hbs b/ghost/admin/templates/settings.hbs index 631a0ef224..f8171aec4a 100644 --- a/ghost/admin/templates/settings.hbs +++ b/ghost/admin/templates/settings.hbs @@ -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"}} diff --git a/ghost/admin/templates/settings/labs.hbs b/ghost/admin/templates/settings/labs.hbs new file mode 100644 index 0000000000..0413e68195 --- /dev/null +++ b/ghost/admin/templates/settings/labs.hbs @@ -0,0 +1,47 @@ +
+

Labs

+
+ {{#link-to 'settings' class='btn btn-default btn-back'}}Back{{/link-to}} +
+
+ + +
+
+
+
+ + Export +

Export the blog settings and data.

+
+
+
+ {{#gh-form id="settings-import" enctype="multipart/form-data"}} +
+
+ + {{partial "import-errors"}} + {{gh-file-upload id="importfile" uploadButtonText=uploadButtonText}} +

Import from another Ghost installation. If you import a user, this will replace the current user & log you out.

+
+
+ {{/gh-form}} +
+
+
+ + Delete +

Delete all posts and tags from the database.

+
+
+
+
+
+
+ + +

Sends a test email to your address.

+
+
+
+
diff --git a/ghost/admin/views/settings/labs.js b/ghost/admin/views/settings/labs.js new file mode 100644 index 0000000000..78f89248df --- /dev/null +++ b/ghost/admin/views/settings/labs.js @@ -0,0 +1,5 @@ +import BaseView from 'ghost/views/settings/content-base'; + +var SettingsLabsView = BaseView.extend(); + +export default SettingsLabsView;