mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-14 23:45:30 +00:00
cleaned it up a touch, showed how to handle http errors
This commit is contained in:
parent
6dc1e54dc7
commit
c075716b0f
2 changed files with 16 additions and 18 deletions
|
@ -101,21 +101,20 @@ block content
|
|||
ul#projectList
|
||||
mixin projectList(projects)
|
||||
|
||||
#userProfileInformation(ng-app="userProfileInformationApp")
|
||||
.span3#userProfileInformation(ng-app="userProfileInformationApp")
|
||||
div(ng-controller="UpdateForm")
|
||||
div(ng-hide="hidePersonalInfoSection")
|
||||
div(ng-show="percentComplete == 100")
|
||||
div(ng-show="percentComplete >= 100")
|
||||
span Thanks!
|
||||
div(ng-hide="percentComplete == 100")
|
||||
.span3
|
||||
.span8
|
||||
.progress
|
||||
.bar.bar-success(ng-style="{'width' : (percentComplete+'%')}")
|
||||
span Account {{percentComplete}}% complete
|
||||
div(ng-hide="percentComplete >= 100")
|
||||
.span8
|
||||
.progress
|
||||
.bar.bar-success(ng-style="{'width' : (percentComplete+'%')}")
|
||||
span Account {{percentComplete}}% complete
|
||||
|
||||
button.btn(ng-hide="formVisable", ng-click="formVisable = true") Complete now
|
||||
button.btn(ng-hide="formVisable", ng-click="formVisable = true") Complete now
|
||||
|
||||
.span3(ng-show="formVisable")
|
||||
.span8(ng-show="formVisable")
|
||||
form(enctype='multipart/form-data', method='post')
|
||||
.input
|
||||
input(type='text', name='first_name', ng-model="userInfoForm.first_name", ng-blur="sendUpdate()")
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
|
||||
app = angular.module("userProfileInformationApp", [])
|
||||
|
||||
|
||||
|
||||
app.controller "UpdateForm", ($scope, $http)->
|
||||
|
||||
$scope.hidePersonalInfoSection = true
|
||||
|
@ -16,18 +14,19 @@ app.controller "UpdateForm", ($scope, $http)->
|
|||
_csrf : window.csrfToken
|
||||
|
||||
if getPercentComplete() != 100
|
||||
console.log "!!!!!!!"
|
||||
$scope.percentComplete = getPercentComplete()
|
||||
$scope.hidePersonalInfoSection = false
|
||||
|
||||
console.log $scope.percentComplete
|
||||
|
||||
|
||||
$scope.sendUpdate = ->
|
||||
$http.post "/user/personal_info", $scope.userInfoForm
|
||||
request = $http.post "/user/personal_info", $scope.userInfoForm
|
||||
request.success (data, status)->
|
||||
console.log "the post worked"
|
||||
request.error (data, status)->
|
||||
console.log "the request failed"
|
||||
$scope.percentComplete = getPercentComplete()
|
||||
|
||||
getPercentComplete = ->
|
||||
results = _.filter $scope.userInfoForm, (value)-> value? and value?.length != 0
|
||||
console.log results.length * 20
|
||||
results.length * 20
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue