From c868dd6224ca2c988bc3c516531739716e4a5eef Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Sun, 16 Jan 2022 13:44:06 +0000 Subject: [PATCH] Refactored use of ShortcutsRoute mixin on tags screen no issue - mixins are deprecated in Ember so we want to remove their usage - pre-requisite for easier automation for switching to native class syntax - removed ShortcutsRoute mixin in favor of using the `{{on-key}}` modifier and standard controller action --- ghost/admin/app/controllers/tags.js | 6 ++++++ ghost/admin/app/routes/tags.js | 18 +----------------- ghost/admin/app/templates/tags.hbs | 2 +- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/ghost/admin/app/controllers/tags.js b/ghost/admin/app/controllers/tags.js index 3a6f23505f..7bf81a5a46 100644 --- a/ghost/admin/app/controllers/tags.js +++ b/ghost/admin/app/controllers/tags.js @@ -1,8 +1,10 @@ import Controller from '@ember/controller'; import {alias, sort} from '@ember/object/computed'; import {computed} from '@ember/object'; +import {inject as service} from '@ember/service'; export default Controller.extend({ + router: service(), queryParams: ['type'], type: 'public', @@ -24,6 +26,10 @@ export default Controller.extend({ actions: { changeType(type) { this.set('type', type); + }, + + newTag() { + this.router.transitionTo('tag.new'); } } }); diff --git a/ghost/admin/app/routes/tags.js b/ghost/admin/app/routes/tags.js index d3f8f6e313..b12004152a 100644 --- a/ghost/admin/app/routes/tags.js +++ b/ghost/admin/app/routes/tags.js @@ -1,7 +1,6 @@ import AuthenticatedRoute from 'ghost-admin/routes/authenticated'; -import ShortcutsRoute from 'ghost-admin/mixins/shortcuts-route'; -export default AuthenticatedRoute.extend(ShortcutsRoute, { +export default AuthenticatedRoute.extend({ queryParams: { type: { refreshModel: true, @@ -9,15 +8,6 @@ export default AuthenticatedRoute.extend(ShortcutsRoute, { } }, - shortcuts: null, - - init() { - this._super(...arguments); - this.shortcuts = { - c: 'newTag' - }; - }, - // authors aren't allowed to manage tags beforeModel() { this._super(...arguments); @@ -40,12 +30,6 @@ export default AuthenticatedRoute.extend(ShortcutsRoute, { } }, - actions: { - newTag() { - this.transitionTo('tag.new'); - } - }, - buildRouteInfoMetadata() { return { titleToken: 'Tags' diff --git a/ghost/admin/app/templates/tags.hbs b/ghost/admin/app/templates/tags.hbs index 6e4cc370d5..ad10f62ded 100644 --- a/ghost/admin/app/templates/tags.hbs +++ b/ghost/admin/app/templates/tags.hbs @@ -1,4 +1,4 @@ -
+

Tags