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',
challenges: c,
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',[]);
profileValidation.controller('profileValidationController', ['$scope',
function($scope) {
$scope.twitterHandle = '@yournamehere';
$scope.user.name = req.user.name;
profileValidation.controller('profileValidationController', ['$scope', '$http',
function($scope, $http) {
$http.get('/account').success(function(data) {
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
h1 Update your profile here:
form.form-horizontal(action='/account/profile', method='POST')
//input(type='hidden', name='_csrf', value=_csrf)
//.form-group
// label.col-sm-3.col-sm-offset-2.control-label(for='name') Name
// .col-sm-4
// input.form-control(type='text', name='name', id='name', value='#{user.profile.name}')
input(type='hidden', name='_csrf', value=_csrf)
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='name') Name
.col-sm-4
input.form-control(type='text', name='name', id='name', value='#{user.profile.name}')
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='name') Name
.col-sm-4
@ -28,9 +28,9 @@ block content
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='email') Twitter Handle
.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
{{twitterHandle}}
{{user.twitterHandle}}
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='email') Github Profile Link
.col-sm-4