UX: when on full page search header search should not pop open

fix `/` handling in full page search to highlight search term
This commit is contained in:
Sam 2015-09-18 12:20:59 +10:00
parent 7067d32c33
commit 086d31d53b
5 changed files with 18 additions and 3 deletions

View File

@ -22,7 +22,11 @@ export default Ember.Component.extend({
if (this.siteSettings.login_required && !this.currentUser) {
this.sendAction('loginAction');
} else {
this.toggleProperty('toggleVisible');
if (this.get('action')) {
this.sendAction('action');
} else {
this.toggleProperty('toggleVisible');
}
}
this.appEvents.trigger('dropdowns:closeAll');
}

View File

@ -20,6 +20,15 @@ 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');
}
},
showUserMenu() {
if (!this.get('userMenuVisible')) {
this.appEvents.trigger('dropdowns:closeAll');

View File

@ -177,7 +177,8 @@ export default {
},
showSearch() {
this.container.lookup('controller:header').send('toggleMenuPanel', 'searchVisible');
this.container.lookup('controller:header').send('toggleSearch');
return false;
},
toggleHamburgerMenu() {

View File

@ -1,5 +1,5 @@
<div class="search row clearfix">
{{search-text-field value=searchTerm class="input-xxlarge search no-blur" action="search" hasAutofocus=hasAutofocus}}
{{search-text-field value=searchTerm class="full-page-search input-xxlarge search no-blur" action="search" hasAutofocus=hasAutofocus}}
{{d-button action="search" icon="search" class="btn-primary" disabled=searchButtonDisabled}}
{{#if canBulkSelect}}
{{#if model.posts}}

View File

@ -17,6 +17,7 @@
{{#header-dropdown iconId="search-button"
icon="search"
action="toggleSearch"
toggleVisible=searchVisible
mobileAction="fullPageSearch"
loginAction="showLogin"