Fixed change owner, and other display issues
This commit is contained in:
parent
379f903507
commit
09e29aea96
@ -131,7 +131,7 @@ input, textarea {
|
|||||||
.fa-bars, .fa-cog {
|
.fa-bars, .fa-cog {
|
||||||
font-size: 200%;
|
font-size: 200%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
padding: 0.6%;
|
padding: 0.65%;
|
||||||
padding-right: 0.8%;
|
padding-right: 0.8%;
|
||||||
|
|
||||||
float: left;
|
float: left;
|
||||||
@ -166,7 +166,6 @@ input, textarea {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#logout {
|
#logout {
|
||||||
width: initial;
|
|
||||||
padding: 1%;
|
padding: 1%;
|
||||||
|
|
||||||
background-color: rgba(0,0,0,0.05);
|
background-color: rgba(0,0,0,0.05);
|
||||||
|
|||||||
@ -46,6 +46,7 @@ Session.set("modifying",null);
|
|||||||
Session.set("radioDiv",null);
|
Session.set("radioDiv",null);
|
||||||
Session.set("radioOffset",null);
|
Session.set("radioOffset",null);
|
||||||
Session.set("serverData",null);
|
Session.set("serverData",null);
|
||||||
|
Session.set("noclass",null);
|
||||||
|
|
||||||
Template.registerHelper('divColor', (div) => {
|
Template.registerHelper('divColor', (div) => {
|
||||||
return themeColors[Cookie.get("theme")][div];
|
return themeColors[Cookie.get("theme")][div];
|
||||||
@ -62,13 +63,14 @@ Template.registerHelper('overlayDim', (part) => {
|
|||||||
|
|
||||||
Template.registerHelper('myClasses', () => {
|
Template.registerHelper('myClasses', () => {
|
||||||
if (Meteor.user().profile.classes === undefined || Meteor.user().profile.classes.length === 0) {
|
if (Meteor.user().profile.classes === undefined || Meteor.user().profile.classes.length === 0) {
|
||||||
|
Session.set("noclass",true);
|
||||||
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]});
|
||||||
|
found.subscribers = found.subscribers.length;
|
||||||
if(found.admin === Meteor.userId()) found.box = " owned";
|
if(found.admin === Meteor.userId()) found.box = " owned";
|
||||||
array.push(found);
|
array.push(found);
|
||||||
|
|
||||||
@ -80,6 +82,7 @@ Template.registerHelper('myClasses', () => {
|
|||||||
}
|
}
|
||||||
array[i].thisClassWork = thisWork;
|
array[i].thisClassWork = thisWork;
|
||||||
}
|
}
|
||||||
|
Session.set("noclass",false);
|
||||||
return array;
|
return array;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@ -210,7 +210,7 @@
|
|||||||
animation: expand .7s ease 1;
|
animation: expand .7s ease 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#profClassSearch .-autocomplete-container {
|
.-autocomplete-container {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,6 +278,25 @@
|
|||||||
background-color: rgba(0,0,0,0.1);
|
background-color: rgba(0,0,0,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#private {
|
||||||
|
margin: 3% 35% 0 4%;
|
||||||
|
padding: 1.5%;
|
||||||
|
|
||||||
|
background-color: rgba(0,0,0,0.2);
|
||||||
|
|
||||||
|
float: right;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
-webkit-transition: background-color 0.4s ease;
|
||||||
|
-moz-transition: background-color 0.4s ease;
|
||||||
|
-ms-transition: background-color 0.4s ease;
|
||||||
|
transition: background-color 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
#private:hover {
|
||||||
|
background-color: rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
|
|
||||||
.owned {
|
.owned {
|
||||||
background-color: #27646D;
|
background-color: #27646D;
|
||||||
|
|
||||||
@ -328,7 +347,6 @@
|
|||||||
margin-right: 5% !important;
|
margin-right: 5% !important;
|
||||||
margin-bottom: 0 !important;
|
margin-bottom: 0 !important;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.formDiv {
|
.formDiv {
|
||||||
@ -346,9 +364,10 @@
|
|||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.-autocomplete-container {
|
.formDiv .-autocomplete-container {
|
||||||
margin: 0 0 0 0 !important;
|
margin: 0 0 0 0 !important;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
display: inherit !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#creSubmit {
|
#creSubmit {
|
||||||
|
|||||||
@ -59,12 +59,16 @@
|
|||||||
{{#each myClasses}}
|
{{#each myClasses}}
|
||||||
{{> classDisplay}}
|
{{> classDisplay}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
{{#if noclass}}
|
||||||
|
<h3>No results found...</h3>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{#if profClassTab "addClass"}}
|
{{#if profClassTab "addClass"}}
|
||||||
<i class="fa fa-search" aria-hidden="true"></i>
|
<i class="fa fa-search" aria-hidden="true"></i>
|
||||||
{{> inputAutocomplete id="profClassSearch" settings=classsettings placeholder="Search..."}}
|
{{> inputAutocomplete id="profClassSearch" settings=classsettings placeholder="Search..."}}
|
||||||
|
<h4 id="private">Join Private Class</h4>
|
||||||
<div id="label" class="classBox">
|
<div id="label" class="classBox">
|
||||||
<span class="name classText">Class Name</span>
|
<span class="name classText">Class Name</span>
|
||||||
<span class="teacher classText">Teacher</span>
|
<span class="teacher classText">Teacher</span>
|
||||||
@ -76,12 +80,15 @@
|
|||||||
{{#each classes}}
|
{{#each classes}}
|
||||||
{{> classDisplay}}
|
{{> classDisplay}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
{{#if noclass}}
|
||||||
|
<h3>No results found...</h3>
|
||||||
|
{{/if}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{#each autocompleteClasses}}
|
{{#each autocompleteClasses}}
|
||||||
{{> classDisplay}}
|
{{> classDisplay}}
|
||||||
{{/each}}
|
{{/each}}
|
||||||
{{#if notfound}}
|
{{#if notfound}}
|
||||||
<h3>No results found...</h3>
|
<h3>No results found...</h3>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -2,7 +2,6 @@ import {
|
|||||||
Template
|
Template
|
||||||
} from 'meteor/templating';
|
} from 'meteor/templating';
|
||||||
|
|
||||||
|
|
||||||
Meteor.subscribe('schools');
|
Meteor.subscribe('schools');
|
||||||
Meteor.subscribe('classes');
|
Meteor.subscribe('classes');
|
||||||
Meteor.subscribe('work');
|
Meteor.subscribe('work');
|
||||||
@ -19,6 +18,8 @@ Session.set("confirmText", null);
|
|||||||
Session.set("selectedClass",null);
|
Session.set("selectedClass",null);
|
||||||
Session.set("selectClassId",null);
|
Session.set("selectClassId",null);
|
||||||
Session.set("code",null);
|
Session.set("code",null);
|
||||||
|
Session.set("noclass",null);
|
||||||
|
Session.set("notfound",null);
|
||||||
|
|
||||||
var themeColors = {
|
var themeColors = {
|
||||||
"light": {
|
"light": {
|
||||||
@ -103,7 +104,6 @@ Template.profile.helpers({
|
|||||||
pic = Meteor.user().profile.avatar;
|
pic = Meteor.user().profile.avatar;
|
||||||
} else {
|
} else {
|
||||||
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);
|
||||||
@ -139,7 +139,7 @@ Template.profile.helpers({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
classes() {
|
classes() {
|
||||||
return classes.find(
|
var array = classes.find(
|
||||||
{
|
{
|
||||||
status: {$eq: true},
|
status: {$eq: true},
|
||||||
privacy: {$eq: false},
|
privacy: {$eq: false},
|
||||||
@ -148,6 +148,16 @@ Template.profile.helpers({
|
|||||||
{sort: {subscribers: -1 }},
|
{sort: {subscribers: -1 }},
|
||||||
{limit: 20}
|
{limit: 20}
|
||||||
).fetch();
|
).fetch();
|
||||||
|
|
||||||
|
for(var i = 0; i < array.length; i++) {
|
||||||
|
array[i].subscribers = array[i].subscribers.length;
|
||||||
|
}
|
||||||
|
if(array.length === 0) {
|
||||||
|
Session.set("noclass",true);
|
||||||
|
} else {
|
||||||
|
Session.set("noclass",false);
|
||||||
|
}
|
||||||
|
return array;
|
||||||
},
|
},
|
||||||
profClassHeight() {
|
profClassHeight() {
|
||||||
return 0.6 * window.innerHeight.toString() + "px";
|
return 0.6 * window.innerHeight.toString() + "px";
|
||||||
@ -178,6 +188,9 @@ Template.profile.helpers({
|
|||||||
notfound() {
|
notfound() {
|
||||||
return Session.get("notfound");
|
return Session.get("notfound");
|
||||||
},
|
},
|
||||||
|
noclass() {
|
||||||
|
return Session.get("noclass");
|
||||||
|
},
|
||||||
confirmText() {
|
confirmText() {
|
||||||
return Session.get("confirmText");
|
return Session.get("confirmText");
|
||||||
},
|
},
|
||||||
@ -387,8 +400,8 @@ Template.profile.events({
|
|||||||
'click .fa-times-thin' () {
|
'click .fa-times-thin' () {
|
||||||
Session.set("searching", false);
|
Session.set("searching", false);
|
||||||
},
|
},
|
||||||
'keydown #profClassSearch' (event) {
|
'keyup #profClassSearch' (event) {
|
||||||
if (event.target.value === "") {
|
if (event.target.value.length === 0) {
|
||||||
Session.set("notsearching", true);
|
Session.set("notsearching", true);
|
||||||
} else {
|
} else {
|
||||||
Session.set("notsearching", false);
|
Session.set("notsearching", false);
|
||||||
@ -409,7 +422,7 @@ Template.profile.events({
|
|||||||
name: item.childNodes[1].childNodes[0].nodeValue,
|
name: item.childNodes[1].childNodes[0].nodeValue,
|
||||||
teacher: item.childNodes[3].childNodes[0].nodeValue,
|
teacher: item.childNodes[3].childNodes[0].nodeValue,
|
||||||
hour: item.childNodes[5].childNodes[0].nodeValue,
|
hour: item.childNodes[5].childNodes[0].nodeValue,
|
||||||
subscribers: item.childNodes[7].childNodes[0].nodeValue,
|
subscribers: item.childNodes[7].childNodes[0].nodeValue.length/17,
|
||||||
_id: item.getAttribute("classid")
|
_id: item.getAttribute("classid")
|
||||||
});
|
});
|
||||||
Session.set("autocompleteDivs", divs);
|
Session.set("autocompleteDivs", divs);
|
||||||
@ -475,16 +488,17 @@ Template.profile.events({
|
|||||||
input.placeholder = "1234@abc.xyz";
|
input.placeholder = "1234@abc.xyz";
|
||||||
input.className.replace(" formInvalid","");
|
input.className.replace(" formInvalid","");
|
||||||
var value = input.value;
|
var value = input.value;
|
||||||
|
var classid = document.getElementById("createdClasses").getAttribute("classid");
|
||||||
input.value = "";
|
input.value = "";
|
||||||
if(checkUser(value)) {
|
if(checkUser(value,classid)) {
|
||||||
input.className += " formInvalid";
|
input.className += " formInvalid";
|
||||||
input.placeholder = "Not a valid user";
|
input.placeholder = "Not a valid user";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var user = Meteor.users.findOne({"services.google.email":input.value});
|
var user = Meteor.users.findOne({"services.google.email":value});
|
||||||
Session.set("serverData", [
|
Session.set("serverData", [
|
||||||
user._id,
|
user._id,
|
||||||
document.getElementById("createdClasses").getAttribute("classid"),
|
classid,
|
||||||
event.target.parentNode.childNodes[1].childNodes[0].nodeValue.replace(":","").toLowerCase()
|
event.target.parentNode.childNodes[1].childNodes[0].nodeValue.replace(":","").toLowerCase()
|
||||||
]);
|
]);
|
||||||
sendData("trackUserInClass");
|
sendData("trackUserInClass");
|
||||||
@ -526,12 +540,19 @@ Template.profile.events({
|
|||||||
input.placeholder = "1234@abc.xyz";
|
input.placeholder = "1234@abc.xyz";
|
||||||
input.className.replace(" formInvalid","");
|
input.className.replace(" formInvalid","");
|
||||||
var value = input.value;
|
var value = input.value;
|
||||||
|
var classid = document.getElementById("createdClasses").getAttribute("classid");
|
||||||
input.value = "";
|
input.value = "";
|
||||||
if(checkUser(value)) {
|
if(checkUser(value,classid)) {
|
||||||
input.className += " formInvalid";
|
input.className += " formInvalid";
|
||||||
input.placeholder = "Not a valid user";
|
input.placeholder = "Not a valid user";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var user = Meteor.users.findOne({"services.google.email":value});
|
||||||
|
Session.set("serverData", [user._id,classid]);
|
||||||
|
Session.set("confirm","changeAdmin");
|
||||||
|
Session.set("confirmText", "Are you really sure?");
|
||||||
|
openDivFade(document.getElementsByClassName("overlay")[0])
|
||||||
|
document.getElementById("createdClasses").style.marginRight = "-40%";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -632,11 +653,12 @@ function getCreateFormData() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkUser(email) {
|
function checkUser(email,classid) {
|
||||||
var user = Meteor.users.findOne({"services.google.email":email});
|
var user = Meteor.users.findOne({"services.google.email":email});
|
||||||
if(user === undefined) {
|
if(user === undefined) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
if(classes.findOne({_id:classid}).subscribers)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user