update profile edit view
This commit is contained in:
@@ -243,12 +243,6 @@ exports.updateProgress = function(req, res) {
|
|||||||
exports.postUpdateProfile = function(req, res, next) {
|
exports.postUpdateProfile = function(req, res, next) {
|
||||||
User.findById(req.user.id, function(err, user) {
|
User.findById(req.user.id, function(err, user) {
|
||||||
if (err) return next(err);
|
if (err) return next(err);
|
||||||
|
|
||||||
req.assert('email', 'Email is required').notEmpty();
|
|
||||||
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();
|
var errors = req.validationErrors();
|
||||||
if (errors) {
|
if (errors) {
|
||||||
req.flash('errors', errors);
|
req.flash('errors', errors);
|
||||||
|
@@ -392,3 +392,7 @@ thead {
|
|||||||
.ng-valid.ng-dirty {
|
.ng-valid.ng-dirty {
|
||||||
border-color: #78FA89;
|
border-color: #78FA89;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.twitter-input {
|
||||||
|
|
||||||
|
}
|
@@ -6,10 +6,12 @@ block content
|
|||||||
h1 Update your profile here:
|
h1 Update your profile here:
|
||||||
form.form-horizontal(action='/account/profile', method='POST', novalidate='novalidate', name='profileForm')
|
form.form-horizontal(action='/account/profile', method='POST', novalidate='novalidate', name='profileForm')
|
||||||
input(type='hidden', name='_csrf', value=_csrf)
|
input(type='hidden', name='_csrf', value=_csrf)
|
||||||
|
.col-sm-4.col-sm-offset-5
|
||||||
|
h2 Bio
|
||||||
.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', placeholder='Name', name='name', ng-model='user.profile.name', ng-minlength='3', ng-maxlength='20', required='required', ng-focus='ng-focus', id='name')
|
input.form-control(type='text', placeholder='Name', name='name', ng-model='user.profile.name', ng-minlength='3', ng-maxlength='50', required='required', ng-focus='ng-focus', id='name')
|
||||||
.col-sm-4.col-sm-offset-5(ng-show="profileForm.name.$invalid && !profileForm.name.$pristine && profileForm.name.$error.required")
|
.col-sm-4.col-sm-offset-5(ng-show="profileForm.name.$invalid && !profileForm.name.$pristine && profileForm.name.$error.required")
|
||||||
alert(type='danger')
|
alert(type='danger')
|
||||||
span.ion-close-circled
|
span.ion-close-circled
|
||||||
@@ -23,7 +25,7 @@ block content
|
|||||||
span.ion-close-circled
|
span.ion-close-circled
|
||||||
| Your name must be under 20 characters.
|
| Your name must be under 20 characters.
|
||||||
.form-group
|
.form-group
|
||||||
label.col-sm-3.col-sm-offset-2.control-label(for='username') Username (use letters, numbers, underscore) *
|
label.col-sm-3.col-sm-offset-2.control-label(for='username') Username (path to public profile) *
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
input.form-control(type='text', placeholder='username' name='username', id='username', ng-model='user.profile.username', required='required', ng-minlength='5', ng-maxlength='20')
|
input.form-control(type='text', placeholder='username' name='username', id='username', ng-model='user.profile.username', required='required', ng-minlength='5', ng-maxlength='20')
|
||||||
.col-sm-4.col-sm-offset-5(ng-show="profileForm.username.$error.required && !profileForm.username.$pristine")
|
.col-sm-4.col-sm-offset-5(ng-show="profileForm.username.$error.required && !profileForm.username.$pristine")
|
||||||
@@ -54,9 +56,18 @@ block content
|
|||||||
label.col-sm-3.col-sm-offset-2.control-label(for='location') Location
|
label.col-sm-3.col-sm-offset-2.control-label(for='location') Location
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
input.form-control(type='text', name='location', id='location', ng-model='user.profile.location')
|
input.form-control(type='text', name='location', id='location', ng-model='user.profile.location')
|
||||||
|
.form-group
|
||||||
|
.col-sm-offset-5.col-sm-4
|
||||||
|
button.btn.btn-primary.btn-block(type='submit', ng-disabled='profileForm.$invalid')
|
||||||
|
span.ion-edit
|
||||||
|
| Update my Bio
|
||||||
|
.col-sm-4.col-sm-offset-5
|
||||||
|
h2 Social
|
||||||
.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-group.twitter-input
|
||||||
|
span.input-group-addon @
|
||||||
input.form-control(type='text', name='twitterHandle', id='twitterHandle', ng-model='user.profile.twitterHandle')
|
input.form-control(type='text', name='twitterHandle', id='twitterHandle', ng-model='user.profile.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
|
||||||
@@ -90,6 +101,13 @@ block content
|
|||||||
alert(type='danger')
|
alert(type='danger')
|
||||||
span.ion-close-circled
|
span.ion-close-circled
|
||||||
| Please enter a valid URL format (http://www.example.com).
|
| Please enter a valid URL format (http://www.example.com).
|
||||||
|
.form-group
|
||||||
|
.col-sm-offset-5.col-sm-4
|
||||||
|
button.btn.btn-primary.btn-block(type='submit', ng-disabled='profileForm.$invalid')
|
||||||
|
span.ion-edit
|
||||||
|
| Update my Social Links
|
||||||
|
.col-sm-4.col-sm-offset-5
|
||||||
|
h2 Portfolio
|
||||||
.form-group
|
.form-group
|
||||||
label.col-sm-3.col-sm-offset-2.control-label(for='website1Title') 1st Portfolio Website Title
|
label.col-sm-3.col-sm-offset-2.control-label(for='website1Title') 1st Portfolio Website Title
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
@@ -97,11 +115,11 @@ block content
|
|||||||
.form-group
|
.form-group
|
||||||
label.col-sm-3.col-sm-offset-2.control-label(for='website1Link') 1st Portfolio Website Link
|
label.col-sm-3.col-sm-offset-2.control-label(for='website1Link') 1st Portfolio Website Link
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
input.form-control(type='text', name='website1Link', id='website1Link', ng-model='user.profile.website1Link')
|
input.form-control(type='text', name='website1Link', id='website1Link', ng-model='user.profile.website1Link', placeholder='http://')
|
||||||
.form-group
|
.form-group
|
||||||
label.col-sm-3.col-sm-offset-2.control-label(for='website1Image') 1st Portfolio Website Image Link
|
label.col-sm-3.col-sm-offset-2.control-label(for='website1Image') 1st Portfolio Website Image Link
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
input.form-control(type='text', name='website1Image', id='website1Image', ng-model='website1Image')
|
input.form-control(type='text', name='website1Image', id='website1Image', ng-model='website1Image', placeholder='http://')
|
||||||
.form-group
|
.form-group
|
||||||
label.col-sm-3.col-sm-offset-2.control-label(for='website2Title') 2nd Portfolio Website Title
|
label.col-sm-3.col-sm-offset-2.control-label(for='website2Title') 2nd Portfolio Website Title
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
@@ -109,11 +127,11 @@ block content
|
|||||||
.form-group
|
.form-group
|
||||||
label.col-sm-3.col-sm-offset-2.control-label(for='website2Link') 2nd Portfolio Website Link
|
label.col-sm-3.col-sm-offset-2.control-label(for='website2Link') 2nd Portfolio Website Link
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
input.form-control(type='text', name='website2Link', id='website2Link', ng-model='user.profile.website2Link')
|
input.form-control(type='text', name='website2Link', id='website2Link', ng-model='user.profile.website2Link', placeholder='http://')
|
||||||
.form-group
|
.form-group
|
||||||
label.col-sm-3.col-sm-offset-2.control-label(for='website2Image') 2nd Portfolio Website Image Link
|
label.col-sm-3.col-sm-offset-2.control-label(for='website2Image') 2nd Portfolio Website Image Link
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
input.form-control(type='text', name='website2Image', id='website2Image', ng-model='user.profile.website2Image')
|
input.form-control(type='text', name='website2Image', id='website2Image', ng-model='user.profile.website2Image', placeholder='http://')
|
||||||
.form-group
|
.form-group
|
||||||
label.col-sm-3.col-sm-offset-2.control-label(for='website3Title') 3rd Portfolio Website Title
|
label.col-sm-3.col-sm-offset-2.control-label(for='website3Title') 3rd Portfolio Website Title
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
@@ -121,16 +139,17 @@ block content
|
|||||||
.form-group
|
.form-group
|
||||||
label.col-sm-3.col-sm-offset-2.control-label(for='website3Link') 3rd Portfolio Website Link
|
label.col-sm-3.col-sm-offset-2.control-label(for='website3Link') 3rd Portfolio Website Link
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
input.form-control(type='text', name='website3Link', id='website3Link', ng-model='user.profile.website3Link')
|
input.form-control(type='text', name='website3Link', id='website3Link', ng-model='user.profile.website3Link', placeholder='http://')
|
||||||
.form-group
|
.form-group
|
||||||
label.col-sm-3.col-sm-offset-2.control-label(for='website3Image') 3rd Portfolio Website Image Link
|
label.col-sm-3.col-sm-offset-2.control-label(for='website3Image') 3rd Portfolio Website Image Link
|
||||||
.col-sm-4
|
.col-sm-4
|
||||||
input.form-control(type='text', name='website3Image', id='website3Image', ng-model='user.profile.website3Image')
|
input.form-control(type='text', name='website3Image', id='website3Image', ng-model='user.profile.website3Image', placeholder='http://')
|
||||||
.form-group
|
.form-group
|
||||||
.col-sm-offset-2.col-sm-4
|
.col-sm-offset-5.col-sm-4
|
||||||
button.btn.btn.btn-primary(type='submit', ng-disabled='profileForm.$invalid')
|
button.btn.btn-primary.btn-block(type='submit', ng-disabled='profileForm.$invalid')
|
||||||
span.ion-edit
|
span.ion-edit
|
||||||
| Update my profile
|
| Update my Portfolio
|
||||||
|
br
|
||||||
.panel
|
.panel
|
||||||
.big-break
|
.big-break
|
||||||
.container.text-center
|
.container.text-center
|
||||||
|
Reference in New Issue
Block a user