Rely on core:focus-next/previous in sign in view

This commit is contained in:
Kevin Sawicki & Nathan Sobo
2013-05-16 15:01:23 -07:00
parent 001183245e
commit 83e6a4a57e
2 changed files with 4 additions and 14 deletions

View File

@@ -1,9 +1,7 @@
'.sign-in-view':
'esc': 'core:cancel'
'.sign-in-view input':
'tab': 'next-field'
'meta-enter': 'core:confirm'
'.sign-in-view button':
'tab': 'next-field'
'enter': 'core:confirm'
'meta-enter': 'core:confirm'

View File

@@ -13,32 +13,24 @@ class SignInView extends ScrollView
@h4 'Sign in to GitHub'
@p 'Your password will only be used to generate a token that will be stored in your keychain.'
@div class: 'form-inline', =>
@input outlet: 'username', type: 'text', placeholder: 'Username or Email'
@input outlet: 'password', type: 'password', placeholder: 'Password'
@button outlet: 'signIn', class: 'btn', disabled: 'disabled', 'Sign in'
@button outlet: 'cancel', class: 'btn', 'Cancel'
@input outlet: 'username', type: 'text', placeholder: 'Username or Email', tabindex: 1
@input outlet: 'password', type: 'password', placeholder: 'Password', tabindex: 2
@button outlet: 'signIn', class: 'btn', disabled: 'disabled', tabindex: 3, 'Sign in'
@button outlet: 'cancel', class: 'btn', tabindex: 4, 'Cancel'
@div outlet: 'alert', class: 'alert alert-error'
initialize: ->
rootView.command 'github:sign-in', => @attach()
@username.on 'next-field', => @password.focus()
@username.on 'core:confirm', => @generateOAuth2Token()
@username.on 'input', => @validate()
@password.on 'next-field', =>
if @isElementEnabled(@signIn)
@signIn.focus()
else
@cancel.focus()
@password.on 'core:confirm', => @generateOAuth2Token()
@password.on 'input', => @validate()
@signIn.on 'next-field', => @cancel.focus()
@signIn.on 'core:confirm', => @generateOAuth2Token()
@signIn.on 'click', => @generateOAuth2Token()
@cancel.on 'next-field', => @username.focus()
@cancel.on 'core:confirm', => @generateOAuth2Token()
@cancel.on 'click', => @detach()