Merge pull request #2115 from loganhz/tootip

Fix the issue that tooltip always shows
This commit is contained in:
Vincent Fiduccia 2018-07-30 10:56:11 -07:00 committed by GitHub
commit c67ca5e39b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 10 deletions

View File

@ -1,7 +1,7 @@
import Component from '@ember/component';
import layout from './template';
import { inject as service } from '@ember/service'
import { computed, get } from '@ember/object';
import { computed, get, set } from '@ember/object';
import calculatePosition from 'shared/utils/calculate-position';
@ -19,19 +19,20 @@ export default Component.extend({
actions: {
clickedAction(actionName) {
this.get('resourceActions').triggerAction(actionName);
get(this, 'resourceActions').triggerAction(actionName);
set(get(this, 'tooltipService'), 'childOpened', false);
},
preload() {
this.get('resourceActions').setActionItems(this.get('model'), this.get('context'));
get(this, 'resourceActions').setActionItems(get(this, 'model'), get(this, 'context'));
},
actionsOpen() {
get(this, 'tooltipService').set('childOpened', true);
set(get(this, 'tooltipService'), 'childOpened', true);
},
actionsClosed() {
get(this, 'tooltipService').set('childOpened', false);
set(get(this, 'tooltipService'), 'childOpened', false);
get(this, 'tooltipService').hide();
},
@ -39,7 +40,7 @@ export default Component.extend({
},
sizeClass: computed('size', function() {
let size = this.get('size');
let size = get(this, 'size');
if ( size && size !== 'md' ) {
return `btn-${ size }`;
@ -56,13 +57,13 @@ export default Component.extend({
e.preventDefault();
e.stopPropagation();
if (this.get('inTooltip')) {
this.get('resourceActions').set('tooltipActions', true);
if (get(this, 'inTooltip')) {
set(get(this, 'resourceActions'), 'tooltipActions', true);
} else {
this.get('resourceActions').set('tooltipActions', false);
set(get(this, 'resourceActions'), 'tooltipActions', false);
}
this.get('resourceActions').setActionItems(this.get('model'), this.get('context'));
get(this, 'resourceActions').setActionItems(get(this, 'model'), get(this, 'context'));
}
},
});