Improved auto focus of login fields.

This commit is contained in:
Martin Edenhofer 2012-04-20 18:12:24 +02:00
parent 10c2ab62f7
commit b841834c3e

View file

@ -41,15 +41,25 @@ class Index extends App.Controller
@html App.view('login')(
item: data,
auth_providers: auth_providers
auth_providers: auth_providers,
)
if $(@el).find('[name="username"]').val()
# set focus
if !$(@el).find('[name="username"]').val()
$(@el).find('[name="username"]').focus()
else
$(@el).find('[name="password"]').focus()
# scroll to top
@scrollTo()
login: (e) ->
e.preventDefault()
params = @formParam(e.target)
# remember username
@username = params['username']
# session create with login/password
auth = new App.Auth
auth.login(