mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05: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 }}
|
) {{ $select.selected.name }}
|
||||||
ui-select-choices(
|
ui-select-choices(
|
||||||
repeat="university in $ctrl.universities | filter: $select.search"
|
repeat="university in $ctrl.universities | filter: $select.search"
|
||||||
|
refresh="$ctrl.handleFreeformInputChange($select, 'name');"
|
||||||
|
refresh-delay="10"
|
||||||
)
|
)
|
||||||
span(
|
span(
|
||||||
ng-bind="university.name"
|
ng-bind="university.name"
|
||||||
|
@ -219,6 +221,8 @@ script(type="text/ng-template", id="affiliationFormTpl")
|
||||||
) {{ $select.selected }}
|
) {{ $select.selected }}
|
||||||
ui-select-choices(
|
ui-select-choices(
|
||||||
repeat="role in $ctrl.roles | filter: $select.search"
|
repeat="role in $ctrl.roles | filter: $select.search"
|
||||||
|
refresh="$ctrl.handleFreeformInputChange($select);"
|
||||||
|
refresh-delay="10"
|
||||||
)
|
)
|
||||||
span(
|
span(
|
||||||
ng-bind="role"
|
ng-bind="role"
|
||||||
|
@ -237,6 +241,8 @@ script(type="text/ng-template", id="affiliationFormTpl")
|
||||||
) {{ $select.selected }}
|
) {{ $select.selected }}
|
||||||
ui-select-choices(
|
ui-select-choices(
|
||||||
repeat="department in $ctrl.departments | filter: $select.search"
|
repeat="department in $ctrl.departments | filter: $select.search"
|
||||||
|
refresh="$ctrl.handleFreeformInputChange($select);"
|
||||||
|
refresh-delay="10"
|
||||||
)
|
)
|
||||||
span(
|
span(
|
||||||
ng-bind="department"
|
ng-bind="department"
|
||||||
|
|
|
@ -11,6 +11,18 @@ define [
|
||||||
|
|
||||||
ctrl.addUniversityToSelection = (universityName) ->
|
ctrl.addUniversityToSelection = (universityName) ->
|
||||||
{ name: universityName, isUserSuggested: true }
|
{ 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
|
# Populates the countries dropdown
|
||||||
UserAffiliationsDataService
|
UserAffiliationsDataService
|
||||||
.getCountries()
|
.getCountries()
|
||||||
|
|
Loading…
Reference in a new issue