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,7 +148,23 @@ 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(
|
||||
ng-disabled="affiliationsForm.$invalid || ui.isAddingNewEmail"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -8,7 +8,7 @@ define [
|
|||
|
||||
domainsBlackList = { "overleaf.com" : true }
|
||||
commonTLDs = [ "br", "cn", "co", "co.jp", "co.uk", "com", "com.au", "de","fr", "in", "info", "io", "net", "no", "ru", "se", "us", "com.tw", "com.br", "pl", "it", "co.in", "com.mx" ]
|
||||
commonDomains = [ "gmail", "googlemail", "icloud", "me", "yahoo", "ymail", "yahoomail", "hotmail", "live", "msn", "outlook", "gmx", "mail", "aol", "163", "mac", "qq", "o2", "libero", "126" ]
|
||||
commonDomains = [ "gmail", "googlemail", "icloud", "me", "yahoo", "ymail", "yahoomail", "hotmail", "live", "msn", "outlook", "gmx", "mail", "aol", "163", "mac", "qq", "o2", "libero", "126" ]
|
||||
|
||||
for domain in commonDomains
|
||||
for tld in commonTLDs
|
||||
|
|
Loading…
Reference in a new issue