diff --git a/Gemfile.lock b/Gemfile.lock index a614c28a89b..b78e7471a5a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -328,9 +328,9 @@ GEM sass (3.2.19) sass-rails (4.0.5) railties (>= 4.0.0, < 5.0) - sass (~> 3.2.0) - sprockets (~> 2.8, <= 2.11.0) - sprockets-rails (~> 2.0.0) + sass (~> 3.2.2) + sprockets (~> 2.8, < 3.0) + sprockets-rails (~> 2.0) seed-fu (2.3.5) activerecord (>= 3.1, < 4.3) activesupport (>= 3.1, < 4.3) @@ -362,15 +362,15 @@ GEM spork-rails (4.0.0) rails (>= 3.0.0, < 5) spork (>= 1.0rc0) - sprockets (2.11.0) + sprockets (2.12.4) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.0.1) + sprockets-rails (2.3.3) actionpack (>= 3.0) activesupport (>= 3.0) - sprockets (~> 2.8) + sprockets (>= 2.8, < 4.0) stackprof (0.2.7) therubyracer (0.12.2) libv8 (~> 3.16.14.0) diff --git a/app/assets/javascripts/discourse/components/mobile-nav.js.es6 b/app/assets/javascripts/discourse/components/mobile-nav.js.es6 index 939e3010fa4..cee8a2111aa 100644 --- a/app/assets/javascripts/discourse/components/mobile-nav.js.es6 +++ b/app/assets/javascripts/discourse/components/mobile-nav.js.es6 @@ -1,6 +1,9 @@ +import { on, observes } from 'ember-addons/ember-computed-decorators'; + export default Ember.Component.extend({ - _init: function(){ + @on('init') + _init() { if (!this.get('site.mobileView')) { var classes = this.get('desktopClass'); if (classes) { @@ -8,16 +11,17 @@ export default Ember.Component.extend({ this.set('classNames', classes); } } - }.on('init'), + }, tagName: 'ul', classNames: ['mobile-nav'], - currentPathChanged: function(){ + @observes('currentPath') + currentPathChanged() { this.set('expanded', false); Em.run.next(() => this._updateSelectedHtml()); - }.observes('currentPath'), + }, _updateSelectedHtml(){ const active = this.$('.active'); @@ -26,10 +30,22 @@ export default Ember.Component.extend({ } }, - didInsertElement(){ + didInsertElement() { this._updateSelectedHtml(); }, + @on('didInsertElement') + _bindClick() { + this.$().on("click.mobile-nav", 'ul li', () => { + this.set('expanded', false); + }); + }, + + @on('willDestroyElement') + _unbindClick() { + this.$().off("click.mobile-nav", 'ul li'); + }, + actions: { toggleExpanded(){ this.toggleProperty('expanded'); diff --git a/app/assets/javascripts/discourse/controllers/header.js.es6 b/app/assets/javascripts/discourse/controllers/header.js.es6 index 07addf2c1c4..57401135df6 100644 --- a/app/assets/javascripts/discourse/controllers/header.js.es6 +++ b/app/assets/javascripts/discourse/controllers/header.js.es6 @@ -21,13 +21,7 @@ const HeaderController = Ember.Controller.extend({ actions: { toggleSearch() { - // there may be a cleaner way, but this is so trivial code wise - const $fullpageSearch = $('input.full-page-search'); - if ($fullpageSearch.length === 1) { - $fullpageSearch.focus().select(); - } else { - this.toggleProperty('searchVisible'); - } + this.toggleProperty('searchVisible'); }, showUserMenu() { if (!this.get('userMenuVisible')) {