User profile pictures now defaults to empty string, it won't be displayed if it's not present

This commit is contained in:
Sahat Yalkabov
2013-12-11 22:16:06 -05:00
parent 6e0c7afb5a
commit a9cd6e07ac
3 changed files with 13 additions and 10 deletions

View File

@ -18,7 +18,7 @@ var userSchema = new mongoose.Schema({
gender: { type: String, default: '' }, gender: { type: String, default: '' },
location: { type: String, default: '' }, location: { type: String, default: '' },
website: { type: String, default: '' }, website: { type: String, default: '' },
picture: { type: String, default: 'http://bit.ly/1cppDAL' } picture: { type: String, default: '' }
} }
}); });
@ -30,7 +30,7 @@ userSchema.path('password').validate(function(password) {
userSchema.path('username').validate(function(username) { userSchema.path('username').validate(function(username) {
if (this.provider) return true; if (this.provider) return true;
return username.length; return username.length;
}, 'Username cannot be blank'); }, 'Email cannot be blank');
userSchema.pre('save', function(next) { userSchema.pre('save', function(next) {

View File

@ -4,15 +4,17 @@ body {
// //
// TODO: Refactor // TODO: Refactor
// //
.user img {
border-radius: 50%; .user .picture {
width: 40px; width: 40px;
height: 40px; height: 40px;
vertical-align: baseline; margin: -10px 0 -10px 0;
margin-top: -15px; border-radius: 50%;
margin-bottom: -15px; background-color: #1a242f;
position: relative;
left: -10px; img {
max-height: 100%;
}
} }
[class^="fa-"], [class^="fa-"],

View File

@ -47,7 +47,8 @@ html
else else
li.user(class=title=='Account Management'?'active':undefined) li.user(class=title=='Account Management'?'active':undefined)
a(href='/account') a(href='/account')
img(src='#{user.profile.picture}') if user.profile.picture
img(src='#{user.profile.picture}')
| #{user.profile.name} | #{user.profile.name}
li li
a(href='/logout') Logout a(href='/logout') Logout