further progress on the form and add angular inline
parent
db9622a2e5
commit
41abdae46f
17
app.js
17
app.js
|
@ -108,17 +108,18 @@ var trusted = [
|
|||
"'self'",
|
||||
'*.freecodecamp.com',
|
||||
'*.gstatic.com',
|
||||
"*.google-analytics.com",
|
||||
"*.googleapis.com",
|
||||
"*.google.com",
|
||||
"*.gstatic.com",
|
||||
"*.doubleclick.net",
|
||||
"*.twitter.com",
|
||||
'*.google-analytics.com',
|
||||
'*.googleapis.com',
|
||||
'*.google.com',
|
||||
'*.gstatic.com',
|
||||
'*.doubleclick.net',
|
||||
'*.twitter.com',
|
||||
'*.twimg.com',
|
||||
"'unsafe-eval'",
|
||||
"'unsafe-inline'",
|
||||
"*.rafflecopter.com",
|
||||
"localhost:3001"
|
||||
'*.rafflecopter.com',
|
||||
'*.cloudflare.com',
|
||||
'localhost:3001'
|
||||
];
|
||||
|
||||
debug(trusted);
|
||||
|
|
|
@ -169,6 +169,8 @@ exports.returnUser = function(req, res, next) {
|
|||
coderbyteProfile: user.profile.linkedinProfile,
|
||||
githubProfile: user.profile.githubProfile,
|
||||
linkedinProfile: user.profile.linkedinProfile,
|
||||
codepenProfile: user.codepenProfile,
|
||||
twitterHandle: user.twitterHandle,
|
||||
website1: user.portfolio.website1Link,
|
||||
website1Title: user.portfolio.website1Title,
|
||||
website1Image: user.portfolio.website1Image,
|
||||
|
@ -229,6 +231,7 @@ exports.postUpdateProfile = function(req, res, next) {
|
|||
req.assert('email', 'Please enter a valid email address.').isEmail();
|
||||
req.assert('username', 'Your username cannot be longer than 20 characters').len(1, 20);
|
||||
req.assert('username', 'Your username can only use letters, numbers or underscores').matchRegex(/^[A-z0-9_]+$/);
|
||||
req.assert('githubProfile', 'Please enter a valid URL (www.example.com)').matchRegex(/^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/);
|
||||
var errors = req.validationErrors();
|
||||
if (errors) {
|
||||
req.flash('errors', errors);
|
||||
|
@ -262,7 +265,11 @@ exports.postUpdateProfile = function(req, res, next) {
|
|||
user.profile.name = req.body.name || '';
|
||||
user.profile.username = req.body.username || '';
|
||||
user.profile.location = req.body.location || '';
|
||||
user.profile.website = req.body.website || '';
|
||||
user.profile.githubProfile = req.body.githubProfile || '';
|
||||
user.profile.coderbyteProfile = req.body.coderbyteProfile || '';
|
||||
user.profile.linkedinProfile = req.body.linkedinProfile || '';
|
||||
user.profile.codepenProfile = req.body.codepenProfile || '';
|
||||
user.profile.twitterHandle = req.body.twitterHandle || '';
|
||||
user.portfolio.website1Title = req.body.website1Title || '';
|
||||
user.portfolio.website1Link = req.body.website1Link || '';
|
||||
user.portfolio.website1Image = req.body.website1Image || '';
|
||||
|
|
|
@ -293,6 +293,14 @@ var userSchema = new mongoose.Schema({
|
|||
coderbyteProfile: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
codepenProfile: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
twitterHandle: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
portfolio: {
|
||||
|
|
|
@ -1,7 +1,15 @@
|
|||
extends ../layout
|
||||
script.
|
||||
var freecodecamp = angular.module('freecodecamp',[]);
|
||||
freecodecamp.controller('freecodecampController', ['$scope',
|
||||
function($scope) {
|
||||
$scope.twitterHandle = '@yournamehere'
|
||||
}
|
||||
]);
|
||||
|
||||
|
||||
block content
|
||||
.panel
|
||||
.panel(ng-controller="freecodecampController")
|
||||
.container.text-center
|
||||
h1 Update your profile here:
|
||||
form.form-horizontal(action='/account/profile', method='POST')
|
||||
|
@ -22,9 +30,28 @@ block content
|
|||
label.col-sm-3.col-sm-offset-2.control-label(for='location') Location
|
||||
.col-sm-4
|
||||
input.form-control(type='text', name='location', id='location', value='#{user.profile.location}')
|
||||
|
||||
|
||||
|
||||
.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}')
|
||||
span
|
||||
{{twitterHandle}}
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='email') Github Profile Link
|
||||
.col-sm-4
|
||||
input.form-control(type='text', name='githubProfile', id='githubProfile', value='#{user.profile.githubProfile}')
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='email') CodePen Profile Link
|
||||
.col-sm-4
|
||||
input.form-control(type='text', name='codepenProfile', id='codepenProfile', value='#{user.profile.codepenProfile}')
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='email') CoderByte Profile Link
|
||||
.col-sm-4
|
||||
input.form-control(type='text', name='coderbyteProfile', id='coderbyteProfile', value='#{user.profile.coderbyteProfile}')
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='email') LinkedIn Profile Link
|
||||
.col-sm-4
|
||||
input.form-control(type='text', name='linkedinProfile', id='linkedinProfile', value='#{user.profile.linkedinProfile}')
|
||||
.form-group
|
||||
label.col-sm-3.col-sm-offset-2.control-label(for='website1Title') 1st Portfolio Website Title
|
||||
.col-sm-4
|
||||
|
@ -153,3 +180,4 @@ block content
|
|||
button.btn.btn-danger.btn-block(type='submit')
|
||||
span.ion-trash-b
|
||||
| Yes, Delete my account
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
doctype html
|
||||
html
|
||||
html(ng-app='freecodecamp')
|
||||
head
|
||||
script(src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js")
|
||||
script(src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js")
|
||||
script(src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.8/angular.min.js")
|
||||
link(rel='shortcut icon', href='https://s3.amazonaws.com/freecodecamp/favicon.ico')
|
||||
include partials/meta
|
||||
title #{title} | Free Code Camp
|
||||
|
|
Loading…
Reference in New Issue