recomend roles and still show form when complete

This commit is contained in:
Henry Oswald 2014-06-16 16:14:58 +01:00
parent a1055b226c
commit 7355a912b6
4 changed files with 25 additions and 13 deletions

View file

@ -101,21 +101,21 @@ block content
ul#projectList ul#projectList
mixin projectList(projects) mixin projectList(projects)
.span3#userProfileInformation() .span3#userProfileInformation(ng-cloak)
div(ng-controller="UpdateForm").userProfileInformationArea div(ng-controller="UpdateForm").userProfileInformationArea
div(ng-hide="hidePersonalInfoSection").alert.alert-info div(ng-hide="hidePersonalInfoSection").alert.alert-info
div(ng-show="percentComplete >= 100") div(ng-show="percentComplete >= 100")
h4 100% complete, well done! h4 100% complete, well done!
div(ng-hide="percentComplete >= 100") div(ng-hide="percentComplete >= 100")
h4 Your account is h4 Your account is
strong {{percentComplete}}% strong {{percentComplete}}%
| complete | complete
.progress .progress
.bar.bar-success(ng-style="{'width' : (percentComplete+'%')}") .bar.bar-success(ng-style="{'width' : (percentComplete+'%')}")
button#completeUserProfileInformation.btn.btn-primary(ng-hide="formVisable", ng-click="formVisable = true") Complete now button#completeUserProfileInformation.btn.btn-primary(ng-hide="formVisable", ng-click="showForm()") Complete now
div(ng-show="formVisable") div(ng-show="formVisable")
form(enctype='multipart/form-data', method='post') form(enctype='multipart/form-data', method='post')
@ -124,9 +124,11 @@ block content
.input .input
input(type='text', name='last_name', ng-model="userInfoForm.last_name", ng-blur="sendUpdate()", placeholder='Last Name') input(type='text', name='last_name', ng-model="userInfoForm.last_name", ng-blur="sendUpdate()", placeholder='Last Name')
.input#institution_auto_complete .input#institution_auto_complete
autocomplete(ng-model="userInfoForm.institution", data="institutions", on-type="updateInstitutionsList", attr-placeholder="Institution") autocomplete(ng-model="userInfoForm.institution", data="institutions", ng-blur="sendUpdate()", on-type="updateInstitutionsList", attr-placeholder="Institution")
.input .input
input(type='text', name='role', ng-model="userInfoForm.role", placeholder='Role', ng-blur="sendUpdate()") input(type='text', name='role', ng-model="userInfoForm.role", placeholder='Role', ng-blur="sendUpdate()", list="_roles")
datalist#_roles
option(ng-repeat='role in roles') {{role}}
.span3 .span3
.tag-list .tag-list
h2 Tags h2 Tags

View file

@ -7,10 +7,12 @@ define ["libs/algolia", "libs/angular", "libs/angular-autocomplete/angular-autoc
app.controller "UpdateForm", ($scope, $http, Institutions)-> app.controller "UpdateForm", ($scope, $http, Institutions)->
$scope.institutions = [] $scope.institutions = []
$scope.formVisable = false
$scope.hidePersonalInfoSection = true $scope.hidePersonalInfoSection = true
$scope.roles = ["Student", "Post-graduate student", "Post-doctoral researcher", "Lecturer", "Proffessor"]
$http.get("/user/personal_info").success (data)-> $http.get("/user/personal_info").success (data)->
$scope.userInfoForm = $scope.userInfoForm =
first_name: data.first_name first_name: data.first_name
last_name: data.last_name last_name: data.last_name
role: data.role role: data.role
@ -21,10 +23,12 @@ define ["libs/algolia", "libs/angular", "libs/angular-autocomplete/angular-autoc
$scope.percentComplete = getPercentComplete() $scope.percentComplete = getPercentComplete()
$scope.hidePersonalInfoSection = false $scope.hidePersonalInfoSection = false
$scope.showForm = ->
$scope.formVisable = true
$scope.sendUpdate = -> $scope.sendUpdate = ->
request = $http.post "/user/personal_info", $scope.userInfoForm request = $http.post "/user/personal_info", $scope.userInfoForm
request.success (data, status)-> request.success (data, status)->
console.log "the post worked"
request.error (data, status)-> request.error (data, status)->
console.log "the request failed" console.log "the request failed"
$scope.percentComplete = getPercentComplete() $scope.percentComplete = getPercentComplete()
@ -37,5 +41,7 @@ define ["libs/algolia", "libs/angular", "libs/angular-autocomplete/angular-autoc
Institutions.search $scope.userInfoForm.institution, (err, response)-> Institutions.search $scope.userInfoForm.institution, (err, response)->
$scope.institutions = _.pluck response.hits, "name" $scope.institutions = _.pluck response.hits, "name"
angular.bootstrap(document.getElementById("userProfileInformation"), ['userProfileInformationApp']) angular.bootstrap(document.getElementById("userProfileInformation"), ['userProfileInformationApp'])

View file

@ -297,7 +297,7 @@ a.archived-projects {
} }
.autocomplete li.active{ .autocomplete li.active{
background-color: #BDE1F6; background-color: #b5d4fd;
} }
.autocomplete .highlight { .autocomplete .highlight {

View file

@ -80,3 +80,7 @@ input.large{
} }
} }
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
display: none !important;
}