Added save settings button

This commit is contained in:
Kenneth Jao 2016-08-11 01:53:24 -04:00
parent 73c53370a4
commit 670e212543
4 changed files with 97 additions and 19 deletions

View File

@ -277,12 +277,6 @@ Template.main.events({
} }
}); });
Template.schoollist.helpers({
name() {
return this.name;
}
});
function openDivFade(div) { function openDivFade(div) {
div.style.display = "block"; div.style.display = "block";
div.style.opacity = "0"; div.style.opacity = "0";

View File

@ -29,6 +29,7 @@
#profPage { #profPage {
width: 100%; width: 100%;
padding-right: 10%;
overflow-x: hidden; overflow-x: hidden;
overflow-y: auto; overflow-y: auto;
} }
@ -284,3 +285,41 @@
color: #999 !important; color: #999 !important;
} }
#save {
font-size: 90%;
background-color: #CC4444;
box-shadow: -1px 2px 5px 1px #333;
position: absolute;
top: 0;
right: 10%;
z-index: 5;
-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 {
-webkit-transform: scale(1.05);
-moz-transform: scale(1.05);
-ms-transform: scale(1.05);
-o-transform: scale(1.05);
transform: scale(1.05);
}
#save:active {
background-color: #34CB34;
}
#save h2 {
font-weight: 200;
padding: 8%;
-webkit-filter: none;
filter: none !important;
}

View File

@ -1,5 +1,6 @@
<template name="profile"> <template name="profile">
<div id="profPage" style="background-color:{{divColor 'header'}};height:{{mainHeight}};"> <div id="profPage" style="background-color:{{divColor 'header'}};height:{{mainHeight}};">
<div id="save"><h2>Save Settings</h2></div>
<div id="profMainContainer" style="{{mainCenter}}"> <div id="profMainContainer" style="{{mainCenter}}">
<div id="profBanner" style="{{banner}};"></div> <div id="profBanner" style="{{banner}};"></div>
<div id="profAvatar" style="{{avatar}};{{avatarDim}}"></div> <div id="profAvatar" style="{{avatar}};{{avatarDim}}"></div>
@ -121,7 +122,7 @@
</div> </div>
<div class="overlay"> <div class="overlay">
<div class="overlayCont" style="{{overlayDim}};"> <div class="overlayCont" style="{{overlayDim}};">
<p>Join class?</p> <p>{{confirmText}}</p>
<i class="fa fa-check-circle-o" aria-hidden="true"></i> <i class="fa fa-check-circle-o" aria-hidden="true"></i>
<i class="fa fa-times-circle-o" aria-hidden="true"></i> <i class="fa fa-times-circle-o" aria-hidden="true"></i>
</div> </div>

View File

@ -8,6 +8,7 @@ Session.set("notsearching",true);
Session.set("confirm",null); Session.set("confirm",null);
Session.set("serverData",null); Session.set("serverData",null);
Session.set("autocompleteDivs", null); Session.set("autocompleteDivs", null);
Session.set("confirmText",null);
var themeColors = { var themeColors = {
"light": { "light": {
@ -25,19 +26,42 @@ var themeColors = {
Template.profile.helpers({ Template.profile.helpers({
classsettings: function() { classsettings: function() {
return { return {
position: "bottom", position: "bottom",
limit: 10, limit: 10,
rules: [ rules: [{
{ token: '',
token: '', collection: classes,
collection: classes, field: "name",
field: "name", template: Template.classDisplay,
template: Template.classDisplay, filter: {status: true}
filter: {status: true} }]
}
]
}; };
}, },
schoolcomplete() {
return {
position: "bottom",
limit: 6,
rules: [{
token: '',
collection: schools,
field: 'name',
matchAll: true,
template: Template.schoollist
}]
};
},
teachercomplete() {
return {
position: "bottom",
limit: 1,
rules: [{
token: '',
collection: classes,
field: 'teacher',
template: Template.teacherlist
}]
};
},
mainCenter() { mainCenter() {
var width = window.innerWidth * 1600/1920 + 10; var width = window.innerWidth * 1600/1920 + 10;
return "width:"+width.toString()+"px;margin-left:"+-.5*width.toString()+"px"; return "width:"+width.toString()+"px;margin-left:"+-.5*width.toString()+"px";
@ -123,6 +147,9 @@ Template.profile.helpers({
}, },
myclasses() { myclasses() {
return Meteor.user().profile.classes; return Meteor.user().profile.classes;
},
confirmText() {
return Session.get("confirmText");
} }
}) })
@ -292,6 +319,7 @@ Template.profile.events({
}, 200); }, 200);
Session.set("serverData",[event.target.getAttribute("classid"),""]); Session.set("serverData",[event.target.getAttribute("classid"),""]);
Session.set("confirm","joinClass"); Session.set("confirm","joinClass");
Session.set("confirmText","Join class?");
}, },
'click .fa-check-circle-o' () { 'click .fa-check-circle-o' () {
sendData(Session.get("confirm")); sendData(Session.get("confirm"));
@ -305,6 +333,16 @@ Template.profile.events({
Session.set("serverData",null); Session.set("serverData",null);
Session.set("confirm",null); Session.set("confirm",null);
}, },
'click #save' () {
openDivFade(document.getElementsByClassName("overlay")[0]);
setTimeout(function() {
document.getElementsByClassName("overlay")[0].style.opacity = "1";
}, 200);
getProfileData();
Session.set("serverData",getProfileData());
Session.set("confirm","editProfile");
Session.set("confirmText", "Save new profile settings?");
}
}) })
function openDivFade(div) { function openDivFade(div) {
@ -341,4 +379,10 @@ function closeInput(sessval) {
function sendData(funcName) { function sendData(funcName) {
Meteor.call(funcName,Session.get("serverData")); Meteor.call(funcName,Session.get("serverData"));
}
function getProfileData() {
var desc = document.getElementById("motd").childNodes[0].nodeValue;
var school = document.getElementById("school").childNodes[0].nodeValue;
var grade = document.getElementById("grade").childNodes[0].nodeValue;
} }