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
This commit is contained in:
Kevin Ansfield 2022-01-16 13:44:06 +00:00
parent 683a8584ce
commit c868dd6224
3 changed files with 8 additions and 18 deletions

View File

@ -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');
}
}
});

View File

@ -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'

View File

@ -1,4 +1,4 @@
<section class="gh-canvas">
<section class="gh-canvas" {{on-key "c" (action "newTag")}}>
<GhCanvasHeader class="gh-canvas-header">
<h2 class="gh-canvas-title" data-test-screen-title>Tags</h2>
<section class="view-actions">