mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Use university-provided list of departments when available.
This commit is contained in:
parent
62ab9dbb98
commit
9bc70d479c
3 changed files with 23 additions and 2 deletions
|
@ -148,6 +148,22 @@ block content
|
|||
id="affiliations-department"
|
||||
placeholder="Department"
|
||||
ng-model="newAffiliation.department"
|
||||
ng-if="!newAffiliation.university.departments || newAffiliation.university.departments.length === 0"
|
||||
)
|
||||
ui-select(
|
||||
ng-model="newAffiliation.department"
|
||||
ng-if="newAffiliation.university.departments.length > 0"
|
||||
tagging
|
||||
tagging-label="false"
|
||||
)
|
||||
ui-select-match(
|
||||
placeholder="Department"
|
||||
) {{ $select.selected }}
|
||||
ui-select-choices(
|
||||
repeat="department in getUniqueUniversityDepartments() | filter: $select.search"
|
||||
)
|
||||
span(
|
||||
ng-bind="department"
|
||||
)
|
||||
td
|
||||
button.btn.btn-primary(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
define [
|
||||
"base"
|
||||
], (App) ->
|
||||
App.controller "UserAffiliationsController", ["$scope", "UserAffiliationsDataService", "$q", ($scope, UserAffiliationsDataService, $q) ->
|
||||
App.controller "UserAffiliationsController", ["$scope", "UserAffiliationsDataService", "$q", "_", ($scope, UserAffiliationsDataService, $q, _) ->
|
||||
$scope.userEmails = []
|
||||
$scope.countries = []
|
||||
$scope.universities = []
|
||||
|
@ -94,6 +94,9 @@ define [
|
|||
.removeUserEmail email
|
||||
.then () -> _getUserEmails()
|
||||
|
||||
$scope.getUniqueUniversityDepartments = () ->
|
||||
_.uniq $scope.newAffiliation.university.departments
|
||||
|
||||
_reset = () ->
|
||||
$scope.newAffiliation =
|
||||
email: ""
|
||||
|
@ -129,6 +132,8 @@ define [
|
|||
$scope.$watch "newAffiliation.country", (newSelectedCountry, prevSelectedCountry) ->
|
||||
if newSelectedCountry? and newSelectedCountry != prevSelectedCountry
|
||||
$scope.newAffiliation.university = null
|
||||
$scope.newAffiliation.role = null
|
||||
$scope.newAffiliation.department = null
|
||||
UserAffiliationsDataService
|
||||
.getUniversitiesFromCountry(newSelectedCountry)
|
||||
.then (universities) -> $scope.universities = universities
|
||||
|
|
Loading…
Reference in a new issue