From 8965db6bdb89ac4a99add446300e5d02474290d6 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Fri, 7 Jul 2017 10:36:47 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20remove=20content=20screen=20keyb?= =?UTF-8?q?oard=20shortcuts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes https://github.com/TryGhost/Ghost/issues/8662 - removes `k`, `j`, `up`, `down` shortcuts for changing the active post (these were already mostly unusable in 1.0) and the associated `enter` and `ctrl/cmd+backspace` commands for opening and triggering the delete modal respectively - removes the `c` shortcut for opening the new post screen --- ghost/admin/app/controllers/posts.js | 6 --- ghost/admin/app/routes/posts.js | 75 +--------------------------- ghost/admin/app/templates/posts.hbs | 11 ---- 3 files changed, 1 insertion(+), 91 deletions(-) diff --git a/ghost/admin/app/controllers/posts.js b/ghost/admin/app/controllers/posts.js index 51b27e215a..218093fbac 100644 --- a/ghost/admin/app/controllers/posts.js +++ b/ghost/admin/app/controllers/posts.js @@ -17,8 +17,6 @@ export default Controller.extend({ _hasLoadedTags: false, _hasLoadedAuthors: false, - showDeletePostModal: false, - availableTypes: [{ name: 'All posts', value: null @@ -101,10 +99,6 @@ export default Controller.extend({ }), actions: { - toggleDeletePostModal() { - this.toggleProperty('showDeletePostModal'); - }, - changeType(type) { this.set('type', get(type, 'value')); }, diff --git a/ghost/admin/app/routes/posts.js b/ghost/admin/app/routes/posts.js index 65fa760cfb..4d297c69dc 100644 --- a/ghost/admin/app/routes/posts.js +++ b/ghost/admin/app/routes/posts.js @@ -1,11 +1,10 @@ import $ from 'jquery'; import AuthenticatedRoute from 'ghost-admin/routes/authenticated'; import InfinityRoute from 'ember-infinity/mixins/route'; -import ShortcutsRoute from 'ghost-admin/mixins/shortcuts-route'; import {assign} from 'ember-platform'; import {isBlank} from 'ember-utils'; -export default AuthenticatedRoute.extend(InfinityRoute, ShortcutsRoute, { +export default AuthenticatedRoute.extend(InfinityRoute, { titleToken: 'Content', perPage: 30, @@ -32,7 +31,6 @@ export default AuthenticatedRoute.extend(InfinityRoute, ShortcutsRoute, { }, _type: null, - _selectedPostIndex: null, model(params) { return this.get('session.user').then((user) => { @@ -121,50 +119,8 @@ export default AuthenticatedRoute.extend(InfinityRoute, ShortcutsRoute, { }); }, - stepThroughPosts(step) { - let currentPost = this.get('controller.selectedPost'); - let posts = this.get('controller.model'); - let length = posts.get('length'); - let newPosition; - - // when the currentPost is deleted we won't be able to use indexOf. - // we keep track of the index locally so we can select next after deletion - if (this._selectedPostIndex !== null && length) { - newPosition = this._selectedPostIndex + step; - } else { - newPosition = posts.indexOf(currentPost) + step; - } - - // if we are on the first or last item - // just do nothing (desired behavior is to not - // loop around) - if (newPosition >= length) { - return; - } else if (newPosition < 0) { - return; - } - - this._selectedPostIndex = newPosition; - this.set('controller.selectedPost', posts.objectAt(newPosition)); - }, - - shortcuts: { - 'up, k': 'moveUp', - 'down, j': 'moveDown', - 'enter': 'editPost', - 'c': 'newPost', - 'command+backspace, ctrl+backspace': 'deletePost' - }, - - resetController() { - this.set('controller.selectedPost', null); - this.set('controller.showDeletePostModal', false); - }, - actions: { willTransition() { - this._selectedPostIndex = null; - if (this.get('controller')) { this.resetController(); } @@ -175,35 +131,6 @@ export default AuthenticatedRoute.extend(InfinityRoute, ShortcutsRoute, { $('.content-list').scrollTop(0); this._super(...arguments); - }, - - newPost() { - this.transitionTo('editor.new'); - }, - - moveUp() { - this.stepThroughPosts(-1); - }, - - moveDown() { - this.stepThroughPosts(1); - }, - - editPost() { - let selectedPost = this.get('controller.selectedPost'); - - if (selectedPost) { - this.transitionTo('editor.edit', selectedPost.get('id')); - } - }, - - deletePost() { - this.get('controller').send('toggleDeletePostModal'); - }, - - onPostDeletion() { - // select next post (re-select the current index) - this.stepThroughPosts(0); } } }); diff --git a/ghost/admin/app/templates/posts.hbs b/ghost/admin/app/templates/posts.hbs index 77556021cd..1a63db0f92 100644 --- a/ghost/admin/app/templates/posts.hbs +++ b/ghost/admin/app/templates/posts.hbs @@ -86,7 +86,6 @@ {{#each model as |post|}} {{gh-posts-list-item post=post - active=(eq post selectedPost) onDoubleClick="openEditor" data-test-post-id=post.id}} {{else}} @@ -110,15 +109,5 @@ triggerOffset=1000}} - {{#if showDeletePostModal}} - {{gh-fullscreen-modal "delete-post" - model=(hash - post=selectedPost - onSuccess=(route-action 'onPostDeletion') - ) - close=(action "toggleDeletePostModal") - modifier="action wide"}} - {{/if}} - {{outlet}}