UX: Autofocus when input is empty.
This commit is contained in:
parent
2ae0ef0ad9
commit
c1deee772b
|
@ -9,5 +9,9 @@ export default TextField.extend({
|
|||
|
||||
focusIn: function() {
|
||||
Em.run.later(() => { this.$().select(); });
|
||||
}
|
||||
},
|
||||
|
||||
becomeFocused: function() {
|
||||
if (this.get('hasAutofocus')) this.$().focus();
|
||||
}.on('didInsertElement')
|
||||
});
|
||||
|
|
|
@ -13,6 +13,11 @@ export default Ember.Controller.extend({
|
|||
context_id: null,
|
||||
context: null,
|
||||
|
||||
@computed('q')
|
||||
hasAutofocus(q) {
|
||||
return Em.isEmpty(q);
|
||||
},
|
||||
|
||||
@computed('skip_context', 'context')
|
||||
searchContextEnabled: {
|
||||
get(skip,context){
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<div class="search row clearfix">
|
||||
{{search-text-field value=searchTerm class="input-xxlarge search no-blur" action="search"}}
|
||||
{{search-text-field value=searchTerm class="input-xxlarge search no-blur" action="search" hasAutofocus=hasAutofocus}}
|
||||
{{d-button action="search" icon="search" class="btn-primary" disabled=isNotValidSearchTerm}}
|
||||
{{#if canBulkSelect}}
|
||||
{{#if model.posts}}
|
||||
|
|
Loading…
Reference in New Issue