continue work on angular form

This commit is contained in:
Michael Q Larson
2015-01-05 20:09:23 -08:00
parent 7a47df4e74
commit be22449d25
3 changed files with 18 additions and 12 deletions

View File

@ -145,7 +145,8 @@ exports.getAccount = function(req, res) {
title: 'Manage your Free Code Camp Account', title: 'Manage your Free Code Camp Account',
challenges: c, challenges: c,
ch: req.user.challengesHash, ch: req.user.challengesHash,
moment: moment moment: moment,
user: req.user
}); });
}); });
}; };

View File

@ -43,9 +43,14 @@ $(document).ready(function() {
}); });
var profileValidation = angular.module('profileValidation',[]); var profileValidation = angular.module('profileValidation',[]);
profileValidation.controller('profileValidationController', ['$scope', profileValidation.controller('profileValidationController', ['$scope', '$http',
function($scope) { function($scope, $http) {
$scope.twitterHandle = '@yournamehere'; $http.get('/account').success(function(data) {
$scope.user.name = req.user.name; console.log('============');
console.log(data);
console.log('============');
$scope.user = data.user;
});
//$scope.user = user;
} }
]); ]);

View File

@ -4,11 +4,11 @@ block content
.container.text-center .container.text-center
h1 Update your profile here: h1 Update your profile here:
form.form-horizontal(action='/account/profile', method='POST') form.form-horizontal(action='/account/profile', method='POST')
//input(type='hidden', name='_csrf', value=_csrf) input(type='hidden', name='_csrf', value=_csrf)
//.form-group .form-group
// label.col-sm-3.col-sm-offset-2.control-label(for='name') Name label.col-sm-3.col-sm-offset-2.control-label(for='name') Name
// .col-sm-4 .col-sm-4
// input.form-control(type='text', name='name', id='name', value='#{user.profile.name}') input.form-control(type='text', name='name', id='name', value='#{user.profile.name}')
.form-group .form-group
label.col-sm-3.col-sm-offset-2.control-label(for='name') Name label.col-sm-3.col-sm-offset-2.control-label(for='name') Name
.col-sm-4 .col-sm-4
@ -28,9 +28,9 @@ block content
.form-group .form-group
label.col-sm-3.col-sm-offset-2.control-label(for='email') Twitter Handle label.col-sm-3.col-sm-offset-2.control-label(for='email') Twitter Handle
.col-sm-4 .col-sm-4
input.form-control(type='text', name='twitterHandle', id='twitterHandle', ng-model="twitterHandle" value='#{user.profile.twitterHandle}') input.form-control(type='text', name='twitterHandle', id='twitterHandle', ng-model="user.twitterHandle" value='#{user.profile.twitterHandle}')
span span
{{twitterHandle}} {{user.twitterHandle}}
.form-group .form-group
label.col-sm-3.col-sm-offset-2.control-label(for='email') Github Profile Link label.col-sm-3.col-sm-offset-2.control-label(for='email') Github Profile Link
.col-sm-4 .col-sm-4