Push plugin options after default options.

This commit is contained in:
Guo Xiang Tan 2016-06-16 21:23:11 +08:00
parent 2484ef93ed
commit 5d9e6d2395
No known key found for this signature in database
GPG Key ID: 19C321C8952B0F72
1 changed files with 24 additions and 22 deletions

View File

@ -62,19 +62,6 @@ export default Ember.Controller.extend({
topic: null,
linkLookup: null,
init() {
this._super();
addPopupMenuOptionsCallback(() => {
return {
action: 'toggleWhisper',
icon: 'eye-slash',
label: 'composer.toggle_whisper',
condition: "canWhisper"
};
});
},
showToolbar: Em.computed({
get(){
const keyValueStore = this.container.lookup('key-value-store:main');
@ -116,10 +103,7 @@ export default Ember.Controller.extend({
return popupMenuOptions ? popupMenuOptions.some(option => option.condition) : false;
},
@computed("model.composeState")
popupMenuOptions(composeState) {
if (composeState === 'open') {
return _popupMenuOptionsCallbacks.map(callback => {
_setupPopupMenuOption(callback) {
let option = callback();
if (option.condition) {
@ -129,7 +113,25 @@ export default Ember.Controller.extend({
}
return option;
});
},
@computed("model.composeState")
popupMenuOptions(composeState) {
if (composeState === 'open') {
let options = [];
options.push(this._setupPopupMenuOption(() => {
return {
action: 'toggleWhisper',
icon: 'eye-slash',
label: 'composer.toggle_whisper',
condition: "canWhisper"
};
}));
return options.concat(_popupMenuOptionsCallbacks.map(callback => {
return this._setupPopupMenuOption(callback);
}));
}
},