mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-29 20:11:32 +02: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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user