Finishing up profile

pull/9/head
terakilobyte 2015-01-07 16:23:25 -05:00
parent 7e34ea340d
commit 22ed592134
3 changed files with 33 additions and 40 deletions

View File

@ -50,16 +50,4 @@ profileValidation.controller('profileValidationController', ['$scope', '$http',
});
}
]);
profileValidation.filter('anyInvalidDirtyFields', function () {
return function(form) {
for(var prop in form) {
if(form.hasOwnProperty(prop)) {
if(form[prop].$invalid && form[prop].$dirty) {
return true;
}
}
}
return false;
};
});

View File

@ -22,22 +22,21 @@ block content
alert(type='danger')
span.ion-close-circled
| Your name must be under 20 characters.
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='username') Username (use letters, numbers, underscore) *
.col-sm-4
input.form-control(type='text', 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")
alert(type='danger')
span.ion-settings
span.ion-close-circled
| Please enter a username.
.col-sm-4.col-sm-offset-5(ng-show="profileForm.username.$error.minlength && !profileForm.username.$pristine")
alert(type='danger')
span.ion-settings
span.ion-close-circled
| Your username must be at least 5 characters.
.col-sm-4.col-sm-offset-5(ng-show="profileForm.username.$error.maxlength && !profileForm.username.$pristine")
alert(type='danger')
span.ion-settings
span.ion-close-circled
| Your username must be less than 20 characters.
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='email') Email *
@ -45,11 +44,11 @@ block content
input.form-control(type='email', placeholder='iluv@microsoft.com', name='email', id='email', ng-model='user.email', required='required')
.col-sm-4.col-sm-offset-5(ng-show="profileForm.email.$error.required && !profileForm.email.$pristine")
alert(type='danger')
span.ion-settings
span.ion-close-circled
| An email address is required.
.col-sm-4.col-sm-offset-5(ng-show="profileForm.$error.email && !profileForm.email.$pristine")
alert(type='danger')
span.ion-settings
span.ion-close-circled
| Please enter a valid email format.
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='location') Location
@ -58,68 +57,75 @@ 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='user.profile.twitterHandle', value='{{ user.profile.twitterHandle')
input.form-control(type='text', name='twitterHandle', id='twitterHandle', ng-model='user.profile.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='url', name='githubProfile', id='githubProfile', ng-model='user.profile.githubProfile', value='{{user.profile.githubProfile}}')
.col-sm-4.col-sm-offset-5(ng-show="profileForm.githubProfile$error.url && !profileForm.githubProfile.$pristine")
input.form-control(type='url', name='githubProfile', id='githubProfile', ng-model='user.profile.githubProfile', placeholder='http://')
.col-sm-4.col-sm-offset-5(ng-show="profileForm.githubProfile.$error.url && !profileForm.githubProfile.$pristine")
alert(type='danger')
span.ion-settings
span.ion-close-circled
| Please enter a valid URL format (http://www.example.com).
.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', ng-model='user.profile.codepenProfile', value='{{user.profile.codepenProfile}}',
ng-pattern="/^(?:(?:https?|ftp):\/\/)?(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})))(?::\d{2,5})?(?:\/\S*)?$/igm")
.col-sm-4.col-sm-offset-5(ng-show="profileForm.codepenProfile.$error.pattern && !profileForm.codepenProfile.$pristine")
input.form-control(type='url', name='codepenProfile', id='codepenProfile', ng-model='user.profile.codepenProfile', placeholder='http://')
.col-sm-4.col-sm-offset-5(ng-show="profileForm.codepenProfile.$error.url && !profileForm.codepenProfile.$pristine")
alert(type='danger')
span.ion-settings
| Please enter a valid URL format.
span.ion-close-circled
| Please enter a valid URL format (http://www.example.com).
.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', ng-model='user.profile.coderbyteProfile', value='{{user.profile.coderbyteProfile}}')
input.form-control(type='url', name='coderbyteProfile', id='coderbyteProfile', ng-model='user.profile.coderbyteProfile', placeholder='http://')
.col-sm-4.col-sm-offset-5(ng-show="profileForm.coderbyteProfile.$error.url && !profileForm.coderbyteProfile.$pristine")
alert(type='danger')
span.ion-close-circled
| Please enter a valid URL format (http://www.example.com).
.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', ng-model='user.profile.linkedinProfile', value='{{user.profile.linkedinProfile}}')
input.form-control(type='url', name='linkedinProfile', id='linkedinProfile', ng-model='user.profile.linkedinProfile', placeholder='http://')
.col-sm-4.col-sm-offset-5(ng-show="profileForm.linkedinProfile.$error.url && !profileForm.linkedinProfile.$pristine")
alert(type='danger')
span.ion-close-circled
| Please enter a valid URL format (http://www.example.com).
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='website1Title') 1st Portfolio Website Title
.col-sm-4
input.form-control(type='text', name='website1Title', id='website1Title', ng-model='user.profile.website1Title', value='{{user.profile.website1Title}}')
input.form-control(type='text', name='website1Title', id='website1Title', ng-model='user.profile.website1Title')
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='website1Link') 1st Portfolio Website Link
.col-sm-4
input.form-control(type='text', name='website1Link', id='website1Link', ng-model='user.profile.website1Link', value='{{user.profile.website1Link}}')
input.form-control(type='text', name='website1Link', id='website1Link', ng-model='user.profile.website1Link')
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='website1Image') 1st Portfolio Website Image Link
.col-sm-4
input.form-control(type='text', name='website1Image', id='website1Image', ng-model='website1Image', value='{{user.profile.website1Image}}')
input.form-control(type='text', name='website1Image', id='website1Image', ng-model='website1Image')
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='website2Title') 2nd Portfolio Website Title
.col-sm-4
input.form-control(type='text', name='website2Title', id='website2Title', ng-model='user.profile.website2Title', value='{{user.profile.website2Title}}')
input.form-control(type='text', name='website2Title', id='website2Title', ng-model='user.profile.website2Title')
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='website2Link') 2nd Portfolio Website Link
.col-sm-4
input.form-control(type='text', name='website2Link', id='website2Link', ng-model='user.profile.website2Link', value='{{user.profile.website2Link}}')
input.form-control(type='text', name='website2Link', id='website2Link', ng-model='user.profile.website2Link')
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='website2Image') 2nd Portfolio Website Image Link
.col-sm-4
input.form-control(type='text', name='website2Image', id='website2Image', ng-model='user.profile.website2Image', value='{{user.profile.website2Image}}')
input.form-control(type='text', name='website2Image', id='website2Image', ng-model='user.profile.website2Image')
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='website3Title') 3rd Portfolio Website Title
.col-sm-4
input.form-control(type='text', name='website3Title', id='website3Title', ng-model='user.profile.website3Title', value='{{user.profile.website3Title}}')
input.form-control(type='text', name='website3Title', id='website3Title', ng-model='user.profile.website3Title')
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='website3Link') 3rd Portfolio Website Link
.col-sm-4
input.form-control(type='text', name='website3Link', id='website3Link', ng-model='user.profile.website3Link', value='{{user.profile.website3Link}}')
input.form-control(type='text', name='website3Link', id='website3Link', ng-model='user.profile.website3Link')
.form-group
label.col-sm-3.col-sm-offset-2.control-label(for='website3Image') 3rd Portfolio Website Image Link
.col-sm-4
input.form-control(type='text', name='website3Image', id='website3Image', ng-model='user.profile.website3Image', value='{{user.profile.website3Image}}')
input.form-control(type='text', name='website3Image', id='website3Image', ng-model='user.profile.website3Image')
.form-group
.col-sm-offset-2.col-sm-4
button.btn.btn.btn-primary(type='submit', ng-disabled='profileForm.$invalid')

View File

@ -4,7 +4,6 @@ html(ng-app='profileValidation')
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")
script(src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.12.0/ui-bootstrap-tpls.min.js")
script(src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.8/angular-aria.min.js")
link(rel='shortcut icon', href='https://s3.amazonaws.com/freecodecamp/favicon.ico')
include partials/meta
title #{title} | Free Code Camp