Merge pull request #435 from yangshun/editor-modal-input-focus

Auto-focus on the modal's input field for creation of new entities in editor.
This commit is contained in:
Michael Schmatz 2014-02-27 09:21:09 -08:00
commit 5d2c430779

View file

@ -23,6 +23,7 @@ module.exports = class ThangTypeHomeView extends View
'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 +95,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()