mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
focus on first element in form when showing
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user