Fix auto-focus username for login form
This commit is contained in:
parent
f71eadd409
commit
15fb7f45b8
|
@ -57,5 +57,15 @@
|
|||
</div>
|
||||
</%def>
|
||||
|
||||
<%def name="modify_this_page_vars()">
|
||||
<script type="text/javascript">
|
||||
|
||||
TailboneForm.mounted = function() {
|
||||
this.$refs.username.focus()
|
||||
}
|
||||
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
|
||||
${parent.body()}
|
||||
|
|
|
@ -122,6 +122,10 @@ class AuthenticationView(View):
|
|||
'tailbone', 'main_image_url',
|
||||
default=self.request.static_url('tailbone:static/img/home_logo.png'))
|
||||
|
||||
# nb. hacky..but necessary, to add the ref, for autofocus
|
||||
dform = form.make_deform_form()
|
||||
dform['username'].widget.attributes = {'ref': 'username'}
|
||||
|
||||
return {
|
||||
'form': form,
|
||||
'referrer': referrer,
|
||||
|
|
Loading…
Reference in a new issue