This commit is contained in:
Yaman Qalieh 2016-08-15 22:32:08 -04:00
commit 0d7ea51f0e
3 changed files with 131 additions and 50 deletions

View File

@ -20,7 +20,7 @@
font-weight: 400; font-weight: 400;
margin: 0; margin: 0;
margin-bottom: 1%; margin-bottom: 1%;
margin-right: 10%; margin-right: 30%;
} }
.profHea { .profHea {
@ -200,7 +200,7 @@
display: inline; display: inline;
} }
#profClassSearch { #profClassSearch, .userAddInput {
font-size: 125%; font-size: 125%;
width: 30%; width: 30%;
margin-top: 3%; margin-top: 3%;
@ -274,6 +274,19 @@
background-color: rgba(0,0,0,0.1); background-color: rgba(0,0,0,0.1);
} }
.owned {
background-color: #27646D;
-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;
}
.owned:hover {
background-color: #52848B;
}
.classText { .classText {
margin-left: .5%; margin-left: .5%;
margin-right: 10%; margin-right: 10%;
@ -311,17 +324,17 @@
margin-right: 5% !important; margin-right: 5% !important;
margin-bottom: 0 !important; margin-bottom: 0 !important;
position: relative; position: relative;
overflow: hidden !important;
} }
#create div { #formContainer div {
margin: 3% 6% 5% 6%; margin: 3% 6% 5% 6%;
width: 35%;
display: inline-block; display: inline-block;
} }
.creInput { .creInput {
font-size: 120%; font-size: 120%;
width: 100%;
padding: 3%; padding: 3%;
} }
@ -330,7 +343,8 @@
} }
.-autocomplete-container { .-autocomplete-container {
margin: 0.5% 0 0 0 !important; margin: 0 0 0 0 !important;
position: absolute;
display: none; display: none;
} }
@ -362,24 +376,7 @@
color: #999 !important; color: #999 !important;
} }
#save { #mainpage:hover {
font-size: 90%;
background-color: #CC4444;
box-shadow: -1px 2px 5px 1px #333;
position: absolute;
top: 0;
right: 10%;
z-index: 50;
-webkit-transition: transform 0.2s ease, background-color 0.1s ease;
-moz-transition: transform 0.2s ease, background-color 0.1s ease;
-ms-transition: transform 0.2s ease, background-color 0.1s ease;
transition: transform 0.2s ease, background-color 0.1s ease;
}
#save:hover, #mainpage:hover {
-webkit-transform: scale(1.05); -webkit-transform: scale(1.05);
-moz-transform: scale(1.05); -moz-transform: scale(1.05);
-ms-transform: scale(1.05); -ms-transform: scale(1.05);
@ -387,11 +384,7 @@
transform: scale(1.05); transform: scale(1.05);
} }
#save:active { #mainpage h2 {
background-color: #34CB34;
}
#save h2, #mainpage h2 {
font-weight: 200; font-weight: 200;
width: 100%; width: 100%;
padding: 8%; padding: 8%;
@ -421,3 +414,20 @@
background-color: #56708D; background-color: #56708D;
} }
#createdClasses {
width: 25%;
margin-right: -80%;
padding: 3%;
border-top: 5px solid #2E4F74;
box-shadow: -1px 2px 5px 1px #444;
position: absolute;
top: 30%;
right: 0;
-webkit-transition: margin 0.4s ease;
-moz-transition: margin 0.4s ease;
-ms-transition: margin 0.4s ease;
transition: margin 0.4s ease;
}

View File

@ -125,7 +125,7 @@
</div> </div>
</div> </div>
</div> </div>
<h3 id="creSubmit">Submit Request</h3> <h3 id="creSubmit">Submit Request</h3>
</form> </form>
{{/if}} {{/if}}
</div> </div>
@ -141,10 +141,34 @@
<i class="fa fa-times-circle-o" aria-hidden="true"></i> <i class="fa fa-times-circle-o" aria-hidden="true"></i>
</div> </div>
</div> </div>
<div id="createdClasses" style="background-color:{{divColor 'cards'}}">
<h3>{{selectedClass 'name'}}</h3>
<h4>Code: {{selectedClass 'code'}}</h4>
<div id="moderatorCont">
<div class="userAdder">
<h4>Moderators: </h4>
<i class="fa fa-plus" aria-hidden="true"></i>
</div>
{{#each selectedClass 'moderators'}}
{{> userDisplay}}
{{/each}}
</div>
<div id="blockEditCont">
<div class="userAdder">
<h4>View only: </h4>
<i class="fa fa-plus" aria-hidden="true"></i>
</div>
{{#each selectedClass 'blockEdit'}}
{{> userDisplay}}
{{/each}}
</div>
<div id="deleteClass">Delete Class</div>
</div>
</template> </template>
<template name="classDisplay"> <template name="classDisplay">
<div class="classBox" classid="{{_id}}"> <div class="classBox{{box}}" classid="{{_id}}">
<span class="name classText">{{name}}</span> <span class="name classText">{{name}}</span>
<span class="teacher classText">{{teacher}}</span> <span class="teacher classText">{{teacher}}</span>
<span class="hour classText">{{hour}}</span> <span class="hour classText">{{hour}}</span>
@ -152,6 +176,13 @@
</div> </div>
</template> </template>
<template name="userDisplay">
<div class="userBox" userid="{{_id}}">
<span class="email">{{email}}</span>
<span class="realname">{{name}}</span>
</div>
</template>
<template name="schoollist"> <template name="schoollist">
{{name}} {{name}}
</template> </template>

View File

@ -16,6 +16,8 @@ Session.set("confirm", null);
Session.set("serverData", null); Session.set("serverData", null);
Session.set("autocompleteDivs", null); Session.set("autocompleteDivs", null);
Session.set("confirmText", null); Session.set("confirmText", null);
Session.set("selectedClass",null);
Session.set("adding",null);
var themeColors = { var themeColors = {
"light": { "light": {
@ -95,9 +97,9 @@ 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;; 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;
currentprofile.avatar = pic currentprofile.avatar = pic
Meteor.call("editProfile", currentprofile); Meteor.call("editProfile", currentprofile);
@ -169,23 +171,14 @@ Template.profile.helpers({
autocompleteClasses() { autocompleteClasses() {
return Session.get("autocompleteDivs"); return Session.get("autocompleteDivs");
}, },
myclasses() {
if (Meteor.user().profile.classes === undefined || Meteor.user().profile.classes.length === 0) {
return [];
} else {
var array = [];
var courses = Meteor.user().profile.classes;
for(var i = 0; i < courses.length; i++) {
array.push(classes.findOne({_id:courses[i]}));
}
return array;
}
},
notfound() { notfound() {
return Session.get("notfound"); return Session.get("notfound");
}, },
confirmText() { confirmText() {
return Session.get("confirmText"); return Session.get("confirmText");
},
selectedClass(val) {
return Session.get("selectedClass")[val];
} }
}); });
@ -243,14 +236,14 @@ Template.profile.events({
'click' (event) { 'click' (event) {
var sessval = Session.get("modifying"); var sessval = Session.get("modifying");
if (event.target.id !== sessval && if (event.target.id !== sessval &&
event.target.id !== sessval + "a" && event.target.id !== sessval + "a" &&
!Session.equals("modifying", null) && !Session.equals("modifying", null) &&
!event.target.parentNode.className.includes("profOptions")) { !event.target.parentNode.className.includes("profOptions")) {
closeInput(sessval); closeInput(sessval);
} }
if (!event.target.className.includes("radio") && if (!event.target.className.includes("radio") &&
!Session.equals("radioDiv", null) && !Session.equals("radioDiv", null) &&
!event.target.parentNode.className.includes("profOptions") && !event.target.parentNode.className.includes("profOptions") &&
event.target.readOnly !== true) { event.target.readOnly !== true) {
var opnum = (parseInt(Session.get("radioDiv")) - parseInt(Session.get("radioOffset"))).toString(); var opnum = (parseInt(Session.get("radioDiv")) - parseInt(Session.get("radioOffset"))).toString();
for (var i = 0; i < document.getElementsByClassName("profOptions").length; i++) { for (var i = 0; i < document.getElementsByClassName("profOptions").length; i++) {
@ -261,6 +254,21 @@ Template.profile.events({
Session.set("radioDiv", null); Session.set("radioDiv", null);
Session.set("radioOffset", null); Session.set("radioOffset", null);
} }
if(event.target.className !== "userAddInput" &&
Session.get("adding")) {
var inputs = document.getElementsByClassName("userAddInput");
for(var i = 0; i < inputs.length; i++) {
try {
inputs[i].parentNode.removeChild(inputs[i]);
} catch(err) {}
}
Session.set("adding",false);
}
if(!document.getElementById("createdClasses").contains(event.target) &&
Session.get("selectedClass") !== null) {
document.getElementById("createdClasses").style.marginRight = "-40%";
setTimeout(function() { Session.set("selectedClass", null); }, 300);
}
}, },
'keydown' (event) { 'keydown' (event) {
var sessval = Session.get("modifying"); var sessval = Session.get("modifying");
@ -433,6 +441,38 @@ Template.profile.events({
}, },
'focus .op' (event) { 'focus .op' (event) {
event.target.click(); event.target.click();
},
'click .owned' (event) {
if (event.target.id === "label") return;
if (!event.target.className.includes("owned")) {
var attribute = event.target.parentNode.getAttribute("classid");
} else {
var attribute = event.target.getAttribute("classid");
}
var usertype = ["moderators","banned","blockEdit"];
var array = classes.findOne({_id:attribute});
if(array.code === "") array.code = "None";
for(var i = 0; i < usertype.length; i++) {
var users = array[usertype[i]];
for(var j = 0; j < users.length; j++) {
var detailusers = {};
var user = Meteor.users.findOne({_id:users[j]});
detailusers._id = user._id;
detailusers.email = user.name + "hi";
detailusers.name = user.name;
array[usertype[i]] = detailusers;
}
}
document.getElementById("createdClasses").style.marginRight = "0";
Session.set("selectedClass",array);
},
'click .userAdder .fa-plus' (event) {
if(Session.get("adding")) return;
var input = document.createElement("input");
input.className = "userAddInput";
event.target.parentNode.appendChild(input);
Session.set("adding", true);
} }
}); });