UX: Select search term when focus returns to search box.

This commit is contained in:
Guo Xiang Tan 2015-09-12 14:06:46 +08:00
parent b4974f5876
commit 2ae0ef0ad9
3 changed files with 6 additions and 2 deletions

View File

@ -134,7 +134,7 @@ export default Ember.Component.extend({
}, },
showedSearch() { showedSearch() {
$('#search-term').focus(); $('#search-term').focus().select();
}, },
showSearchHelp() { showSearchHelp() {

View File

@ -5,5 +5,9 @@ export default TextField.extend({
@computed('searchService.searchContextEnabled') @computed('searchService.searchContextEnabled')
placeholder: function(searchContextEnabled) { placeholder: function(searchContextEnabled) {
return searchContextEnabled ? "" : I18n.t('search.title'); return searchContextEnabled ? "" : I18n.t('search.title');
},
focusIn: function() {
Em.run.later(() => { this.$().select(); });
} }
}); });

View File

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