From 600ab5ad51a6b253900367092f3d4ae8f919e878 Mon Sep 17 00:00:00 2001 From: Sam Date: Wed, 26 Aug 2015 13:44:48 +1000 Subject: [PATCH] improve hamburger rendering fix test cases --- .../components/hamburger-menu.js.es6 | 9 +- .../templates/components/hamburger-menu.hbs | 127 +++++++++--------- .../stylesheets/common/base/hamburger.scss | 19 ++- 3 files changed, 89 insertions(+), 66 deletions(-) diff --git a/app/assets/javascripts/discourse/components/hamburger-menu.js.es6 b/app/assets/javascripts/discourse/components/hamburger-menu.js.es6 index 9dc957ed8c0..32e7d194a3f 100644 --- a/app/assets/javascripts/discourse/components/hamburger-menu.js.es6 +++ b/app/assets/javascripts/discourse/components/hamburger-menu.js.es6 @@ -7,14 +7,21 @@ export default Ember.Component.extend({ visibilityChanged: function(){ if(this.get("visible")) { $('html').on('click.close-humburger', (e) => { + + if (this.get('isDestroyed')) { + $('html').off('click.close-humburger'); + return true; + } + const $target = $(e.target); if ($target.closest('.dropdown.categories').length > 0) { return; } - console.log(e.toElement || e.relatedTarget || e.target); + this.set("visible", false); $('html').off('click.close-humburger'); return true; + }); } else { $('html').off('click.close-humburger'); diff --git a/app/assets/javascripts/discourse/templates/components/hamburger-menu.hbs b/app/assets/javascripts/discourse/templates/components/hamburger-menu.hbs index b85ffb0b92c..7cef85af937 100644 --- a/app/assets/javascripts/discourse/templates/components/hamburger-menu.hbs +++ b/app/assets/javascripts/discourse/templates/components/hamburger-menu.hbs @@ -2,77 +2,78 @@
{{fa-icon 'times'}}
-