This commit is contained in:
Yaman Qalieh 2016-08-16 06:43:46 -04:00
parent 93f8b3489e
commit fbd0c0a515

View File

@ -96,12 +96,15 @@ Template.profile.helpers({
}, },
avatar() { avatar() {
var dim = window.innerWidth * 1600 / 1920 * 0.16; var dim = window.innerWidth * 1600 / 1920 * 0.16;
if (Meteor.user().profile.avatar !== undefined) { var pic = "";
var pic = Meteor.user().profile.avatar; var userprofile = Meteor.user().profile.avatar;
if (userprofile !== undefined && userprofile !== null) {
pic = Meteor.user().profile.avatar;
} else { } else {
var pic = "Avatars/" + (Math.floor(Math.random() * (11 - 1)) + 1).toString() + ".png"; pic = "Avatars/" + (Math.floor(Math.random() * (11 - 1)) + 1).toString() + ".png";
console.log(pic);
currentprofile = Meteor.user().profile; currentprofile = Meteor.user().profile;
currentprofile.avatar = pic currentprofile.avatar = pic;
Meteor.call("editProfile", currentprofile); Meteor.call("editProfile", currentprofile);
} }
return "background-image:url(" + pic + ");background-size:" + dim.toString() + "px " + dim.toString() + "px"; return "background-image:url(" + pic + ");background-size:" + dim.toString() + "px " + dim.toString() + "px";