From 2958b4b0a1c300d9c03ae2f7bcec3d52098ae7ff Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 17 Sep 2015 01:21:00 +0800 Subject: [PATCH] FIX: Don't dismiss dropdown when searching within posts context. --- .../discourse/components/menu-panel.js.es6 | 3 ++- .../discourse/lib/click-event.js.es6 | 3 --- .../components/search-result-post.hbs | 20 ++++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) delete mode 100644 app/assets/javascripts/discourse/lib/click-event.js.es6 diff --git a/app/assets/javascripts/discourse/components/menu-panel.js.es6 b/app/assets/javascripts/discourse/components/menu-panel.js.es6 index e2403356152..604ec69d39d 100644 --- a/app/assets/javascripts/discourse/components/menu-panel.js.es6 +++ b/app/assets/javascripts/discourse/components/menu-panel.js.es6 @@ -156,7 +156,8 @@ export default Ember.Component.extend({ _bindEvents() { this.$().on('click.discourse-menu-panel', 'a', e => { if (e.metaKey || e.ctrlKey || e.shiftKey) { return; } - if ($(e.target).data('ember-action')) { return; } + const $target = $(e.target); + if ($target.data('ember-action') || $target.closest('.search-link').length > 0) { return; } this.hide(); }); diff --git a/app/assets/javascripts/discourse/lib/click-event.js.es6 b/app/assets/javascripts/discourse/lib/click-event.js.es6 deleted file mode 100644 index 2ca000d20d3..00000000000 --- a/app/assets/javascripts/discourse/lib/click-event.js.es6 +++ /dev/null @@ -1,3 +0,0 @@ -export function isModifierOrMetaKey(event) { - return e.metaKey || e.ctrlKey || e.shiftKey; -} diff --git a/app/assets/javascripts/discourse/templates/components/search-result-post.hbs b/app/assets/javascripts/discourse/templates/components/search-result-post.hbs index 71b188ddf10..f89090ac24f 100644 --- a/app/assets/javascripts/discourse/templates/components/search-result-post.hbs +++ b/app/assets/javascripts/discourse/templates/components/search-result-post.hbs @@ -1,12 +1,14 @@ {{#each results as |result|}} - - - {{i18n 'search.post_format' post_number=result.post_number username=result.username}} - - {{#unless site.mobileView}} - - {{{unbound result.blurb}}} +
  • + + + {{i18n 'search.post_format' post_number=result.post_number username=result.username}} - {{/unless}} - + {{#unless site.mobileView}} + + {{{unbound result.blurb}}} + + {{/unless}} + +
  • {{/each}}