profile fixes
This commit is contained in:
parent
f6476182e0
commit
568f6e245f
@ -1,6 +1,5 @@
|
|||||||
<template name="profile">
|
<template name="profile">
|
||||||
<div id="profPage" style="background-color:{{divColor 'header'}};height:{{mainHeight}};">
|
<div id="profPage" style="background-color:{{divColor 'header'}};height:{{mainHeight}};">
|
||||||
<div id="save"><h2>Save Settings</h2></div>
|
|
||||||
<div id="mainpage" onclick="window.location='/'"><h2>Main Page</h2></div>
|
<div id="mainpage" onclick="window.location='/'"><h2>Main Page</h2></div>
|
||||||
<div id="profMainContainer" style="{{mainCenter}}">
|
<div id="profMainContainer" style="{{mainCenter}}">
|
||||||
<div id="profBanner" style="{{banner}};"></div>
|
<div id="profBanner" style="{{banner}};"></div>
|
||||||
|
|||||||
@ -77,19 +77,25 @@ Template.profile.helpers({
|
|||||||
banner() {
|
banner() {
|
||||||
var width = window.innerWidth * 1600 / 1920;
|
var width = window.innerWidth * 1600 / 1920;
|
||||||
var height = width * 615 / 1600;
|
var height = width * 615 / 1600;
|
||||||
if (Meteor.user().profile.banner !== undefined) {
|
if (Meteor.user().profile.banner) {
|
||||||
var banner = Meteor.user().profile.banner;
|
var banner = Meteor.user().profile.banner;
|
||||||
} else {
|
} else {
|
||||||
var banner = "defaultcover.jpg";
|
var banner = "Banners/defaultcover.jpg";
|
||||||
|
currentprofile = Meteor.user().profile;
|
||||||
|
currentprofile.banner = banner
|
||||||
|
Meteor.call("editProfile", currentprofile);
|
||||||
}
|
}
|
||||||
return "width:" + width.toString() + "px;height:" + height.toString() + "px;background-image:url(\'" + banner + "\');background-size:" + width.toString() + "px " + height.toString() + "px";
|
return "width:" + width.toString() + "px;height:" + height.toString() + "px;background-image:url(" + banner + ");background-size:" + width.toString() + "px " + height.toString() + "px";
|
||||||
},
|
},
|
||||||
avatar() {
|
avatar() {
|
||||||
var dim = window.innerWidth * 1600 / 1920 * 0.16;
|
var dim = window.innerWidth * 1600 / 1920 * 0.16;
|
||||||
if (Meteor.user().profile.avatar !== undefined) {
|
if (Meteor.user().profile.avatar) {
|
||||||
var pic = "\'" + Meteor.user().profile.avatar + "\'";
|
var pic = Meteor.user().profile.avatar;
|
||||||
} else {
|
} else {
|
||||||
var pic = "defaultAvatars/" + (Math.floor(Math.random() * (11 - 1)) + 1).toString() + ".png";
|
var pic = "Avatars/" + (Math.floor(Math.random() * (11 - 1)) + 1).toString(); + ".png";
|
||||||
|
currentprofile = Meteor.user().profile;
|
||||||
|
currentprofile.avatar = pic
|
||||||
|
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";
|
||||||
},
|
},
|
||||||
@ -101,21 +107,21 @@ Template.profile.helpers({
|
|||||||
return Meteor.user().profile.name;
|
return Meteor.user().profile.name;
|
||||||
},
|
},
|
||||||
motd() {
|
motd() {
|
||||||
if (Meteor.user().profile.description !== undefined) {
|
if (Meteor.user().profile.description) {
|
||||||
return Meteor.user().profile.description;
|
return Meteor.user().profile.description;
|
||||||
} else {
|
} else {
|
||||||
return "Say something about yourself!";
|
return "Say something about yourself!";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
school() {
|
school() {
|
||||||
if (Meteor.user().profile.school !== undefined) {
|
if (Meteor.user().profile.school) {
|
||||||
return Meteor.user().profile.school;
|
return Meteor.user().profile.school;
|
||||||
} else {
|
} else {
|
||||||
return "Click here to edit...";
|
return "Click here to edit...";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
grade() {
|
grade() {
|
||||||
if (Meteor.user().profile.grade !== undefined) {
|
if (Meteor.user().profile.grade) {
|
||||||
return Meteor.user().profile.grade + "th";
|
return Meteor.user().profile.grade + "th";
|
||||||
} else {
|
} else {
|
||||||
return "Click here to edit...";
|
return "Click here to edit...";
|
||||||
@ -457,6 +463,8 @@ function closeInput(sessval) {
|
|||||||
}
|
}
|
||||||
span.style.display = "initial";
|
span.style.display = "initial";
|
||||||
Session.set("modifying", null);
|
Session.set("modifying", null);
|
||||||
|
Session.set("serverData", getProfileData());
|
||||||
|
sendData("editProfile");
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendData(funcName) {
|
function sendData(funcName) {
|
||||||
|
|||||||
@ -129,9 +129,11 @@ Meteor.methods({
|
|||||||
name: current.school
|
name: current.school
|
||||||
}) !== null &&
|
}) !== null &&
|
||||||
Number.isInteger(current.grade) &&
|
Number.isInteger(current.grade) &&
|
||||||
current.grade >= 9 && current.grade <= 12 &&
|
current.grade >= 9 && current.grade <= 12) {
|
||||||
current.description.length <= 50) {
|
|
||||||
|
if (current.description && current.description.length > 50) {
|
||||||
|
current.description = current.description.slice(0,50);
|
||||||
|
}
|
||||||
Meteor.users.update({
|
Meteor.users.update({
|
||||||
_id: Meteor.userId()
|
_id: Meteor.userId()
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user