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() {
|
focusIn: function() {
|
||||||
Em.run.later(() => { this.$().select(); });
|
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_id: null,
|
||||||
context: null,
|
context: null,
|
||||||
|
|
||||||
|
@computed('q')
|
||||||
|
hasAutofocus(q) {
|
||||||
|
return Em.isEmpty(q);
|
||||||
|
},
|
||||||
|
|
||||||
@computed('skip_context', 'context')
|
@computed('skip_context', 'context')
|
||||||
searchContextEnabled: {
|
searchContextEnabled: {
|
||||||
get(skip,context){
|
get(skip,context){
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="search row clearfix">
|
<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}}
|
{{d-button action="search" icon="search" class="btn-primary" disabled=isNotValidSearchTerm}}
|
||||||
{{#if canBulkSelect}}
|
{{#if canBulkSelect}}
|
||||||
{{#if model.posts}}
|
{{#if model.posts}}
|
||||||
|
|
Loading…
Reference in New Issue