Merge branch 'master' of https://github.com/ksjdragon/hourglass
This commit is contained in:
commit
b5a4351bc2
@ -39,3 +39,5 @@ harrison:papa-parse
|
||||
pfafman:filesaver
|
||||
flemay:less-autoprefixer
|
||||
natestrauser:select2
|
||||
juliancwirko:s-alert
|
||||
juliancwirko:s-alert-stackslide
|
||||
|
||||
@ -59,6 +59,8 @@ iron:middleware-stack@1.1.0
|
||||
iron:router@1.0.13
|
||||
iron:url@1.0.11
|
||||
jquery@1.11.9
|
||||
juliancwirko:s-alert@3.2.0
|
||||
juliancwirko:s-alert-stackslide@3.1.3
|
||||
lai:collection-extensions@0.2.1_1
|
||||
launch-screen@1.0.12
|
||||
less@2.7.5
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<template name="profile">
|
||||
{{> sAlert}}
|
||||
<div class="noScroll">
|
||||
<div id="mainpage{{userProfile}}"><h2>Main Page</h2></div>
|
||||
<div id="logout2" onclick='document.getElementById("login-buttons-logout").click();'><h2>Logout</h2></div>
|
||||
|
||||
@ -99,15 +99,23 @@ Template.profile.helpers({
|
||||
return "Click here to edit...";
|
||||
},
|
||||
classes() { // Loads all of the possible classes ( Limit of twenty shown ) ( Sorts by class size )
|
||||
var array = classes.find(
|
||||
{
|
||||
status: {$eq: true},
|
||||
privacy: {$eq: false},
|
||||
_id: {$nin: Meteor.user().profile.classes}
|
||||
var array = classes.find({
|
||||
status: {
|
||||
$eq: true
|
||||
},
|
||||
{sort: {subscribers: -1 }},
|
||||
{limit: 20}
|
||||
).fetch();
|
||||
privacy: {
|
||||
$eq: false
|
||||
},
|
||||
_id: {
|
||||
$nin: Meteor.user().profile.classes
|
||||
}
|
||||
}, {
|
||||
sort: {
|
||||
subscribers: -1
|
||||
}
|
||||
}, {
|
||||
limit: 20
|
||||
}).fetch();
|
||||
|
||||
for (var i = 0; i < array.length; i++) {
|
||||
array[i].subscribers = array[i].subscribers.length;
|
||||
@ -204,7 +212,8 @@ Template.profile.events({
|
||||
// MAIN BUTTONS
|
||||
'click #mainpage' () {
|
||||
if (!Meteor.userId() || _.contains([null, undefined, ""], Meteor.user().profile.school)) {
|
||||
alert("Please fill in your profile!");
|
||||
sAlert.closeAll();
|
||||
sAlert.error('Please fill in your profile!', {effect: 'stackslide', position: 'top'});
|
||||
} else {
|
||||
window.location = '/';
|
||||
}
|
||||
@ -214,7 +223,7 @@ Template.profile.events({
|
||||
var functionHolder = document.getElementById("profClassInfoHolder");
|
||||
closeDivFade(functionHolder);
|
||||
var div = document.getElementById("profClasses");
|
||||
div.style.height = "50%"
|
||||
div.style.height = "50%";
|
||||
setTimeout(function() {
|
||||
Session.set("profClassTab", "addClass");
|
||||
div.style.height = "90%";
|
||||
@ -226,7 +235,7 @@ Template.profile.events({
|
||||
var functionHolder = document.getElementById("profClassInfoHolder");
|
||||
closeDivFade(functionHolder);
|
||||
var div = document.getElementById("profClasses");
|
||||
div.style.height = "50%"
|
||||
div.style.height = "50%";
|
||||
setTimeout(function() {
|
||||
Session.set("profClassTab", "manClass");
|
||||
div.style.height = "90%";
|
||||
@ -238,7 +247,7 @@ Template.profile.events({
|
||||
var functionHolder = document.getElementById("profClassInfoHolder");
|
||||
closeDivFade(functionHolder);
|
||||
var div = document.getElementById("profClasses");
|
||||
div.style.height = "50%"
|
||||
div.style.height = "50%";
|
||||
setTimeout(function() {
|
||||
Session.set("profClassTab", "creClass");
|
||||
div.style.height = "90%";
|
||||
@ -274,14 +283,18 @@ Template.profile.events({
|
||||
}
|
||||
Session.set("selectedClass", null);
|
||||
var usertype = ["moderators", "banned"];
|
||||
var array = classes.findOne({_id:attribute});
|
||||
var array = classes.findOne({
|
||||
_id: attribute
|
||||
});
|
||||
|
||||
for (var i = 0; i < usertype.length; i++) {
|
||||
var users = array[usertype[i]];
|
||||
array[usertype[i]] = [];
|
||||
for (var j = 0; j < users.length; j++) {
|
||||
var detailusers = {};
|
||||
var user = Meteor.users.findOne({_id:users[j]});
|
||||
var user = Meteor.users.findOne({
|
||||
_id: users[j]
|
||||
});
|
||||
detailusers._id = user._id;
|
||||
detailusers.email = user.services.google.email;
|
||||
detailusers.name = user.profile.name;
|
||||
@ -357,7 +370,9 @@ Template.profile.events({
|
||||
input.placeholder = "Not a valid user";
|
||||
return;
|
||||
}
|
||||
var user = Meteor.users.findOne({"services.google.email":value});
|
||||
var user = Meteor.users.findOne({
|
||||
"services.google.email": value
|
||||
});
|
||||
serverData = [
|
||||
user._id,
|
||||
classid,
|
||||
@ -405,7 +420,9 @@ Template.profile.events({
|
||||
input.placeholder = "Not a valid user";
|
||||
return;
|
||||
}
|
||||
var user = Meteor.users.findOne({"services.google.email":value});
|
||||
var user = Meteor.users.findOne({
|
||||
"services.google.email": value
|
||||
});
|
||||
serverData = [user._id, classid];
|
||||
confirm = "changeAdmin";
|
||||
Session.set("confirmText", "Are you really sure?");
|
||||
@ -601,14 +618,18 @@ function sendData(funcName) {
|
||||
Meteor.call(funcName, serverData, function(err, result) {
|
||||
if (funcName === "trackUserInClass") {
|
||||
var selectedClass = Session.get("selectedClass");
|
||||
var array = classes.findOne({_id:selectedClass._id});
|
||||
var array = classes.findOne({
|
||||
_id: selectedClass._id
|
||||
});
|
||||
var usertype = ["moderators", "banned"];
|
||||
for (var i = 0; i < usertype.length; i++) {
|
||||
var users = array[usertype[i]];
|
||||
array[usertype[i]] = [];
|
||||
for (var j = 0; j < users.length; j++) {
|
||||
var detailusers = {};
|
||||
var user = Meteor.users.findOne({_id:users[j]});
|
||||
var user = Meteor.users.findOne({
|
||||
_id: users[j]
|
||||
});
|
||||
detailusers._id = user._id;
|
||||
detailusers.email = user.services.google.email;
|
||||
detailusers.name = user.profile.name;
|
||||
@ -689,11 +710,15 @@ function getCreateFormData() { // Gets create class form data, and returns null.
|
||||
}
|
||||
|
||||
function checkUser(email, classid) { // Checks if user email exists.
|
||||
var user = Meteor.users.findOne({"services.google.email":email});
|
||||
var user = Meteor.users.findOne({
|
||||
"services.google.email": email
|
||||
});
|
||||
if (user === undefined) {
|
||||
return true;
|
||||
} else {
|
||||
if(classes.findOne({_id:classid}).subscribers)
|
||||
if (classes.findOne({
|
||||
_id: classid
|
||||
}).subscribers)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user