mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
focus on first element in form when showing
This commit is contained in:
parent
7355a912b6
commit
f18172258e
2 changed files with 8 additions and 1 deletions
|
@ -120,7 +120,7 @@ block content
|
|||
div(ng-show="formVisable")
|
||||
form(enctype='multipart/form-data', method='post')
|
||||
.input
|
||||
input(type='text', name='first_name', ng-model="userInfoForm.first_name", ng-blur="sendUpdate()", placeholder="First Name")
|
||||
input(type='text', name='first_name', ng-model="userInfoForm.first_name", ng-blur="sendUpdate()", placeholder="First Name", focus-input="formVisable")
|
||||
.input
|
||||
input(type='text', name='last_name', ng-model="userInfoForm.last_name", ng-blur="sendUpdate()", placeholder='Last Name')
|
||||
.input#institution_auto_complete
|
||||
|
|
|
@ -5,6 +5,13 @@ define ["libs/algolia", "libs/angular", "libs/angular-autocomplete/angular-autoc
|
|||
app.factory "Institutions", ->
|
||||
new AlgoliaSearch("SK53GL4JLY", "75dc5e65794cd47eb7f725e6bb5075be").initIndex("institutions")
|
||||
|
||||
app.directive "focusInput", ($timeout) ->
|
||||
return (scope, element, attr) ->
|
||||
scope.$watch attr.focusInput, (value) ->
|
||||
if value
|
||||
$timeout ->
|
||||
element.select()
|
||||
|
||||
app.controller "UpdateForm", ($scope, $http, Institutions)->
|
||||
$scope.institutions = []
|
||||
$scope.formVisable = false
|
||||
|
|
Loading…
Reference in a new issue