mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
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:
parent
683a8584ce
commit
c868dd6224
@ -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');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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'
|
||||
|
@ -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">
|
||||
|
Loading…
Reference in New Issue
Block a user