Fixed couldn't add work, and minor profile bug
This commit is contained in:
parent
38eba83101
commit
a15e588c92
@ -364,6 +364,7 @@ Template.main.helpers({
|
|||||||
return "width:"+w.toString()+"px;height:"+h.toString()+"px;margin-left:"+-0.5*w.toString()+"px;margin-top:"+-0.5*h.toString()+"px";
|
return "width:"+w.toString()+"px;height:"+h.toString()+"px;margin-left:"+-0.5*w.toString()+"px;margin-top:"+-0.5*h.toString()+"px";
|
||||||
},
|
},
|
||||||
commentDim() {
|
commentDim() {
|
||||||
|
if(Session.get("newWork") || Session.get("newWork") === null) return;
|
||||||
var work = Session.get("currentWork");
|
var work = Session.get("currentWork");
|
||||||
if(work === null) return;
|
if(work === null) return;
|
||||||
if(work.comments.length <= 3) return;
|
if(work.comments.length <= 3) return;
|
||||||
@ -482,10 +483,11 @@ Template.main.events({
|
|||||||
if(getHomeworkFormData() === null) return;
|
if(getHomeworkFormData() === null) return;
|
||||||
Session.set("serverData",Session.get("currentWork"));
|
Session.set("serverData",Session.get("currentWork"));
|
||||||
sendData("editWork");
|
sendData("editWork");
|
||||||
|
document.getElementById("workComment").value = "";
|
||||||
}
|
}
|
||||||
Session.set("newWork",null);
|
Session.set("newWork",null);
|
||||||
Session.set("commentRestrict",null);
|
Session.set("commentRestrict",null);
|
||||||
document.getElementById("workComment").value = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.target.id !== sessval &&
|
if (event.target.id !== sessval &&
|
||||||
@ -624,7 +626,7 @@ Template.main.events({
|
|||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
openDivFade(document.getElementsByClassName(radio)[op.getAttribute("op")]);
|
openDivFade(document.getElementsByClassName(radio)[op.getAttribute("op")]);
|
||||||
},
|
},
|
||||||
'click .workOptions p' (event) {
|
'click .workOptionText' (event) {
|
||||||
var sessval = Session.get("modifying");
|
var sessval = Session.get("modifying");
|
||||||
var p = event.target;
|
var p = event.target;
|
||||||
var opnum = parseInt(Session.get("radioDiv")) - parseInt(Session.get("radioOffset"));
|
var opnum = parseInt(Session.get("radioDiv")) - parseInt(Session.get("radioOffset"));
|
||||||
@ -639,7 +641,7 @@ Template.main.events({
|
|||||||
Session.set("radioDiv", null);
|
Session.set("radioDiv", null);
|
||||||
Session.set("radioOffset", null);
|
Session.set("radioOffset", null);
|
||||||
},
|
},
|
||||||
'click .prefOptions p' (event) {
|
'click .prefOptionText' (event) {
|
||||||
var sessval = Session.get("modifying");
|
var sessval = Session.get("modifying");
|
||||||
var p = event.target;
|
var p = event.target;
|
||||||
var opnum = parseInt(Session.get("radioDiv")) - parseInt(Session.get("radioOffset"));
|
var opnum = parseInt(Session.get("radioDiv")) - parseInt(Session.get("radioOffset"));
|
||||||
@ -920,19 +922,21 @@ function formReadable(input) {
|
|||||||
input.type = input.type[0].toUpperCase() + input.type.slice(1);
|
input.type = input.type[0].toUpperCase() + input.type.slice(1);
|
||||||
var comments = input.comments;
|
var comments = input.comments;
|
||||||
var resort = [];
|
var resort = [];
|
||||||
for(var k = 0; k < comments.length; k++) {
|
if(!Session.get("newWork")) {
|
||||||
var re = comments.length-k-1;
|
for(var k = 0; k < comments.length; k++) {
|
||||||
resort[re] = {"comment":comments[k].comment,"date":null,"user":null};
|
var re = comments.length-k-1;
|
||||||
resort[re].user = Meteor.users.findOne({_id:comments[k].user}).profile.name;
|
resort[re] = {"comment":comments[k].comment,"date":null,"user":null};
|
||||||
resort[re].date = moment(comments[k].date).calendar(null, { //change to time if recently posted
|
resort[re].user = Meteor.users.findOne({_id:comments[k].user}).profile.name;
|
||||||
sameDay: '[Today]',
|
resort[re].date = moment(comments[k].date).calendar(null, { //change to time if recently posted
|
||||||
nextDay: '[Tomorrow]',
|
sameDay: '[Today]',
|
||||||
nextWeek: 'dddd',
|
nextDay: '[Tomorrow]',
|
||||||
lastDay: '[Yesterday]',
|
nextWeek: 'dddd',
|
||||||
lastWeek: '[Last] dddd',
|
lastDay: '[Yesterday]',
|
||||||
sameElse: 'MMMM Do'
|
lastWeek: '[Last] dddd',
|
||||||
});
|
sameElse: 'MMMM Do'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
input.comments = resort;
|
||||||
}
|
}
|
||||||
input.comments = resort;
|
|
||||||
return input;
|
return input;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -340,7 +340,7 @@ Template.profile.events({
|
|||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
openDivFade(document.getElementsByClassName("profOptions")[op.getAttribute("op")]);
|
openDivFade(document.getElementsByClassName("profOptions")[op.getAttribute("op")]);
|
||||||
},
|
},
|
||||||
'click .profOptions p' (event) { // When someone selects "drop-down item"
|
'click .profOptionText' (event) { // When someone selects "drop-down item"
|
||||||
var sessval = Session.get("modifying");
|
var sessval = Session.get("modifying");
|
||||||
var p = event.target;
|
var p = event.target;
|
||||||
var opnum = parseInt(Session.get("radioDiv")) - parseInt(Session.get("radioOffset"));
|
var opnum = parseInt(Session.get("radioDiv")) - parseInt(Session.get("radioOffset"));
|
||||||
@ -610,20 +610,16 @@ function sendData(funcName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getProfileData() {
|
function getProfileData() {
|
||||||
var description = document.getElementById("motd").childNodes[0].nodeValue;
|
var profile = Meteor.user().profile;
|
||||||
var school = document.getElementById("school").childNodes[0].nodeValue;
|
profile.description = document.getElementById("motd").childNodes[0].nodeValue;
|
||||||
|
profile.school = document.getElementById("school").childNodes[0].nodeValue;
|
||||||
var gradein = document.getElementById("grade").childNodes[0].nodeValue;
|
var gradein = document.getElementById("grade").childNodes[0].nodeValue;
|
||||||
var grade = parseInt(gradein.substring(gradein.length - 2, gradein));
|
profile.grade = parseInt(gradein.substring(gradein.length - 2, gradein));
|
||||||
var avatar = document.getElementById("profAvatar").style.backgroundImage.replace(")", "").replace("url(", "").replace("\"", "").replace("\"", "");
|
profile.avatar = document.getElementById("profAvatar").style.backgroundImage.replace(")", "").replace("url(", "").replace("\"", "").replace("\"", "");
|
||||||
var banner = document.getElementById("profBanner").style.backgroundImage.replace(")", "").replace("url(", "").replace("\"", "").replace("\"", "");
|
profile.banner = document.getElementById("profBanner").style.backgroundImage.replace(")", "").replace("url(", "").replace("\"", "").replace("\"", "");
|
||||||
|
profile.preferences = Meteor.user().profile.preferences;
|
||||||
|
|
||||||
return {
|
return profile;
|
||||||
school: school,
|
|
||||||
grade: grade,
|
|
||||||
description: description,
|
|
||||||
avatar: avatar,
|
|
||||||
banner: banner
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCreateFormData() {
|
function getCreateFormData() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user