0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

Removed usage of SettingsMenuMixin in post settings menu

no issue

- the post settings menu is the only component that uses the mixin so it makes sense to inline it, especially as mixins are deprecated and the mixin's utility is minimal and already overridden in places
This commit is contained in:
Kevin Ansfield 2021-06-17 16:42:34 +01:00
parent 4482aa5395
commit dc1caf0b29
3 changed files with 34 additions and 37 deletions

View file

@ -1,12 +1,11 @@
import Component from '@ember/component';
import SettingsMenuMixin from 'ghost-admin/mixins/settings-menu-component';
import boundOneWay from 'ghost-admin/utils/bound-one-way';
import moment from 'moment';
import {alias, or} from '@ember/object/computed';
import {computed} from '@ember/object';
import {inject as service} from '@ember/service';
export default Component.extend(SettingsMenuMixin, {
export default Component.extend({
feature: service(),
store: service(),
config: service(),
@ -20,6 +19,7 @@ export default Component.extend(SettingsMenuMixin, {
post: null,
showSettingsMenu: false,
_showSettingsMenu: false,
canonicalUrlScratch: alias('post.canonicalUrlScratch'),
@ -66,6 +66,19 @@ export default Component.extend(SettingsMenuMixin, {
return urlParts.join(' > ');
}),
isViewingSubview: computed('showSettingsMenu', {
get() {
return false;
},
set(key, value) {
// Not viewing a subview if we can't even see the PSM
if (!this.showSettingsMenu) {
return false;
}
return value;
}
}),
didReceiveAttrs() {
this._super(...arguments);
@ -86,12 +99,12 @@ export default Component.extend(SettingsMenuMixin, {
actions: {
showSubview(subview) {
this._super(...arguments);
this.set('isViewingSubview', true);
this.set('subview', subview);
},
closeSubview() {
this._super(...arguments);
this.set('isViewingSubview', false);
this.set('subview', null);
},

View file

@ -1,12 +1,11 @@
import Component from '@ember/component';
import SettingsMenuMixin from 'ghost-admin/mixins/settings-menu-component';
import boundOneWay from 'ghost-admin/utils/bound-one-way';
import moment from 'moment';
import {alias, or} from '@ember/object/computed';
import {computed} from '@ember/object';
import {inject as service} from '@ember/service';
export default Component.extend(SettingsMenuMixin, {
export default Component.extend({
feature: service(),
store: service(),
config: service(),
@ -20,6 +19,7 @@ export default Component.extend(SettingsMenuMixin, {
post: null,
showSettingsMenu: false,
_showSettingsMenu: false,
canonicalUrlScratch: alias('post.canonicalUrlScratch'),
@ -66,6 +66,19 @@ export default Component.extend(SettingsMenuMixin, {
return urlParts.join(' > ');
}),
isViewingSubview: computed('showSettingsMenu', {
get() {
return false;
},
set(key, value) {
// Not viewing a subview if we can't even see the PSM
if (!this.showSettingsMenu) {
return false;
}
return value;
}
}),
didReceiveAttrs() {
this._super(...arguments);
@ -86,12 +99,12 @@ export default Component.extend(SettingsMenuMixin, {
actions: {
showSubview(subview) {
this._super(...arguments);
this.set('isViewingSubview', true);
this.set('subview', subview);
},
closeSubview() {
this._super(...arguments);
this.set('isViewingSubview', false);
this.set('subview', null);
},

View file

@ -1,29 +0,0 @@
import Mixin from '@ember/object/mixin';
import {computed} from '@ember/object';
export default Mixin.create({
showSettingsMenu: false,
isViewingSubview: computed('showSettingsMenu', {
get() {
return false;
},
set(key, value) {
// Not viewing a subview if we can't even see the PSM
if (!this.showSettingsMenu) {
return false;
}
return value;
}
}),
actions: {
showSubview() {
this.set('isViewingSubview', true);
},
closeSubview() {
this.set('isViewingSubview', false);
}
}
});