diff --git a/services/web/app/views/project/list.jade b/services/web/app/views/project/list.jade index bc9a29b41b..e17e5a99a3 100644 --- a/services/web/app/views/project/list.jade +++ b/services/web/app/views/project/list.jade @@ -124,7 +124,13 @@ block content .input input(type='text', name='last_name', ng-model="userInfoForm.last_name", ng-blur="sendUpdate()", placeholder='Last Name') .input - input(type='text', name='institution', ng-model="userInfoForm.institution", placeholder='Institution', ng-blur="sendUpdate()") + input(type='text', name='institution', ng-model="userInfoForm.institution", placeholder='Institution', ng-blur="sendUpdate()", ng-keyup="updateInstitutionsList()", list="_institutions") + datalist#_institutions + option(ng-repeat='institution in institutions') {{institution.name}} + + + + .input input(type='text', name='role', ng-model="userInfoForm.role", placeholder='Role', ng-blur="sendUpdate()") .span3 diff --git a/services/web/public/coffee/UserDetailsUpdater.coffee b/services/web/public/coffee/UserDetailsUpdater.coffee index 2f40b8c1ec..efaf8cce92 100644 --- a/services/web/public/coffee/UserDetailsUpdater.coffee +++ b/services/web/public/coffee/UserDetailsUpdater.coffee @@ -1,9 +1,12 @@ -define ["libs/angular"], (a)-> +define ["libs/algolia", "libs/typeahead", "libs/angular"], (algolia)-> app = angular.module("userProfileInformationApp", []) - app.controller "UpdateForm", ($scope, $http)-> + app.factory "Institutions", -> + new AlgoliaSearch("SK53GL4JLY", "75dc5e65794cd47eb7f725e6bb5075be").initIndex("institutions") + app.controller "UpdateForm", ($scope, $http, Institutions)-> + $scope.institutions = $scope.hidePersonalInfoSection = true $http.get("/user/personal_info").success (data)-> @@ -30,5 +33,9 @@ define ["libs/angular"], (a)-> results = _.filter $scope.userInfoForm, (value)-> value? and value?.length != 0 results.length * 20 + $scope.updateInstitutionsList = -> + Institutions.search $scope.userInfoForm.institution, (err, response)-> + $scope.institutions = response.hits + angular.bootstrap(document.getElementById("userProfileInformation"), ['userProfileInformationApp'])