Auto-focus on the modal's input field for creation of new entities in editor. Fixes issue #379

This commit is contained in:
Tay Yang Shun 2014-02-27 15:32:18 +08:00
parent 74186b7772
commit 947b8766c2

View file

@ -22,7 +22,7 @@ module.exports = class ThangTypeHomeView extends View
'change input#search': 'runSearch'
'keydown input#search': 'runSearch'
'click button.new-model-submit': 'makeNewModel'
'submit form': 'makeNewModel'
'shown.bs.modal #new-model-modal': 'focusOnName'
getRenderData: ->
c = super()
@ -94,3 +94,6 @@ module.exports = class ThangTypeHomeView extends View
modal.modal('hide')
base = document.location.pathname[1..] + '/'
app.router.navigate(base + (model.get('slug') or model.id), {trigger:true})
focusOnName: ->
@$el.find('#name').focus()