Merge pull request #2878 from daemonsy/daemonsy_focus_topic_input

UX Improvement: Autofocus the topic field on edit
This commit is contained in:
Robin Ward 2014-10-16 15:56:35 -04:00
commit d439bd274e
2 changed files with 9 additions and 2 deletions

View file

@ -0,0 +1,7 @@
export default Ember.TextField.extend({
becomeFocused: function() {
var input = this.get("element");
input.focus();
input.selectionStart = input.selectionEnd = input.value.length;
}.on('didInsertElement')
});

View file

@ -17,9 +17,9 @@
{{#if editingTopic}}
{{#if isPrivateMessage}}
<span class="private-message-glyph">{{fa-icon envelope}}</span>
{{text-field id='edit-title' value=newTitle maxLength=maxTitleLength}}
{{autofocus-text-field id='edit-title' value=newTitle maxLength=maxTitleLength}}
{{else}}
{{text-field id='edit-title' value=newTitle maxLength=maxTitleLength}}
{{autofocus-text-field id='edit-title' value=newTitle maxLength=maxTitleLength}}
</br>
{{category-chooser valueAttribute="id" value=newCategoryId source=category_id}}
{{/if}}