mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
UX: Autofocus when input is empty.
This commit is contained in:
@@ -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}}
|
||||
|
||||
Reference in New Issue
Block a user