Merge branch 'master' of https://github.com/ksjdragon/hourglass
This commit is contained in:
commit
cfb25d8031
@ -60,37 +60,25 @@ Template.registerHelper('overlayDim', (part) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
Template.registerHelper('myClasses', () => {
|
Template.registerHelper('myClasses', () => {
|
||||||
var invalid = [];
|
if (Meteor.user().profile.classes === undefined || Meteor.user().profile.classes.length === 0) {
|
||||||
if (Meteor.user().profile.classes === undefined || Meteor.user().profile.classes.length === 0) {
|
|
||||||
return [];
|
return [];
|
||||||
} else {
|
} else {
|
||||||
var array = [];
|
var array = [];
|
||||||
var courses = Meteor.user().profile.classes;
|
var courses = Meteor.user().profile.classes;
|
||||||
for(var i = 0; i < courses.length; i++) {
|
for(var i = 0; i < courses.length; i++) {
|
||||||
found = classes.findOne({_id:courses[i]});
|
found = classes.findOne({_id:courses[i]});
|
||||||
// if (found !== undefined) {
|
array.push(found);
|
||||||
array.push(found);
|
var thisWork = work.find({class: courses[i]}).fetch();
|
||||||
var thisWork = work.find({class: array.slice(-1)[0]}).fetch();
|
|
||||||
|
|
||||||
for(var j = 0; j < thisWork.length; j++) {
|
for(var j = 0; j < thisWork.length; j++) {
|
||||||
thisWork[j].dueDate = getReadableDate(thisWork[j].dueDate);
|
thisWork[j].dueDate = getReadableDate(thisWork[j].dueDate);
|
||||||
thisWork[j].typeColor = workColors[thisWork[j].type];
|
thisWork[j].typeColor = workColors[thisWork[j].type];
|
||||||
}
|
}
|
||||||
array[i].thisClassWork = thisWork;
|
array[i].thisClassWork = thisWork;
|
||||||
// } else {
|
console.log(array);
|
||||||
// console.log("invalid");
|
}
|
||||||
// invalid.push(i);
|
return array;
|
||||||
// }
|
}
|
||||||
}
|
|
||||||
// for(var i = 0; i < invalid.length; i++) {
|
|
||||||
// array.splice(invalid[i], 1);
|
|
||||||
// courses.splice(invalid[i], 1);
|
|
||||||
// }
|
|
||||||
// userprofile = Meteor.user().profile;
|
|
||||||
// userprofile.classes = courses;
|
|
||||||
// Meteor.call("editProfile", userprofile);
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.main.helpers({
|
Template.main.helpers({
|
||||||
|
|||||||
@ -95,7 +95,7 @@ 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) {
|
if (Meteor.user().profile.avatar !== undefined) {
|
||||||
var pic = Meteor.user().profile.avatar + ".png";
|
var pic = Meteor.user().profile.avatar;;
|
||||||
} else {
|
} else {
|
||||||
var pic = "Avatars/" + (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 = Meteor.user().profile;
|
||||||
@ -499,6 +499,7 @@ function getCreateFormData() {
|
|||||||
var stop;
|
var stop;
|
||||||
var form = document.getElementsByClassName("creInput");
|
var form = document.getElementsByClassName("creInput");
|
||||||
for (var i = 0; i < form.length; i++) {
|
for (var i = 0; i < form.length; i++) {
|
||||||
|
if(i === 1) continue;
|
||||||
if (form[i].value === "") {
|
if (form[i].value === "") {
|
||||||
form[i].focus();
|
form[i].focus();
|
||||||
form[i].placeholder = "Missing field";
|
form[i].placeholder = "Missing field";
|
||||||
|
|||||||
@ -353,7 +353,7 @@ Meteor.methods({
|
|||||||
pass === found.code &&
|
pass === found.code &&
|
||||||
found.banned.indexOf(Meteor.userId()) === -1 &&
|
found.banned.indexOf(Meteor.userId()) === -1 &&
|
||||||
prof.classes.indexOf(change) === -1) {
|
prof.classes.indexOf(change) === -1) {
|
||||||
|
classes.update({_id: found._id}, {$set: {subscribers: found.subscribers + 1}});
|
||||||
var current = Meteor.user().profile;
|
var current = Meteor.user().profile;
|
||||||
current.classes.push(change);
|
current.classes.push(change);
|
||||||
Meteor.users.update({
|
Meteor.users.update({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user