Merge branch 'master-redesign' of github.com:sharelatex/web-sharelatex into master-redesign

This commit is contained in:
James Allen 2014-07-18 14:30:35 +01:00
commit 608fc8364b
3 changed files with 15 additions and 16 deletions

View file

@ -149,7 +149,6 @@ script(type="text/ng-template", id="userProfileModalTemplate")
type='text',
name='first_name',
ng-model="userInfoForm.first_name",
ng-blur="sendUpdate()",
placeholder="First Name",
select-when="formVisable"
)
@ -160,27 +159,29 @@ script(type="text/ng-template", id="userProfileModalTemplate")
type='text',
name='last_name',
ng-model="userInfoForm.last_name",
ng-blur="sendUpdate()",
placeholder='Last Name'
)
.form-group#institution_auto_complete
.form-group.user_details_auto_complete
label(for="institution") Institution
autocomplete(
ng-model="userInfoForm.institution",
name="institution",
data="institutions",
ng-blur="sendUpdate()",
on-type="updateInstitutionsList",
attr-placeholder="Institution",
attr-inputclass="form-control"
)
.form-group
.form-group.user_details_auto_complete
label(for="role") Role
input(type='text', name='role', ng-model="userInfoForm.role", placeholder='Role', ng-blur="sendUpdate()", list="_roles").form-control
datalist#_roles
option(ng-repeat='role in roles') {{role}}
autocomplete(
ng-model="userInfoForm.role",
name="role",
data="roles",
attr-placeholder="Role",
attr-inputclass="form-control"
)
.modal-footer

View file

@ -37,7 +37,10 @@ define [
App.controller "UserProfileModalController", ($scope, $modalInstance, $http, Institutions) ->
$scope.roles = ["Student", "Post-graduate student", "Post-doctoral researcher", "Lecturer", "Professor"]
$scope.sendUpdate = ->
$modalInstance.result.finally ->
sendUpdate()
sendUpdate = ->
request = $http.post "/user/settings", $scope.userInfoForm
request.success (data, status)->
request.error (data, status)->
@ -45,14 +48,9 @@ define [
$scope.updateInstitutionsList = (inputVal)->
# this is a little hack to use until we change auto compelete lib with redesign and can
# listen for blur events on institution field to send the post
if inputVal?.indexOf("(") != -1 and inputVal?.indexOf(")") != -1
$scope.sendUpdate()
query = $scope.userInfoForm.institution
if query?.length <= 3
return #saves us algolia searches, need ~4 chars to get uni anyway
return #saves us algolia searches
Institutions.search $scope.userInfoForm.institution, (err, response)->
$scope.institutions = _.map response.hits, (institution)->

View file

@ -153,7 +153,7 @@ ul.project-list {
}
}
#institution_auto_complete {
.user_details_auto_complete {
ul>li{
list-style:none;