All small fixes

This commit is contained in:
Kenneth Jao 2017-04-15 22:28:43 -04:00
parent 9af7fb3cf8
commit 2e9c02779e
9 changed files with 147 additions and 82 deletions

View File

@ -432,11 +432,12 @@ input {
} }
.classWrapper { .classWrapper {
width: 300px; width: 20vw;
height: 95%; height: 95%;
margin: 10px; margin: 10px;
margin-top: 20px; margin-top: 20px;
display: inline-block; display: inline-block;
position: relative;
vertical-align: top; vertical-align: top;
} }
@ -455,9 +456,8 @@ input {
} }
.mainClassName { .mainClassName {
font-size: 160%; font-size: 2vw;
white-space: normal; white-space: normal;
word-break: break-all;
-webkit-filter: none !important; -webkit-filter: none !important;
filter: none !important; filter: none !important;
@ -465,15 +465,18 @@ input {
} }
.mainClassHour { .mainClassHour {
font-size: 1.1vw;
margin-top: 0; margin-top: 0;
pointer-events: none; pointer-events: none;
} }
.mainClassTeacher { .mainClassTeacher {
font-size: 1.1vw;
pointer-events: none; pointer-events: none;
} }
.creWork { .creWork {
font-size: 1.1vw;
cursor: pointer; cursor: pointer;
box-shadow: 0px 5px 5px -2px #666; box-shadow: 0px 5px 5px -2px #666;
@ -494,7 +497,7 @@ input {
.workHolder { .workHolder {
width: 90% !important; width: 90% !important;
max-height: 71vh; max-height: 55.5vh;
padding: 5%; padding: 5%;
} }
@ -545,16 +548,16 @@ input {
} }
.cWorkCont { .cWorkCont {
font-size: .97vw;
padding: 5%; padding: 5%;
} }
.cWorkType { .cWorkType {
height: 5px; height: .3vw;
} }
.cWorkName { .cWorkName {
font-weight: 400; font-weight: 400;
font-size: 100%;
width: 50%; width: 50%;
margin-top: 0; margin-top: 0;

View File

@ -157,14 +157,14 @@
</div> </div>
<div id="userFunctions" style="background-color:{{divColor 'userDropdownColor'}}"> <div id="userFunctions" style="background-color:{{divColor 'userDropdownColor'}}">
{{#if admin}} {{#if admin}}
<div id="myprofile" class="userFunction" onclick="window.location='/admin';"> <div class="userFunction" onclick="window.location='/admin';">
<i class="fa fa-cogs" aria-hidden="true"></i> <i class="fa fa-cogs" aria-hidden="true"></i>
<p>Admin Panel</p> <p>Admin Panel</p>
</div> </div>
{{/if}} {{/if}}
</div> </div>
<div style="background-color:{{divColor 'userDropdownColor'}}"> <div style="background-color:{{divColor 'userDropdownColor'}}">
<div id="myprofile" class="userFunction" onclick="document.getElementById('login-buttons-logout').click();"> <div id="signout" class="userFunction">
<i class="fa fa-sign-out" aria-hidden="true"></i> <i class="fa fa-sign-out" aria-hidden="true"></i>
<p>Sign out</p> <p>Sign out</p>
</div> </div>

View File

@ -31,6 +31,8 @@ Session.set("classDispHover", null); // Stores current hovered class filter.
Session.set("restrictText", {}); // Stores text for comment character restriction. Session.set("restrictText", {}); // Stores text for comment character restriction.
Session.set("confirmText", ""); // Stores text for confirmations. Session.set("confirmText", ""); // Stores text for confirmations.
var dragging = false;
// On render actions // On render actions
Template.login.rendered = function() { Template.login.rendered = function() {
@ -72,37 +74,33 @@ Template.classesMode.rendered = function() {
}); });
$(".mainClass .slimScrollBar").css("display", "none"); $(".mainClass .slimScrollBar").css("display", "none");
// Classes mode drag scrolling var area = $("#classesMode");
var dX = 0; var clicked = false;
var currX = 0; var clickX = 0;
var area = new Hammer($("#classesMode")[0], {
domEvents: true
});
area.add(new Hammer.Pan({ threshold: 0 })); area.on({
'mousemove': function(e) {
area.on('panmove', function(e) { if(clicked) area.scrollLeft(area.scrollLeft() + (clickX - e.pageX)/25);
if(e.srcEvent.srcElement.className === "classInfo") { },
/*if(e.srcEvent.pageX <= .06*screen.width) { 'mousedown': function(e) {
dX = currX + 5; clicked = true;
$("#classesMode").scrollLeft(-dX); clickX = e.pageX;
return; },
} else if(e.srcEvent.pageX >= window.innerWidth-.06*screen.width) { 'mouseup': function() {
dX = currX + 5; clicked = false;
$("#classesMode").scrollLeft(dX);
return;
} else {
return;
}*/
return;
} }
dX = currX + e.deltaX;
$("#classesMode").scrollLeft(-dX);
}); });
area.on('panend', function(e) { /*if(dragging) {
currX = dX; var onLeft = e.pageX <= .1*screen.width;
}); var onRight = e.pageX >= (window.innerWidth-.1*screen.width);
console.log(onLeft);
if(onLeft) {
area.scrollLeft(area.scrollLeft() - 5);
} else if(onRight) {
area.scrollLeft(area.scrollLeft() + 5);
}
}*/
}; };
// Global Helpers // Global Helpers
@ -285,8 +283,11 @@ Template.main.helpers({
}, },
dayClick: function(date, jsEvent, view) { // On-click for each day. dayClick: function(date, jsEvent, view) { // On-click for each day.
if (jsEvent.target.className.includes("fc-past")) return; if (jsEvent.target.className.includes("fc-past")) return;
var realDate = date.format(); var realDate = date;
realDate = new Date(realDate[0], parseInt(realDate[1]) - 1, realDate[2], 11, 59, 59); date.seconds(59);
date.minutes(59);
date.hour(15);
realDate = realDate._d;
Session.set("newWork", true); Session.set("newWork", true);
Session.set("currentWork", {dueDate: realDate}); Session.set("currentWork", {dueDate: realDate});
if(!Session.equals("sidebarMode", "create")) toggleToSidebar("create"); if(!Session.equals("sidebarMode", "create")) toggleToSidebar("create");
@ -685,6 +686,11 @@ Template.main.events({
'click .cWorkBottom .fa-exclamation-triangle' (event) { 'click .cWorkBottom .fa-exclamation-triangle' (event) {
serverData = [event.target.parentNode.parentNode.parentNode.parentNode.getAttribute("workid"), "reports"] serverData = [event.target.parentNode.parentNode.parentNode.parentNode.getAttribute("workid"), "reports"]
sendData("toggleWork") sendData("toggleWork")
},
'click #signout' () {
$(".noScroll").velocity("fadeOut", 50);
Session.set('sidebarMode','');
document.getElementById('login-buttons-logout').click();
} }
}); });
@ -944,19 +950,23 @@ checkComplete = function(required, inputs) {
startDragula = function() { startDragula = function() {
dragula([document.querySelector('#classesMode'), document.querySelector('#nonexistant')], { dragula([document.querySelector('#classesMode'), document.querySelector('#nonexistant')], {
moves: function(el, container, handle) { moves: function(el, container, handle) {
// return handle.classList.contains("classInfo") || handle.classList.contains("mainClassName");
return _.intersection(["classInfo"], handle.classList).length > 0; return _.intersection(["classInfo"], handle.classList).length > 0;
} }
}) })
.on('out', function(el) { .on('drag', function() {
var els = document.getElementsByClassName("classWrapper"); dragging = true;
var final = []; })
for (var i = 0; i < els.length; i++) { .on('out', function(el) {
var classid = els[i].getElementsByClassName("creWork")[0].getAttribute("classid"); var els = document.getElementsByClassName("classWrapper");
final.push(classid); if($(els[0]).hasClass("gu-transit")) return;
} dragging = false;
Meteor.call("reorderClasses", final); var final = [];
}); for (var i = 0; i < els.length; i++) {
var classid = els[i].getElementsByClassName("creWork")[0].getAttribute("classid");
final.push(classid);
}
Meteor.call("reorderClasses", final);
});
}; };
myClasses = function() { myClasses = function() {

View File

@ -169,9 +169,11 @@
<span class="hour classText">Hour</span> <span class="hour classText">Hour</span>
<span class="subscriptions classText">Members</span> <span class="subscriptions classText">Members</span>
</div> </div>
{{#each myClasses}} <div id="classBody">
{{> classDisplay}} {{#each myClasses}}
{{/each}} {{> classDisplay}}
{{/each}}
</div>
</div> </div>
</div> </div>
<div id="colRight" style="background-color:{{divColor 'sidebarColor'}}"> <div id="colRight" style="background-color:{{divColor 'sidebarColor'}}">

View File

@ -276,6 +276,16 @@ Template.registerHelper("classSelected", () => {
return !Session.equals("classInfo", null); return !Session.equals("classInfo", null);
}); });
Template.manageClass.rendered = function() {
$("#classBody").slimScroll({
width: '100%',
height: '',
touchScrollStep: 60,
color: '#FFF',
railOpacity: 0.7
});
}
Template.manageClass.events({ Template.manageClass.events({
'click .classBox' (event) { 'click .classBox' (event) {
var classId = event.target.getAttribute("classid"); var classId = event.target.getAttribute("classid");
@ -330,6 +340,16 @@ Template.manageClass.events({
} }
}); });
Template.joinClass.rendered = function() {
$("#classBody").slimScroll({
width: '100%',
height: '',
touchScrollStep: 60,
color: '#FFF',
railOpacity: 0.7
});
}
Template.joinClass.helpers({ Template.joinClass.helpers({
classes() { // Loads all of the possible classes ( Limit of twenty shown ) ( Sorts by class size ) ( Only your school) classes() { // Loads all of the possible classes ( Limit of twenty shown ) ( Sorts by class size ) ( Only your school)
var array = classes.find({ var array = classes.find({

View File

@ -61,7 +61,7 @@ Template.mobile.rendered = function() {
Session.set("mobileMode", "main"); Session.set("mobileMode", "main");
$("#mobileBody").velocity("fadeIn", 200); $("#mobileBody").velocity("fadeIn", 200);
$("#mainCircleButton").velocity("fadeIn", 200); $("#mainCircleButton").velocity("fadeIn", 200);
timedPushback(); timedPushback(true);
} }
}); });
} }
@ -78,7 +78,7 @@ Template.mobile.rendered = function() {
$("#mainCircleButton").velocity("fadeIn", 200); $("#mainCircleButton").velocity("fadeIn", 200);
$("#mobileBody").velocity("fadeIn", 200); $("#mobileBody").velocity("fadeIn", 200);
Session.set("mobileMode", "main"); Session.set("mobileMode", "main");
timedPushback(); timedPushback(false);
} }
}); });
} }
@ -111,9 +111,15 @@ Template.mobile.rendered = function() {
} }
}); });
timedPushback(); timedPushback(true);
} }
Template.mobile.events({
'click #mOverlay' () {
toggleSidebar(false);
}
});
Template.defaultSidebar.rendered = function() { Template.defaultSidebar.rendered = function() {
addMobileButton($(".mSectionMode")[0], 0.2, "brightness", function() { addMobileButton($(".mSectionMode")[0], 0.2, "brightness", function() {
if(Session.equals("mobileMode", "main")) { if(Session.equals("mobileMode", "main")) {
@ -121,7 +127,7 @@ Template.defaultSidebar.rendered = function() {
} else { } else {
Session.set("mobileMode","main"); Session.set("mobileMode","main");
toggleSidebar(false); toggleSidebar(false);
timedPushback(); timedPushback(true);
} }
}); });
@ -131,7 +137,7 @@ Template.defaultSidebar.rendered = function() {
} else { } else {
Session.set("mobileMode","done"); Session.set("mobileMode","done");
toggleSidebar(false); toggleSidebar(false);
timedPushback(); timedPushback(true);
} }
}); });
@ -182,7 +188,7 @@ Template.defaultSidebar.rendered = function() {
addMobileButton($("#mDisableFilter")[0], -0.1, "brightness", function() { addMobileButton($("#mDisableFilter")[0], -0.1, "brightness", function() {
Session.set("typeFilter", []); Session.set("typeFilter", []);
Session.set("classDisp", []); Session.set("classDisp", []);
timedPushback(); timedPushback(true);
}); });
} }
@ -364,7 +370,7 @@ Template.mSidebarClasses.rendered = function() {
array.push(classid); array.push(classid);
} }
Session.set("classDisp", array); Session.set("classDisp", array);
timedPushback(); timedPushback(true);
} }
}); });
} }
@ -386,7 +392,7 @@ Template.mSideTypeFilter.rendered = function() {
array.push(type); array.push(type);
} }
Session.set("typeFilter", array); Session.set("typeFilter", array);
timedPushback(); timedPushback(true);
} }
}); });
} }
@ -490,7 +496,7 @@ Template.mEditWork.rendered = function() {
}); });
/*addMobileButton($("#mDelete"), 0.2, "brightness", function() { /*addMobileButton($("#mDelete"), 0.2, "brightness", function() {
})*/ })*/
} }
@ -669,21 +675,27 @@ function toggleSidebar(open) {
} }
} }
function timedPushback() { function timedPushback(type) {
var fadeTime = 10; var fadeTime = 10;
$(".mClassContainer").velocity("stop", true); $(".mClassContainer").velocity("stop", true);
$(".mClassContainer").velocity("fadeOut", fadeTime); if(!type) {
setTimeout(function() { setTimeout(function() {
$(".mClassContainer").velocity({left: "-150vw"}, 0); $(".mClassContainer").velocity({opacity: 1}, 0);
$(".mClassContainer").velocity("fadeIn", 0); }, fadeTime);
$(".mClassContainer").velocity({opacity: 1}, 0); } else {
var i = 0; $(".mClassContainer").velocity("fadeOut", fadeTime);
var timer = setInterval(function() { setTimeout(function() {
$($(".mClassContainer")[i]).velocity({left: ""}); $(".mClassContainer").velocity({left: "-150vw"}, 0);
if(i === $(".mClassContainer").length - 1) clearInterval(timer); $(".mClassContainer").velocity("fadeIn", 0);
i += 1; $(".mClassContainer").velocity({opacity: 1}, 0);
}, 100); var i = 0;
}, fadeTime); var timer = setInterval(function() {
$($(".mClassContainer")[i]).velocity({left: ""});
if(i === $(".mClassContainer").length - 1) clearInterval(timer);
i += 1;
}, 100);
}, fadeTime);
}
} }
mobileWork = function() { mobileWork = function() {

View File

@ -111,12 +111,27 @@
table-layout: fixed; table-layout: fixed;
} }
.mClassBox .fa { .mProfClassDelete {
font-size: 4vw; width: 9vw;
width: 2%; height: 9vw;
background-color: rgba(255,255,255,0.1);
display: table-cell; display: table-cell;
} }
.mClassBox .fa {
font-size: 4vw !important;
line-height: 9vw !important;
}
#mProfClass .mClassBox {
width: 94%;
padding: 2% 2% 2% 4%;
}
#mProfClass .name {
width: 48%;
}
#mProfClassTitle { #mProfClassTitle {
font-weight: 200; font-weight: 200;
width: 92%; width: 92%;

View File

@ -84,6 +84,8 @@
<span class="name classText">{{name}}</span> <span class="name classText">{{name}}</span>
<span class="teacher classText">{{teachershort}}</span> <span class="teacher classText">{{teachershort}}</span>
<span class="hour classText">{{hour}}</span> <span class="hour classText">{{hour}}</span>
<i class="fa fa-times" aria-hidden="true"></i> <div class="mProfClassDelete mCircleButton">
<i class="fa fa-times" aria-hidden="true" ></i>
</div>
</div> </div>
</template> </template>

View File

@ -243,10 +243,11 @@ Template.mClassDisplay.rendered = function() {
} }
Template.mClassDisplay2.rendered = function() { Template.mClassDisplay2.rendered = function() {
var div = this.firstNode.children[3]; let div = this.firstNode.children[3];
div.onclick = function() { addMobileButton(div, 0.1, "brightness", function() {
var newSetting = Session.get("profile"); console.log(div);
newSetting.classes.splice(newSetting.classes.indexOf(div.getAttribute("classid")),1) var newSetting = Session.get("profile");
Session.set("profile", newSetting); newSetting.classes.splice(newSetting.classes.indexOf(div.parentNode.getAttribute("classid")),1)
} Session.set("profile", newSetting);
});
} }