FIX: Could sometimes open two category drop downs at once.
This commit is contained in:
parent
45ad31c1c8
commit
1e5195e68f
|
@ -51,6 +51,10 @@ export default Ember.Component.extend({
|
||||||
}
|
}
|
||||||
}.property('category'),
|
}.property('category'),
|
||||||
|
|
||||||
|
clickEventName: function() {
|
||||||
|
return "click.category-drop-" + (this.get('category.id') || "all");
|
||||||
|
}.property('category.id'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
expand: function() {
|
expand: function() {
|
||||||
if (this.get('expanded')) {
|
if (this.get('expanded')) {
|
||||||
|
@ -68,7 +72,7 @@ export default Ember.Component.extend({
|
||||||
self.close();
|
self.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('html').on('click.category-drop', function(e) {
|
$('html').on(this.get('clickEventName'), function(e) {
|
||||||
var $target = $(e.target),
|
var $target = $(e.target),
|
||||||
closest = $target.closest($dropdown);
|
closest = $target.closest($dropdown);
|
||||||
|
|
||||||
|
@ -78,13 +82,13 @@ export default Ember.Component.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
close: function() {
|
close: function() {
|
||||||
$('html').off('click.category-drop');
|
$('html').off(this.get('clickEventName'));
|
||||||
this.$('a[data-drop-close]').off('click.category-drop');
|
this.$('a[data-drop-close]').off('click.category-drop');
|
||||||
this.set('expanded', false);
|
this.set('expanded', false);
|
||||||
},
|
},
|
||||||
|
|
||||||
willDestroyElement: function() {
|
willDestroyElement: function() {
|
||||||
$('html').off('click.category-drop');
|
$('html').off(this.get('clickEventName'));
|
||||||
this.$('a[data-drop-close]').off('click.category-drop');
|
this.$('a[data-drop-close]').off('click.category-drop');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue