mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 11:32:40 +00:00
Merge pull request #877 from sharelatex/pr-fill-university-model-as-you-type
Update university, role and department value as the user types.
This commit is contained in:
commit
59b137e303
2 changed files with 18 additions and 0 deletions
|
@ -202,6 +202,8 @@ script(type="text/ng-template", id="affiliationFormTpl")
|
|||
) {{ $select.selected.name }}
|
||||
ui-select-choices(
|
||||
repeat="university in $ctrl.universities | filter: $select.search"
|
||||
refresh="$ctrl.handleFreeformInputChange($select, 'name');"
|
||||
refresh-delay="10"
|
||||
)
|
||||
span(
|
||||
ng-bind="university.name"
|
||||
|
@ -219,6 +221,8 @@ script(type="text/ng-template", id="affiliationFormTpl")
|
|||
) {{ $select.selected }}
|
||||
ui-select-choices(
|
||||
repeat="role in $ctrl.roles | filter: $select.search"
|
||||
refresh="$ctrl.handleFreeformInputChange($select);"
|
||||
refresh-delay="10"
|
||||
)
|
||||
span(
|
||||
ng-bind="role"
|
||||
|
@ -237,6 +241,8 @@ script(type="text/ng-template", id="affiliationFormTpl")
|
|||
) {{ $select.selected }}
|
||||
ui-select-choices(
|
||||
repeat="department in $ctrl.departments | filter: $select.search"
|
||||
refresh="$ctrl.handleFreeformInputChange($select);"
|
||||
refresh-delay="10"
|
||||
)
|
||||
span(
|
||||
ng-bind="department"
|
||||
|
|
|
@ -11,6 +11,18 @@ define [
|
|||
|
||||
ctrl.addUniversityToSelection = (universityName) ->
|
||||
{ name: universityName, isUserSuggested: true }
|
||||
ctrl.handleFreeformInputChange = ($select, propertyToMatch) ->
|
||||
if !$select.search? or $select.search == ""
|
||||
return
|
||||
resultingItem = $select.search
|
||||
if $select.tagging?.fct?
|
||||
resultingItem = $select.tagging.fct $select.search
|
||||
if propertyToMatch?
|
||||
matchingItem = _.find $select.items, (item) -> item[propertyToMatch] == $select.search
|
||||
if matchingItem?
|
||||
resultingItem = matchingItem
|
||||
$select.searchInput.scope().$broadcast "uis:select", resultingItem
|
||||
|
||||
# Populates the countries dropdown
|
||||
UserAffiliationsDataService
|
||||
.getCountries()
|
||||
|
|
Loading…
Reference in a new issue