mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
improved the angular stuff a touch
This commit is contained in:
parent
68cc7d85bf
commit
b9afde591b
1 changed files with 24 additions and 26 deletions
|
@ -1,36 +1,34 @@
|
||||||
define ["libs/angular"], (a)->
|
define ["libs/angular"], (a)->
|
||||||
|
|
||||||
angular.element(document).ready ->
|
app = angular.module("userProfileInformationApp", [])
|
||||||
|
|
||||||
app = angular.module("userProfileInformationApp", [])
|
app.controller "UpdateForm", ($scope, $http)->
|
||||||
|
|
||||||
app.controller "UpdateForm", ($scope, $http)->
|
$scope.hidePersonalInfoSection = true
|
||||||
|
|
||||||
$scope.hidePersonalInfoSection = true
|
$http.get("/user/personal_info").success (data)->
|
||||||
|
$scope.userInfoForm =
|
||||||
|
first_name: data.first_name
|
||||||
|
last_name: data.last_name
|
||||||
|
role: data.role
|
||||||
|
institution: data.institution
|
||||||
|
_csrf : window.csrfToken
|
||||||
|
|
||||||
$http.get("/user/personal_info").success (data)->
|
if getPercentComplete() != 100
|
||||||
$scope.userInfoForm =
|
|
||||||
first_name: data.first_name
|
|
||||||
last_name: data.last_name
|
|
||||||
role: data.role
|
|
||||||
institution: data.institution
|
|
||||||
_csrf : window.csrfToken
|
|
||||||
|
|
||||||
if getPercentComplete() != 100
|
|
||||||
$scope.percentComplete = getPercentComplete()
|
|
||||||
$scope.hidePersonalInfoSection = false
|
|
||||||
|
|
||||||
$scope.sendUpdate = ->
|
|
||||||
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()
|
$scope.percentComplete = getPercentComplete()
|
||||||
|
$scope.hidePersonalInfoSection = false
|
||||||
|
|
||||||
getPercentComplete = ->
|
$scope.sendUpdate = ->
|
||||||
results = _.filter $scope.userInfoForm, (value)-> value? and value?.length != 0
|
request = $http.post "/user/personal_info", $scope.userInfoForm
|
||||||
results.length * 20
|
request.success (data, status)->
|
||||||
|
console.log "the post worked"
|
||||||
|
request.error (data, status)->
|
||||||
|
console.log "the request failed"
|
||||||
|
$scope.percentComplete = getPercentComplete()
|
||||||
|
|
||||||
angular.bootstrap(document, ['userProfileInformationApp'])
|
getPercentComplete = ->
|
||||||
|
results = _.filter $scope.userInfoForm, (value)-> value? and value?.length != 0
|
||||||
|
results.length * 20
|
||||||
|
|
||||||
|
angular.bootstrap(document.getElementById("userProfileInformation"), ['userProfileInformationApp'])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue