Added joining private classes, fixed issue #30
This commit is contained in:
parent
6fc1ec14c9
commit
38b4c33563
@ -568,7 +568,7 @@
|
|||||||
-webkit-transition: background-color 0.4s ease;
|
-webkit-transition: background-color 0.4s ease;
|
||||||
-moz-transition: background-color 0.4s ease;
|
-moz-transition: background-color 0.4s ease;
|
||||||
-ms-transition: background-color 0.4s ease;
|
-ms-transition: background-color 0.4s ease;
|
||||||
transition: background-color 0.4s ease
|
transition: background-color 0.4s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
#changeAdmin span:hover {
|
#changeAdmin span:hover {
|
||||||
@ -602,9 +602,56 @@
|
|||||||
-webkit-transition: color 0.4s ease;
|
-webkit-transition: color 0.4s ease;
|
||||||
-moz-transition: color 0.4s ease;
|
-moz-transition: color 0.4s ease;
|
||||||
-ms-transition: color 0.4s ease;
|
-ms-transition: color 0.4s ease;
|
||||||
transition: color 0.4s ease
|
transition: color 0.4s ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fa-exchange:hover {
|
.fa-exchange:hover {
|
||||||
color: #CC4444;
|
color: #CC4444;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#joinPrivClass {
|
||||||
|
width: 18%;
|
||||||
|
margin-bottom: -10%;
|
||||||
|
padding: 1.5%;
|
||||||
|
padding-bottom: 2%;
|
||||||
|
|
||||||
|
border-top: 5px solid #852E6D;
|
||||||
|
box-shadow: -2px 0px 5px 1px #444;
|
||||||
|
|
||||||
|
position: absolute;
|
||||||
|
right: 5%;
|
||||||
|
bottom: 0;
|
||||||
|
|
||||||
|
-webkit-transition: margin 0.4s ease;
|
||||||
|
-moz-transition: margin 0.4s ease;
|
||||||
|
-ms-transition: margin 0.4s ease;
|
||||||
|
transition: margin 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
#joinPrivClass h3 {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 150%;
|
||||||
|
margin-bottom: 3%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#privateCode {
|
||||||
|
font-size: 130%;
|
||||||
|
padding: 1%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#privSubmit {
|
||||||
|
font-size: 120%;
|
||||||
|
margin-left: 5%;
|
||||||
|
padding: 3%;
|
||||||
|
background-color: rgba(0,0,0,0.2);
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
-webkit-transition: background-color 0.2s ease;
|
||||||
|
-moz-transition: background-color 0.2s ease;
|
||||||
|
-ms-transition: background-color 0.2s ease;
|
||||||
|
transition: background-color 0.2s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
#privSubmit:hover {
|
||||||
|
background-color: rgba(0,0,0,0.1);
|
||||||
|
}
|
||||||
@ -185,6 +185,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div id="deleteClass">Delete Class</div>
|
<div id="deleteClass">Delete Class</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="joinPrivClass" style="background-color:{{divColor 'cards'}}">
|
||||||
|
<h3>Enter Code:</h3>
|
||||||
|
<input id="privateCode" type="text" placeholder="Enter code here...">
|
||||||
|
<h4 id="privSubmit">Submit</h4>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template name="classDisplay">
|
<template name="classDisplay">
|
||||||
|
|||||||
@ -195,7 +195,7 @@ Template.profile.helpers({
|
|||||||
return Session.get("confirmText");
|
return Session.get("confirmText");
|
||||||
},
|
},
|
||||||
selectedClass(val) {
|
selectedClass(val) {
|
||||||
if(Session.get("selectedClass") === null) return;
|
if(Session.get("selectClassId") === null) return;
|
||||||
var usertype = ["moderators","banned"];
|
var usertype = ["moderators","banned"];
|
||||||
var attribute = Session.get("selectClassId");
|
var attribute = Session.get("selectClassId");
|
||||||
var array = classes.findOne({_id:attribute});
|
var array = classes.findOne({_id:attribute});
|
||||||
@ -314,6 +314,11 @@ Template.profile.events({
|
|||||||
div.removeChild(div.childNodes[3]);
|
div.removeChild(div.childNodes[3]);
|
||||||
div.removeChild(div.childNodes[3]);
|
div.removeChild(div.childNodes[3]);
|
||||||
}
|
}
|
||||||
|
if(Session.get("privateClass") &&
|
||||||
|
!document.getElementById("joinPrivClass").contains(event.target)) {
|
||||||
|
Session.set("privateClass",false);
|
||||||
|
document.getElementById("joinPrivClass").style.marginBottom = "-10%";
|
||||||
|
}
|
||||||
},
|
},
|
||||||
'keydown' (event) {
|
'keydown' (event) {
|
||||||
var sessval = Session.get("modifying");
|
var sessval = Session.get("modifying");
|
||||||
@ -554,6 +559,27 @@ Template.profile.events({
|
|||||||
Session.set("confirmText", "Are you really sure?");
|
Session.set("confirmText", "Are you really sure?");
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0])
|
openDivFade(document.getElementsByClassName("overlay")[0])
|
||||||
document.getElementById("createdClasses").style.marginRight = "-40%";
|
document.getElementById("createdClasses").style.marginRight = "-40%";
|
||||||
|
},
|
||||||
|
'click #private' (event) {
|
||||||
|
Session.set("privateClass",true);
|
||||||
|
var input = document.getElementById("privateCode");
|
||||||
|
input.className = "";
|
||||||
|
input.placeholder = "Enter code here...";
|
||||||
|
document.getElementById("joinPrivClass").style.marginBottom = "0";
|
||||||
|
},
|
||||||
|
'click #privSubmit' () {
|
||||||
|
var input = document.getElementById("privateCode");
|
||||||
|
var code = input.value;
|
||||||
|
input.value = "";
|
||||||
|
Session.set("serverData", code);
|
||||||
|
Meteor.call("joinPrivateClass", code, function(error, result) {
|
||||||
|
if(result) {
|
||||||
|
document.getElementById("joinPrivClass").style.marginBottom = "-10%";
|
||||||
|
} else {
|
||||||
|
input.className = "formInvalid";
|
||||||
|
input.placeholder = "Invalid code.";
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -422,15 +422,16 @@ Meteor.methods({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
'joinPrivateClass': function(input) {
|
'joinPrivateClass': function(input) {
|
||||||
input.status = true;
|
var found = classes.findOne({status: true, privacy: true, code:input});
|
||||||
input.privacy = true;
|
var current = Meteor.user().profile;
|
||||||
var found = classes.findOne(input);
|
if (found !== undefined && input !== undefined &&
|
||||||
current = Meteor.user().profile;
|
|
||||||
if (found !== undefined && input.code !== undefined &&
|
|
||||||
current.classes.indexOf(found._id) === -1) {
|
current.classes.indexOf(found._id) === -1) {
|
||||||
classes.update({_id: found._id}, {$set: {subscribers: found.subscribers.concat(Meteor.userId())}});
|
classes.update({_id: found._id}, {$set: {subscribers: found.subscribers.concat(Meteor.userId())}});
|
||||||
current.concat(found._id);
|
current.classes = current.classes.concat(found._id);
|
||||||
Meteor.users.update({_id: Meteor.userId()}, {$set: {profile: current}});
|
Meteor.users.update({_id: Meteor.userId()}, {$set: {profile: current}});
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'leaveClass': function(change) {
|
'leaveClass': function(change) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user