add basework of new profile page
This commit is contained in:
parent
aefcaaf21e
commit
00abcf7ce6
@ -1,627 +0,0 @@
|
|||||||
#profWrapper {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
overflow-x: auto;
|
|
||||||
overflow-y: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profTitle {
|
|
||||||
font-size: 1.5vw;
|
|
||||||
font-weight: 400;
|
|
||||||
margin: 0;
|
|
||||||
margin-bottom: 1%;
|
|
||||||
margin-right: 30%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profHea {
|
|
||||||
margin: 0;
|
|
||||||
font-size: 2vw;
|
|
||||||
font-weight: 200;
|
|
||||||
padding: 6% 6% 0 8%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profPage {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
overflow-x: hidden;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profMainContainer {
|
|
||||||
width: 85%;
|
|
||||||
height: auto;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profTop {
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profBanner {
|
|
||||||
width: 100%;
|
|
||||||
margin: 0;
|
|
||||||
border-left: 5px solid #0D0D0D;
|
|
||||||
border-right: 5px solid #0D0D0D;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profAvatar {
|
|
||||||
height: 45%;
|
|
||||||
|
|
||||||
border: 7px solid #0D0D0D;
|
|
||||||
-moz-border-radius: 50%;
|
|
||||||
-webkit-border-radius: 50%;
|
|
||||||
border-radius: 50%;
|
|
||||||
|
|
||||||
position: absolute;
|
|
||||||
bottom: -6.5%;
|
|
||||||
left: 1.5%;
|
|
||||||
z-index: 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
#motdBox, #motdBoxuser {
|
|
||||||
width: 100%;
|
|
||||||
height: 5%;
|
|
||||||
margin-top: -0.5vh;
|
|
||||||
padding: 0.5% 0 0.5% 0;
|
|
||||||
|
|
||||||
background-color: #0D0D0D;
|
|
||||||
|
|
||||||
border-left: 5px solid #0D0D0D;
|
|
||||||
border-right: 5px solid #0D0D0D;
|
|
||||||
}
|
|
||||||
|
|
||||||
#motdBoxuser {
|
|
||||||
font-size: 1.2vw;
|
|
||||||
padding: 0.7% 0 0.7% 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#motdBox span {
|
|
||||||
font-size: 1.5vw !important;
|
|
||||||
margin: 0;
|
|
||||||
color: #FFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
#motdBox input {
|
|
||||||
width: 50% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#description {
|
|
||||||
font-size: 1.5vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
#description:hover {
|
|
||||||
background-color: rgba(255,255,255,0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.username {
|
|
||||||
margin-left: 22% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.smallText p {
|
|
||||||
font-size: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profCards {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
margin-top: 3%;
|
|
||||||
margin-bottom: 3%;
|
|
||||||
|
|
||||||
border-left: 5px solid transparent;
|
|
||||||
border-right: 5px solid transparent;
|
|
||||||
|
|
||||||
display: table;
|
|
||||||
table-layout: fixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
#cardColLeft, #cardColRight {
|
|
||||||
height: 100%;
|
|
||||||
display: table-cell;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
|
|
||||||
#cardColLeft {
|
|
||||||
width: 39.6%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#cardColRight {
|
|
||||||
width: 60%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card {
|
|
||||||
width: 95%;
|
|
||||||
margin-bottom: 9%;
|
|
||||||
box-shadow: 2px 2px 5px 3px #666;
|
|
||||||
text-align: left;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profWrapper .clickModify span {
|
|
||||||
width: 80%;
|
|
||||||
padding: 3.5% 5% 3.5% 5%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profWrapper .clickModify, #profWrapper .optionHolder {
|
|
||||||
width: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profInfo {
|
|
||||||
margin-left: 0;
|
|
||||||
border-top: 5px solid #CC4444;
|
|
||||||
}
|
|
||||||
|
|
||||||
#about, #preferences {
|
|
||||||
padding: 3% 5% 7% 14%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#classes {
|
|
||||||
padding: 3% 5% 7% 7%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profClasses {
|
|
||||||
height: 70%;
|
|
||||||
margin-right: 0;
|
|
||||||
border-top: 5px solid #2E4F74;
|
|
||||||
|
|
||||||
float: right;
|
|
||||||
|
|
||||||
-webkit-transition: height 0.5s ease;
|
|
||||||
-moz-transition: height 0.5s ease;
|
|
||||||
-ms-transition: height 0.5s ease;
|
|
||||||
transition: height 0.5s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profClassInfoHolder {
|
|
||||||
-webkit-transition: opacity 0.4s ease;
|
|
||||||
-moz-transition: opacity 0.4s ease;
|
|
||||||
-ms-transition: opacity 0.4s ease;
|
|
||||||
transition: opacity 0.4s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profFunctions {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profFunction {
|
|
||||||
font-size: 1.2vw;
|
|
||||||
margin-right: 1%;
|
|
||||||
padding: 0.7vw;
|
|
||||||
|
|
||||||
border: 2px solid rgba(0,0,0,0.2);
|
|
||||||
|
|
||||||
display: inherit;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
.profFunction:hover {
|
|
||||||
background-color: rgba(0,0,0,0.1);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.profFunction i, .profFunction h4 {
|
|
||||||
padding: 1% !important;
|
|
||||||
font-size: 1.2vw !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#searchBar {
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
|
|
||||||
#profClassSearch {
|
|
||||||
font-size: 1.5vw;
|
|
||||||
width: 30%;
|
|
||||||
margin-top: 3%;
|
|
||||||
padding: 1%;
|
|
||||||
|
|
||||||
-webkit-animation: expand .7s ease 1;
|
|
||||||
animation: expand .7s ease 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.noScroll .-autocomplete-container {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
@-webkit-keyframes expand {
|
|
||||||
0% { width: 0%; }
|
|
||||||
100% { width: 30%; }
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes expand {
|
|
||||||
0% { width: 0%; }
|
|
||||||
100% { width: 30%; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#joinTop .fa-search {
|
|
||||||
font-size: 1.3vw;
|
|
||||||
margin-right: 3%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#private {
|
|
||||||
font-size: 1.5vw;
|
|
||||||
margin-left: 5%;
|
|
||||||
padding: 1.5%;
|
|
||||||
|
|
||||||
background-color: rgba(0,0,0,0.2);
|
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#creRules {
|
|
||||||
margin: 5%;
|
|
||||||
margin-bottom: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#create {
|
|
||||||
padding: 5%;
|
|
||||||
padding-top: 1%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#formContainer {
|
|
||||||
margin: 2% 5% 0 5% !important;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
#formContainer .clickModify {
|
|
||||||
background-color: #EBEBEB;
|
|
||||||
border: 1px solid #CECECE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#formContainer .optionText:hover {
|
|
||||||
box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.formDiv {
|
|
||||||
margin: 3% 6% 5% 6%;
|
|
||||||
width: 35%;
|
|
||||||
position: relative;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.formDiv input {
|
|
||||||
width: 90%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#formContainer .optionHolder {
|
|
||||||
width: 96%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.creInput {
|
|
||||||
font-size: 2vh;
|
|
||||||
padding: 3%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.classDropdown {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.formDiv .-autocomplete-container {
|
|
||||||
margin: 0 0 0 0 !important;
|
|
||||||
position: absolute;
|
|
||||||
display: inherit !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#creSubmit {
|
|
||||||
font-weight: 200;
|
|
||||||
font-size: 1.5vw;
|
|
||||||
width: 13vw;
|
|
||||||
margin: auto;
|
|
||||||
padding: 2%;
|
|
||||||
|
|
||||||
background-color: rgba(0,0,0,0.25);
|
|
||||||
text-align: center;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#creSubmit:hover {
|
|
||||||
background-color: rgba(0,0,0,0.15);
|
|
||||||
}
|
|
||||||
|
|
||||||
#restrict {
|
|
||||||
font-size: 100%;
|
|
||||||
font-style: italic;
|
|
||||||
font-weight: 300;
|
|
||||||
padding-left: 1%;
|
|
||||||
color: #999 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#mainpage, #logout2 {
|
|
||||||
font-size: 1vw;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0.8%;
|
|
||||||
background-color: #617C9E;
|
|
||||||
|
|
||||||
box-shadow: -1px 2px 5px 1px #333;
|
|
||||||
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 10%;
|
|
||||||
z-index: 50;
|
|
||||||
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
-webkit-transition: background-color 0.1s ease;
|
|
||||||
-moz-transition: background-color 0.1s ease;
|
|
||||||
-ms-transition: background-color 0.1s ease;
|
|
||||||
transition: background-color 0.1s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
#mainpage:hover {
|
|
||||||
background-color: #56708D;
|
|
||||||
}
|
|
||||||
|
|
||||||
#logout2:hover {
|
|
||||||
background-color: #C84949;
|
|
||||||
}
|
|
||||||
|
|
||||||
#logout2 {
|
|
||||||
background-color: #DE5050;
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 85%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#mainpage h2, #logout2 h2 {
|
|
||||||
font-weight: 200;
|
|
||||||
width: 100%;
|
|
||||||
margin: 0;
|
|
||||||
|
|
||||||
-webkit-filter: none;
|
|
||||||
filter: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#createdClasses {
|
|
||||||
width: 600px;
|
|
||||||
height: 73vh;
|
|
||||||
padding: 30px 0 30px 30px;
|
|
||||||
|
|
||||||
border-top: 5px solid #27646D;
|
|
||||||
box-shadow: -1px 2px 5px 1px #444;
|
|
||||||
|
|
||||||
position: absolute;
|
|
||||||
top: 10vh;
|
|
||||||
|
|
||||||
-webkit-transition: right 0.4s ease;
|
|
||||||
-moz-transition: right 0.4s ease;
|
|
||||||
-ms-transition: right 0.4s ease;
|
|
||||||
transition: right 0.4s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
#code {
|
|
||||||
font-size: 120%;
|
|
||||||
width: 30%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#codetext {
|
|
||||||
width: 15% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#copy, #deleteClass {
|
|
||||||
width: auto !important;
|
|
||||||
margin-left: 1%;
|
|
||||||
padding: 2% !important;
|
|
||||||
|
|
||||||
background-color: rgba(0,0,0,0.2);
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
#copy:hover, #deleteClass:hover {
|
|
||||||
background-color: rgba(0,0,0,0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.userAddInput {
|
|
||||||
font-size: 100%;
|
|
||||||
width: 50%;
|
|
||||||
padding: 2%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#createdClasses h3 {
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 200%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#createdClasses h4 {
|
|
||||||
font-size: 2.5vh;
|
|
||||||
width: 8vw;
|
|
||||||
padding-right: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#createdClasses .fa-plus {
|
|
||||||
margin: 1% 0 0 1%;
|
|
||||||
padding: 1vh;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
-webkit-transition: color 0.4s ease;
|
|
||||||
-moz-transition: color 0.4s ease;
|
|
||||||
-ms-transition: color 0.4s ease;
|
|
||||||
transition: color 0.4s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
#createdClasses .fa-plus:hover {
|
|
||||||
color: #519C39;
|
|
||||||
}
|
|
||||||
|
|
||||||
#moderatorCont, #bannedCont {
|
|
||||||
margin-bottom: 3%;
|
|
||||||
}
|
|
||||||
.userHolder {
|
|
||||||
width: 100%;
|
|
||||||
margin-left: 5%;
|
|
||||||
padding: 2%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.userBox {
|
|
||||||
font-size: 100%;
|
|
||||||
width: 80%;
|
|
||||||
margin-bottom: 1.5%;
|
|
||||||
padding: 2%;
|
|
||||||
|
|
||||||
box-shadow: 1px 1px 5px 1px #666;
|
|
||||||
display: table;
|
|
||||||
}
|
|
||||||
|
|
||||||
.email, .realname {
|
|
||||||
margin-right: 5%;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.email:hover, .realname:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
.classBox .fa-times {
|
|
||||||
font-size: 110% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.userBox .fa-times, .classBox .fa-times {
|
|
||||||
font-size: 150%;
|
|
||||||
|
|
||||||
-webkit-transition: color 0.4s ease;
|
|
||||||
-moz-transition: color 0.4s ease;
|
|
||||||
-ms-transition: color 0.4s ease;
|
|
||||||
transition: color 0.4s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.userBox .fa-times:hover, .classBox .fa-times:hover {
|
|
||||||
color: #CC4444;
|
|
||||||
}
|
|
||||||
|
|
||||||
#deleteClass {
|
|
||||||
font-size: 3vh;
|
|
||||||
width: 28% !important;
|
|
||||||
margin: auto !important;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
#changeAdmin {
|
|
||||||
margin-bottom: 3%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#changeAdmin span {
|
|
||||||
font-size: 90%;
|
|
||||||
padding: 3%;
|
|
||||||
|
|
||||||
background-color: rgba(0,0,0,0.2);
|
|
||||||
display: inline-block;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
#changeAdmin span:hover {
|
|
||||||
background-color: rgba(0,0,0,0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
#changeAdmin input {
|
|
||||||
font-size: 100%;
|
|
||||||
width: 50%;
|
|
||||||
margin-left: 3%;
|
|
||||||
margin-right: 5%;
|
|
||||||
padding: 2%;
|
|
||||||
|
|
||||||
-webkit-animation: expand2 .7s ease 1;
|
|
||||||
animation: expand2 .7s ease 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
@-webkit-keyframes expand2 {
|
|
||||||
0% { width: 0%; }
|
|
||||||
100% { width: 50%; }
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes expand2 {
|
|
||||||
0% { width: 0%; }
|
|
||||||
100% { width: 50%; }
|
|
||||||
}
|
|
||||||
|
|
||||||
.fa-exchange {
|
|
||||||
padding: 0 !important;
|
|
||||||
|
|
||||||
-webkit-transition: color 0.4s ease;
|
|
||||||
-moz-transition: color 0.4s ease;
|
|
||||||
-ms-transition: color 0.4s ease;
|
|
||||||
transition: color 0.4s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.fa-exchange:hover {
|
|
||||||
color: #CC4444;
|
|
||||||
}
|
|
||||||
|
|
||||||
#joinPrivClass {
|
|
||||||
width: 200px;
|
|
||||||
height: 110px;
|
|
||||||
padding: 20px;
|
|
||||||
|
|
||||||
border-top: 5px solid #852E6D;
|
|
||||||
box-shadow: -2px 0px 5px 1px #444;
|
|
||||||
|
|
||||||
position: absolute;
|
|
||||||
right: 5vw;
|
|
||||||
|
|
||||||
-webkit-transition: bottom 0.4s ease;
|
|
||||||
-moz-transition: bottom 0.4s ease;
|
|
||||||
-ms-transition: bottom 0.4s ease;
|
|
||||||
transition: bottom 0.4s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
#joinPrivClass h3 {
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 150%;
|
|
||||||
margin-bottom: 1vh;
|
|
||||||
}
|
|
||||||
|
|
||||||
#privateCode {
|
|
||||||
font-size: 3vh;
|
|
||||||
width: 93%;
|
|
||||||
margin-top: 1%;
|
|
||||||
margin-bottom: 1vh;
|
|
||||||
padding: 1%;
|
|
||||||
}
|
|
||||||
|
|
||||||
#privSubmit {
|
|
||||||
font-size: 2vh;
|
|
||||||
margin-left: 5%;
|
|
||||||
padding: 3%;
|
|
||||||
background-color: rgba(0,0,0,0.2);
|
|
||||||
float: right;
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
#profPreferences {
|
|
||||||
border-top: 5px solid #409333;
|
|
||||||
}
|
|
||||||
@ -1,310 +1,12 @@
|
|||||||
<template name="profile">
|
<template name="profile">
|
||||||
{{> sAlert}}
|
{{> sAlert}}
|
||||||
<div class="noScroll">
|
<div id="schoolgrade">
|
||||||
<div id="mainpage{{userProfile}}"><h2>Main Page</h2></div>
|
<!-- SCHOOL INPUT -->
|
||||||
<div id="logout2" onclick='document.getElementById("login-buttons-logout").click();'><h2>Logout</h2></div>
|
<!-- GRAD YEAR INPUT -->
|
||||||
<div id="profWrapper">
|
</div>
|
||||||
<div id="profPage" style="background-color:{{divColor 'mainColor'}};min-width:{{textColor}}{{loadNew}}">
|
<button id="schoolnext" {{schoolgradenext}}>Next</button>
|
||||||
<div id="profMainContainer">
|
<div id="classsection" style="display:none;">
|
||||||
<div id="profTop">
|
<!-- CLASS ENROLLMENT + CREATE -->
|
||||||
<img id="profBanner" src='{{banner}}' alt="Banner">
|
</div>
|
||||||
<img id="profAvatar" src='{{avatar}}' alt="Avatar">
|
<button>Finish</button>
|
||||||
<div id="motdBox">
|
|
||||||
<span class="username">{{username}} - </span>
|
|
||||||
<input id="description" class="clickModify restrict" style="color:#fff" value="{{description}}" maxLength="50">
|
|
||||||
<span class="resText">{{restrict 'description'}}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="profCards">
|
|
||||||
<div id="cardColLeft">
|
|
||||||
<!-- Card 1 -->
|
|
||||||
<div id="profInfo" class="card" style="background-color:{{divColor 'secondaryColor'}}">
|
|
||||||
<h3 class="profHea">About</h3>
|
|
||||||
<div id="about">
|
|
||||||
<div class="prefWrapper">
|
|
||||||
<p class="profTitle">School Name:</p>
|
|
||||||
<div id="school" class="clickModify dropdown" tabindex="1">
|
|
||||||
<span>{{school}}</span>
|
|
||||||
<i class="fa fa-caret-down" aria-hidden="true"></i>
|
|
||||||
</div>
|
|
||||||
<div class="optionHolder smallText">
|
|
||||||
{{#each selectOptions 'school'}}
|
|
||||||
{{> option}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
<div class="prefWrapper">
|
|
||||||
<p class="profTitle">Graduation Year:</p>
|
|
||||||
<div id="grade" class="clickModify dropdown" tabindex="2">
|
|
||||||
<span>{{grade}}</span>
|
|
||||||
<i class="fa fa-caret-down" aria-hidden="true"></i>
|
|
||||||
</div>
|
|
||||||
<div class="optionHolder">
|
|
||||||
{{#each selectOptions 'grade'}}
|
|
||||||
{{> option}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<!-- Card 2 -->
|
|
||||||
<div id="profPreferences" class="card" style="background-color:{{divColor 'secondaryColor'}}">
|
|
||||||
<h3 class="profHea">Preferences</h3>
|
|
||||||
<div id="preferences">
|
|
||||||
<div class="prefWrapper">
|
|
||||||
<p class="profTitle">Theme:</p>
|
|
||||||
<div id="theme" class="clickModify dropdown" tabindex="3">
|
|
||||||
<span>{{pref 'theme'}}</span>
|
|
||||||
<i class="fa fa-caret-down" aria-hidden="true"></i>
|
|
||||||
</div>
|
|
||||||
<div class="optionHolder">
|
|
||||||
{{#each selectOptions 'theme'}}
|
|
||||||
{{> option}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
<div class="prefWrapper">
|
|
||||||
<p class="profTitle">Default Mode:</p>
|
|
||||||
<div id="mode" class="clickModify dropdown" tabindex="4">
|
|
||||||
<span>{{pref 'mode'}}</span>
|
|
||||||
<i class="fa fa-caret-down" aria-hidden="true"></i>
|
|
||||||
</div>
|
|
||||||
<div class="optionHolder">
|
|
||||||
{{#each selectOptions 'mode'}}
|
|
||||||
{{> option}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
<div class="prefWrapper">
|
|
||||||
<p class="profTitle">Hide Homework:</p>
|
|
||||||
<div id="timeHide" class="clickModify dropdown" tabindex="5">
|
|
||||||
<span>{{pref 'timeHide'}}</span>
|
|
||||||
<i class="fa fa-caret-down" aria-hidden="true"></i>
|
|
||||||
</div>
|
|
||||||
<div class="optionHolder">
|
|
||||||
{{#each selectOptions 'timeHide'}}
|
|
||||||
{{> option}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
<div class="prefWrapper">
|
|
||||||
<p class="profTitle">Hide Done:</p>
|
|
||||||
<div id="done" class="clickModify dropdown" tabindex="6">
|
|
||||||
<span>{{pref 'done'}}</span>
|
|
||||||
<i class="fa fa-caret-down" aria-hidden="true"></i>
|
|
||||||
</div>
|
|
||||||
<div class="optionHolder">
|
|
||||||
{{#each selectOptions 'done'}}
|
|
||||||
{{> option}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
<div class="prefWrapper">
|
|
||||||
<p class="profTitle">Hide Reported:</p>
|
|
||||||
<div id="hideReport" class="clickModify dropdown" tabindex="7">
|
|
||||||
<span>{{pref 'hideReport'}}</span>
|
|
||||||
<i class="fa fa-caret-down" aria-hidden="true"></i>
|
|
||||||
</div>
|
|
||||||
<div class="optionHolder">
|
|
||||||
{{#each selectOptions 'hideReport'}}
|
|
||||||
{{> option}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="cardColRight">
|
|
||||||
<!-- Card 3 -->
|
|
||||||
<div id="profClasses" class="card" style="background-color:{{divColor 'secondaryColor'}};">
|
|
||||||
<h3 class="profHea">Classes</h3>
|
|
||||||
<div id="classes">
|
|
||||||
<div id="profFunctions">
|
|
||||||
<div class="profFunction manageClass">
|
|
||||||
<i class="fa fa-tasks" aria-hidden="true"></i>
|
|
||||||
<h4 style="color:{{profClassTabColor 'manClass'}}">Manage my Classes</h4>
|
|
||||||
</div>
|
|
||||||
<div class="profFunction addClass">
|
|
||||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
|
||||||
<h4 style="color:{{profClassTabColor 'addClass'}}">Join a Class</h4>
|
|
||||||
</div>
|
|
||||||
<div class="profFunction createClass">
|
|
||||||
<i class="fa fa-graduation-cap" aria-hidden="true"></i>
|
|
||||||
<h4 style="color:{{profClassTabColor 'creClass'}}">Create a Class</h4>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="profClassInfoHolder">
|
|
||||||
{{#if profClassTab "manClass"}}
|
|
||||||
<div id="label" class="classBox">
|
|
||||||
<span class="name classText">Class Name</span>
|
|
||||||
<span class="teacher classText">Teacher</span>
|
|
||||||
<span class="hour classText">Hour</span>
|
|
||||||
<span class="subscriptions classText">Members</span>
|
|
||||||
</div>
|
|
||||||
<div class="classHolder">
|
|
||||||
{{#each myClasses}}
|
|
||||||
{{> classDisplay}}
|
|
||||||
|
|
||||||
{{/each}}
|
|
||||||
{{#if noclass}}
|
|
||||||
<h3>No results found...</h3>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if profClassTab "addClass"}}
|
|
||||||
<div id="joinTop">
|
|
||||||
<i class="fa fa-search" aria-hidden="true"></i>
|
|
||||||
{{> inputAutocomplete id="profClassSearch" settings=classSettings placeholder="Search..."}}
|
|
||||||
<h4 id="private">Join Private Class</h4>
|
|
||||||
</div>
|
|
||||||
<div id="label" class="classBox">
|
|
||||||
<span class="name classText">Class Name</span>
|
|
||||||
<span class="teacher classText">Teacher</span>
|
|
||||||
<span class="hour classText">Hour</span>
|
|
||||||
<span class="subscriptions classText">Members</span>
|
|
||||||
</div>
|
|
||||||
<div class="classHolder">
|
|
||||||
{{#if notsearching}}
|
|
||||||
{{#each classes}}
|
|
||||||
{{> classDisplay}}
|
|
||||||
{{/each}}
|
|
||||||
{{#if noclass}}
|
|
||||||
<h3>No results found...</h3>
|
|
||||||
{{/if}}
|
|
||||||
{{else}}
|
|
||||||
{{#each autocompleteClasses}}
|
|
||||||
{{> classDisplay}}
|
|
||||||
{{/each}}
|
|
||||||
{{#if notfound}}
|
|
||||||
<h3>No results found...</h3>
|
|
||||||
{{/if}}
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
{{/if}}
|
|
||||||
|
|
||||||
{{#if profClassTab "creClass"}}
|
|
||||||
<div id="creRules"><p>Submit a request for a class to be approved by an administrator.</p></div>
|
|
||||||
<div id="formContainer">
|
|
||||||
<div class="formDiv">
|
|
||||||
<p class="profTitle">School:</p>
|
|
||||||
{{> inputAutocomplete settings=schoolComplete class="form-control creInput" type="text" name="school" placeholder="Example: International Academy" }}
|
|
||||||
</div>
|
|
||||||
<div class="formDiv">
|
|
||||||
<p class="profTitle">Hour:</p>
|
|
||||||
<input class="creInput" type="text">
|
|
||||||
</div>
|
|
||||||
<div class="formDiv">
|
|
||||||
<p class="profTitle">Teacher:</p>
|
|
||||||
{{> inputAutocomplete settings=teacherComplete class="form-control creInput" type="text" name="teacher" placeholder="Example: Woods" }}
|
|
||||||
</div>
|
|
||||||
<div class="formDiv">
|
|
||||||
<p class="profTitle">Class Name:</p>
|
|
||||||
<input class="creInput" type="text">
|
|
||||||
</div>
|
|
||||||
<div class="formDiv">
|
|
||||||
<p class="profTitle">Privacy:</p>
|
|
||||||
<input id="privacy" class="creInput clickModify dropdown" type="text" readonly>
|
|
||||||
<div class="optionHolder">
|
|
||||||
{{#each selectOptions 'privacy'}}
|
|
||||||
{{> option}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="formDiv">
|
|
||||||
<p class="profTitle">Category:</p>
|
|
||||||
<input id="category" class="creInput clickModify dropdown" type="text" readonly>
|
|
||||||
<div class="optionHolder">
|
|
||||||
{{#each selectOptions 'category'}}
|
|
||||||
{{> option}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<h3 id="creSubmit">Submit Request</h3>
|
|
||||||
{{/if}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="overlay">
|
|
||||||
<div class="overlayCont" style="background-color:{{divColor 'mainColor'}}">
|
|
||||||
<p>{{confirmText}}</p>
|
|
||||||
<div id="faCont">
|
|
||||||
<i class="fa fa-check-circle-o" aria-hidden="true"></i>
|
|
||||||
<i class="fa fa-times-circle-o" aria-hidden="true"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="createdClasses" style="background-color:{{divColor 'secondaryColor'}};right:{{ownedStatus}}" classid="{{selectedClass '_id'}}">
|
|
||||||
<h3>{{selectedClass 'name'}}</h3>
|
|
||||||
<h4 id="codetext">Code:</h4>
|
|
||||||
<input id="code" value="{{selectedClass 'code'}}" type="text" readonly>
|
|
||||||
{{#if code}}
|
|
||||||
<h4 id="copy">Copy Code</h4>
|
|
||||||
{{/if}}
|
|
||||||
<div id="moderatorCont">
|
|
||||||
<div class="userAdder">
|
|
||||||
<h4>Moderators:</h4>
|
|
||||||
<input class="userAddInput" type="text" placeholder="1234@abc.xyz">
|
|
||||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
|
||||||
</div>
|
|
||||||
<div class="userHolder">
|
|
||||||
{{#each selectedClass 'moderators'}}
|
|
||||||
{{> userDisplay}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="bannedCont">
|
|
||||||
<div class="userAdder">
|
|
||||||
<h4>Banned:</h4>
|
|
||||||
<input class="userAddInput" type="text" placeholder="1234@abc.xyz">
|
|
||||||
<i class="fa fa-plus" aria-hidden="true"></i>
|
|
||||||
</div>
|
|
||||||
<div class="userHolder">
|
|
||||||
{{#each selectedClass 'banned'}}
|
|
||||||
{{> userDisplay}}
|
|
||||||
{{/each}}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="changeAdmin">
|
|
||||||
<span>Change Owner</span>
|
|
||||||
</div>
|
|
||||||
<div id="deleteClass">Delete Class</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="joinPrivClass" style="background-color:{{divColor 'secondaryColor'}};bottom:{{privStatus}}">
|
|
||||||
<h3>Enter Code:</h3>
|
|
||||||
<input id="privateCode" type="text" placeholder="Enter code here...">
|
|
||||||
<h4 id="privSubmit">Submit</h4>
|
|
||||||
</div>
|
|
||||||
{{> loginButtons}}
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template name="userDisplay">
|
|
||||||
<div class="userBox" userid="{{_id}}">
|
|
||||||
<span class="email" onclick="window.location='/user/{{email}}'">{{email}}</span>
|
|
||||||
<span class="realname" onclick="window.location='/user/{{email}}'">{{name}}</span>
|
|
||||||
<i class="fa fa-times" aria-hidden="true"></i>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template name="schoolList">
|
|
||||||
{{name}}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template name="teacherList">
|
|
||||||
{{teacher}}
|
|
||||||
</template>
|
|
||||||
|
|
||||||
|
|||||||
@ -3,734 +3,19 @@ import {
|
|||||||
Template
|
Template
|
||||||
} from 'meteor/templating';
|
} from 'meteor/templating';
|
||||||
|
|
||||||
var openValues = {
|
|
||||||
"owned": "-650px",
|
|
||||||
"priv": "-160px"
|
|
||||||
};
|
|
||||||
|
|
||||||
confirm = null; // Sets function to execute after confirmation click.
|
|
||||||
|
|
||||||
// Sets up global variables
|
|
||||||
|
|
||||||
Session.set("profClassTab", "manClass"); // Set default classes card mode to 'Manage Classes.'
|
|
||||||
Session.set("owned", false); // Status of createdClasses.
|
|
||||||
Session.set("privClass", false); //Status of joinPrivClass.
|
|
||||||
Session.set("modifying", null); // Stores current open input.
|
|
||||||
Session.set("notsearching", true); // If user is searching in search box.
|
|
||||||
Session.set("autocompleteDivs", null); // Stores returned autocomplete results.
|
|
||||||
Session.set("confirmText", null); // Stores text for different confirmation functions.
|
|
||||||
Session.set("selectedClass", null); // Stores selected owned class info.
|
|
||||||
Session.set("code", null); // If owned class has a code.
|
|
||||||
Session.set("noclass", null); // If user doesn't have classes.
|
|
||||||
Session.set("notfound", null); // If no results for autocomplete.
|
|
||||||
|
|
||||||
Template.profile.helpers({
|
Template.profile.helpers({
|
||||||
/* themeName() {
|
schoolgradenext() {
|
||||||
var vals = _.values(themeColors);
|
if(_.contains([null, undefined, ""], Meteor.user().profile.school ||
|
||||||
var curtheme = Session.get("user").preferences.theme;
|
_.contains([null, undefined, ""], Meteor.user().profile.grade))) {
|
||||||
for (var i = 0; i < vals.length; i++) {
|
return "";
|
||||||
if (_.isEqual(vals[i], curtheme)) {
|
|
||||||
var name = _.keys(themeColors)[i];
|
|
||||||
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return "Custom";
|
|
||||||
},*/
|
|
||||||
classSettings() { // Returns autocomplete array for classes.
|
|
||||||
return {
|
|
||||||
position: "bottom",
|
|
||||||
limit: 10,
|
|
||||||
rules: [{
|
|
||||||
token: '',
|
|
||||||
collection: classes,
|
|
||||||
template: Template.classDisplay,
|
|
||||||
filter: {
|
|
||||||
privacy: false,
|
|
||||||
status: true
|
|
||||||
},
|
|
||||||
selector: (match) => {
|
|
||||||
regex = new RegExp(match, 'i');
|
|
||||||
return {
|
|
||||||
$or: [{
|
|
||||||
'name': regex
|
|
||||||
}, {
|
|
||||||
'teacher': regex
|
|
||||||
}, {
|
|
||||||
'hour': regex
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
},
|
|
||||||
schoolComplete() { // Returns autocomplete array for schools.
|
|
||||||
return {
|
|
||||||
position: "bottom",
|
|
||||||
limit: 6,
|
|
||||||
rules: [{
|
|
||||||
token: '',
|
|
||||||
collection: schools,
|
|
||||||
field: 'name',
|
|
||||||
matchAll: true,
|
|
||||||
template: Template.schoolList
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
},
|
|
||||||
teacherComplete() { // Returns autocomplete array for teachers.
|
|
||||||
return {
|
|
||||||
position: "bottom",
|
|
||||||
limit: 1,
|
|
||||||
rules: [{
|
|
||||||
token: '',
|
|
||||||
collection: classes,
|
|
||||||
field: 'teacher',
|
|
||||||
template: Template.teacherList
|
|
||||||
}]
|
|
||||||
};
|
|
||||||
},
|
|
||||||
banner() { // Returns banner
|
|
||||||
return Session.get("user").banner;
|
|
||||||
},
|
|
||||||
avatar() { // Returns avatar
|
|
||||||
return Meteor.user().services.google.picture;
|
|
||||||
},
|
|
||||||
username() { //Returns current user's username
|
|
||||||
return Session.get("user").name;
|
|
||||||
},
|
|
||||||
description() { // Returns the current user's description
|
|
||||||
if (Session.get("user").description !== undefined && Session.get("user").description !== null && Session.get("user").description !== "") return Session.get("user").description;
|
|
||||||
return "Say something about yourself!";
|
|
||||||
},
|
|
||||||
school() { // Returns the current user's school's name
|
|
||||||
if (!_.contains([null, undefined, ""], Session.get("user").school)) return Session.get("user").school;
|
|
||||||
return "Click here to edit...";
|
|
||||||
},
|
|
||||||
grade() { // Returns the current user's grade
|
|
||||||
if (Session.get("user").grade !== undefined &&
|
|
||||||
Session.get("user").grade !== null &&
|
|
||||||
Session.get("user").grade !== "") return (Session.get("user").grade === 0) ? "Faculty" : Session.get("user").grade;
|
|
||||||
return "Click here to edit...";
|
|
||||||
},
|
|
||||||
classes() { // Loads all of the possible classes ( Limit of twenty shown ) ( Sorts by class size ) ( Only your school)
|
|
||||||
var array = classes.find({
|
|
||||||
status: {
|
|
||||||
$eq: true
|
|
||||||
},
|
|
||||||
privacy: {
|
|
||||||
$eq: false
|
|
||||||
},
|
|
||||||
_id: {
|
|
||||||
$nin: Session.get("user").classes
|
|
||||||
},
|
|
||||||
school: {
|
|
||||||
$eq: Session.get("user").school
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
sort: {
|
|
||||||
subscribers: -1
|
|
||||||
}
|
|
||||||
}, {
|
|
||||||
limit: 20
|
|
||||||
}).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 {
|
} else {
|
||||||
Session.set("noclass", false);
|
return "disabled";
|
||||||
}
|
}
|
||||||
return array;
|
|
||||||
},
|
|
||||||
ownedStatus() { // Status of createdClasses
|
|
||||||
if (!Session.get("owned")) return openValues.owned;
|
|
||||||
return "0px";
|
|
||||||
},
|
|
||||||
privStatus() {
|
|
||||||
if (!Session.get("privClass")) return openValues.priv;
|
|
||||||
return "0px";
|
|
||||||
},
|
|
||||||
profClassTabColor(status) { // Change this [Supposed to show the current mode that's selected via color]
|
|
||||||
if (Session.equals("profClassTab", status)) {
|
|
||||||
return Meteor.user().profile.preferences.theme.modeHighlight;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
profClassTab(tab) { // Tells current class
|
|
||||||
if (Session.equals("profClassTab", tab)) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
notsearching() { // Tells whether user is using the searchbox
|
|
||||||
return Session.get("notsearching");
|
|
||||||
},
|
|
||||||
autocompleteClasses() { // Returns current auto-completes for classes
|
|
||||||
return Session.get("autocompleteDivs");
|
|
||||||
},
|
|
||||||
notfound() { // Returns if autocomplete has no results.
|
|
||||||
return Session.get("notfound");
|
|
||||||
},
|
|
||||||
noclass() { // Returns if user has classes.
|
|
||||||
return Session.get("noclass");
|
|
||||||
},
|
|
||||||
confirmText() { // Returns respective text for different confirm functions.
|
|
||||||
return Session.get("confirmText");
|
|
||||||
},
|
|
||||||
selectedClass(val) { // Returns values for selectedClass
|
|
||||||
if (Session.equals("selectedClass", null)) return;
|
|
||||||
return Session.get("selectedClass")[val];
|
|
||||||
},
|
|
||||||
code() { // Returns if selected class has code.
|
|
||||||
return Session.get("code");
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.profile.events({
|
Template.profile.events({
|
||||||
'click' (event) { // Whenever a click happens'
|
'click #schoolnext' () {
|
||||||
var e = event.target.className;
|
// Animation to display class section
|
||||||
if (modifyingInput !== null && event.target !== document.getElementById(modifyingInput)) {
|
|
||||||
if (!(e.includes("optionHolder") || e.includes("optionText"))) {
|
|
||||||
if (document.getElementById(modifyingInput).className.includes("dropdown")) {
|
|
||||||
$(".optionHolder")
|
|
||||||
.fadeOut(250, "linear");
|
|
||||||
|
|
||||||
$(".selectedOption").removeClass("selectedOption");
|
|
||||||
} else {
|
|
||||||
if (modifyingInput === "description") {
|
|
||||||
Session.set("restrictText", {});
|
|
||||||
$("#" + modifyingInput).css('cursor', 'pointer');
|
|
||||||
var newSetting = Session.get("user");
|
|
||||||
newSetting[modifyingInput] = document.getElementById(modifyingInput).value;
|
|
||||||
serverData = newSetting;
|
|
||||||
sendData("editProfile");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
modifyingInput = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!document.getElementById("createdClasses").contains(event.target) &&
|
|
||||||
!Session.equals("code", null) &&
|
|
||||||
!event.target.className.includes("fa-times-circle-o")) {
|
|
||||||
Session.set("owned", false);
|
|
||||||
}
|
|
||||||
if (Session.get("changeAdmin") &&
|
|
||||||
!document.getElementById("changeAdmin").contains(event.target)) {
|
|
||||||
Session.set("changeAdmin", false);
|
|
||||||
var div = document.getElementById("changeAdmin");
|
|
||||||
div.removeChild(div.childNodes[3]);
|
|
||||||
div.removeChild(div.childNodes[3]);
|
|
||||||
}
|
|
||||||
if (Session.get("privClass") &&
|
|
||||||
!(event.target.id === "private") &&
|
|
||||||
!document.getElementById("joinPrivClass").contains(event.target)) {
|
|
||||||
Session.set("privClass", false);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// MAIN BUTTONS
|
|
||||||
'click #mainpage' () {
|
|
||||||
if (!Meteor.userId() || _.contains([null, undefined, ""], Meteor.user().profile.school)) {
|
|
||||||
sAlert.closeAll();
|
|
||||||
sAlert.error('Please fill in your profile!', {
|
|
||||||
effect: 'stackslide',
|
|
||||||
position: 'top'
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
window.location = '/';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'click .addClass' () {
|
|
||||||
if (Session.equals("profClassTab", "addClass")) return;
|
|
||||||
var functionHolder = document.getElementById("profClassInfoHolder");
|
|
||||||
closeDivFade(functionHolder);
|
|
||||||
var div = document.getElementById("profClasses");
|
|
||||||
div.style.height = "50%";
|
|
||||||
setTimeout(function() {
|
|
||||||
Session.set("profClassTab", "addClass");
|
|
||||||
div.style.height = "70%";
|
|
||||||
openDivFade(functionHolder);
|
|
||||||
}, 400);
|
|
||||||
},
|
|
||||||
'click .manageClass' () {
|
|
||||||
if (Session.equals("profClassTab", "manClass")) return;
|
|
||||||
var functionHolder = document.getElementById("profClassInfoHolder");
|
|
||||||
closeDivFade(functionHolder);
|
|
||||||
var div = document.getElementById("profClasses");
|
|
||||||
div.style.height = "50%";
|
|
||||||
setTimeout(function() {
|
|
||||||
Session.set("profClassTab", "manClass");
|
|
||||||
div.style.height = "70%";
|
|
||||||
openDivFade(functionHolder);
|
|
||||||
}, 400);
|
|
||||||
},
|
|
||||||
'click .createClass' () {
|
|
||||||
if (Session.equals("profClassTab", "creClass")) return;
|
|
||||||
var functionHolder = document.getElementById("profClassInfoHolder");
|
|
||||||
closeDivFade(functionHolder);
|
|
||||||
var div = document.getElementById("profClasses");
|
|
||||||
div.style.height = "50%";
|
|
||||||
setTimeout(function() {
|
|
||||||
Session.set("profClassTab", "creClass");
|
|
||||||
div.style.height = "70%";
|
|
||||||
openDivFade(functionHolder);
|
|
||||||
}, 400);
|
|
||||||
},
|
|
||||||
'click .classBox' (event) { // When you click on a box that holds class
|
|
||||||
if (event.target.id === "label" ||
|
|
||||||
Session.equals("profClassTab", "manClass") ||
|
|
||||||
event.target.className.includes("fa-times")) return;
|
|
||||||
|
|
||||||
if (event.target.className !== "classBox") {
|
|
||||||
var attribute = event.target.parentNode.getAttribute("classid");
|
|
||||||
} else {
|
|
||||||
var attribute = event.target.getAttribute("classid");
|
|
||||||
}
|
|
||||||
var data = [attribute, ""];
|
|
||||||
serverData = data;
|
|
||||||
confirm = "joinClass";
|
|
||||||
Session.set("confirmText", "Join class?");
|
|
||||||
|
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
|
||||||
setTimeout(function() {
|
|
||||||
document.getElementsByClassName("overlay")[0].style.opacity = "1";
|
|
||||||
}, 200);
|
|
||||||
},
|
|
||||||
'click .owned' (event) { // When you click your own class
|
|
||||||
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");
|
|
||||||
}
|
|
||||||
if (attribute === Meteor.userId()) return;
|
|
||||||
Session.set("selectedClass", null);
|
|
||||||
var usertype = ["moderators", "banned"];
|
|
||||||
var array = classes.findOne({
|
|
||||||
_id: attribute
|
|
||||||
});
|
|
||||||
|
|
||||||
for (var i = 0; i < usertype.length; i++) {
|
|
||||||
var users = array[usertype[i]];
|
|
||||||
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.services.google.email;
|
|
||||||
detailusers.name = user.profile.name;
|
|
||||||
array[usertype[i]].push(detailusers);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Meteor.call('getCode', attribute, function(err, result) {
|
|
||||||
array.code = result;
|
|
||||||
if (result === "None") {
|
|
||||||
Session.set("code", false);
|
|
||||||
} else {
|
|
||||||
Session.set("code", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
Session.set("selectedClass", array);
|
|
||||||
Session.set("owned", true);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
'click .classBox .fa-times' (event) { // Leaves a class
|
|
||||||
var box = event.target.parentNode;
|
|
||||||
var classid = box.getAttribute("classid");
|
|
||||||
serverData = box.getAttribute("classid");
|
|
||||||
confirm = "leaveClass";
|
|
||||||
Session.set("confirmText", "Leave this class?");
|
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
|
||||||
},
|
|
||||||
'click #creSubmit' () { //Submits form data for class
|
|
||||||
var data = getCreateFormData();
|
|
||||||
if (data === null) return;
|
|
||||||
serverData = data;
|
|
||||||
confirm = "createClass";
|
|
||||||
Session.set("confirmText", "Submit request?");
|
|
||||||
|
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
|
||||||
},
|
|
||||||
'click #private' (event) { // Joins private class
|
|
||||||
if (Session.get("privClass")) return;
|
|
||||||
var input = document.getElementById("privateCode");
|
|
||||||
input.className = "";
|
|
||||||
input.placeholder = "Enter code here...";
|
|
||||||
Session.set("privClass", true);
|
|
||||||
},
|
|
||||||
'click #privSubmit' () { // Submits private class code
|
|
||||||
var input = document.getElementById("privateCode");
|
|
||||||
var code = input.value;
|
|
||||||
input.value = "";
|
|
||||||
serverData = code;
|
|
||||||
Meteor.call("joinPrivateClass", code, function(error, result) {
|
|
||||||
if (result) {
|
|
||||||
Session.set("privClass", false);
|
|
||||||
} else {
|
|
||||||
input.className = "formInvalid";
|
|
||||||
input.placeholder = "Invalid code.";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
},
|
|
||||||
// OWNED CLASS BUTTONS
|
|
||||||
'click #copy' () { // Copies code for private classes.
|
|
||||||
if (document.getElementById("code").value === "None") return;
|
|
||||||
document.getElementById("code").select();
|
|
||||||
document.execCommand("copy");
|
|
||||||
},
|
|
||||||
'click .userAdder .fa-plus' (event) { // Gives/Removes user privileges
|
|
||||||
var input = event.target.parentNode.childNodes[3];
|
|
||||||
input.placeholder = "1234@abc.xyz";
|
|
||||||
input.className.replace(" formInvalid", "");
|
|
||||||
var value = input.value;
|
|
||||||
var classid = document.getElementById("createdClasses").getAttribute("classid");
|
|
||||||
input.value = " ";
|
|
||||||
if (checkUser(value, classid)) {
|
|
||||||
input.className += " formInvalid";
|
|
||||||
input.placeholder = "Not a valid user";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var user = Meteor.users.findOne({
|
|
||||||
"services.google.email": value
|
|
||||||
});
|
|
||||||
serverData = [
|
|
||||||
user._id,
|
|
||||||
classid,
|
|
||||||
event.target.parentNode.childNodes[1].childNodes[0].nodeValue.replace(":", "").toLowerCase(),
|
|
||||||
true
|
|
||||||
];
|
|
||||||
sendData("trackUserInClass");
|
|
||||||
},
|
|
||||||
'click .userBox .fa-times' (event) { // Removes user from permissions
|
|
||||||
var box = event.target.parentNode;
|
|
||||||
serverData = [
|
|
||||||
box.getAttribute("userid"),
|
|
||||||
document.getElementById("createdClasses").getAttribute("classid"),
|
|
||||||
box.parentNode.parentNode.childNodes[1].childNodes[1].childNodes[0].nodeValue.replace(":", "").toLowerCase(),
|
|
||||||
false
|
|
||||||
];
|
|
||||||
sendData("trackUserInClass");
|
|
||||||
},
|
|
||||||
'click #deleteClass' () {
|
|
||||||
serverData = document.getElementById("createdClasses").getAttribute("classid");
|
|
||||||
confirm = "deleteClass";
|
|
||||||
Session.set("confirmText", "Delete this class?");
|
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
|
||||||
},
|
|
||||||
'click #changeAdmin span' (event) { // Click to give ownership of class.
|
|
||||||
if (Session.get("changeAdmin")) return;
|
|
||||||
Session.set("changeAdmin", true);
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.placeholder = "1234@abc.xyz";
|
|
||||||
var i = document.createElement("i");
|
|
||||||
i.className = "fa fa-exchange";
|
|
||||||
i.setAttribute("aria-hidden", "true");
|
|
||||||
event.target.parentNode.appendChild(input);
|
|
||||||
event.target.parentNode.appendChild(i);
|
|
||||||
},
|
|
||||||
'click .fa-exchange' (event) { //Changes class admin upon confirmation
|
|
||||||
var input = event.target.parentNode.childNodes[3];
|
|
||||||
input.placeholder = "1234@abc.xyz";
|
|
||||||
input.className.replace(" formInvalid", "");
|
|
||||||
var value = input.value;
|
|
||||||
var classid = document.getElementById("createdClasses").getAttribute("classid");
|
|
||||||
input.value = "";
|
|
||||||
if (checkUser(value, classid)) {
|
|
||||||
input.className += " formInvalid";
|
|
||||||
input.placeholder = "Not a valid user";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var user = Meteor.users.findOne({
|
|
||||||
"services.google.email": value
|
|
||||||
});
|
|
||||||
serverData = [user._id, classid];
|
|
||||||
confirm = "changeAdmin";
|
|
||||||
Session.set("confirmText", "Are you really sure?");
|
|
||||||
openDivFade(document.getElementsByClassName("overlay")[0]);
|
|
||||||
document.getElementById("createdClasses").style.marginRight = "-40%";
|
|
||||||
},
|
|
||||||
// OVERLAY BUTTONS
|
|
||||||
'click .fa-check-circle-o' () { // Confirmation Button
|
|
||||||
sendData(confirm);
|
|
||||||
closeDivFade(document.getElementsByClassName("overlay")[0]);
|
|
||||||
if (confirm === "createClass") {
|
|
||||||
var form = document.getElementsByClassName("creInput");
|
|
||||||
for (var i = 0; i < form.length; i++) form[i].value = "";
|
|
||||||
}
|
|
||||||
serverData = null;
|
|
||||||
confirm = null;
|
|
||||||
},
|
|
||||||
'click .fa-times-circle-o' () { // Deny Button
|
|
||||||
closeDivFade(document.getElementsByClassName("overlay")[0]);
|
|
||||||
serverData = null;
|
|
||||||
confirm = null;
|
|
||||||
},
|
|
||||||
// INPUT HANDLING
|
|
||||||
'focus .clickModify' (event) {
|
|
||||||
$(".optionHolder")
|
|
||||||
.fadeOut(250, "linear");
|
|
||||||
|
|
||||||
if (modifyingInput !== null) {
|
|
||||||
if (!$("#" + modifyingInput)[0].className.includes("dropdown")) closeInput(modifyingInput);
|
|
||||||
}
|
|
||||||
modifyingInput = event.target.id;
|
|
||||||
if (!$("#" + modifyingInput)[0].className.includes("dropdown")) {
|
|
||||||
event.target.select();
|
|
||||||
event.target.style.cursor = "text";
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'keydown .dropdown' (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
var first = $("#" + modifyingInput).next().children("p:first-child");
|
|
||||||
var last = $("#" + modifyingInput).next().children("p:last-child");
|
|
||||||
var next = $(".selectedOption").next();
|
|
||||||
var prev = $(".selectedOption").prev();
|
|
||||||
var lastSel = $(".selectedOption");
|
|
||||||
|
|
||||||
if (event.keyCode === 38) {
|
|
||||||
event.preventDefault();
|
|
||||||
if (lastSel === undefined) {
|
|
||||||
last.addClass("selectedOption");
|
|
||||||
} else {
|
|
||||||
if (prev.length === 0) {
|
|
||||||
last.addClass("selectedOption");
|
|
||||||
lastSel.removeClass("selectedOption");
|
|
||||||
} else {
|
|
||||||
prev.addClass("selectedOption");
|
|
||||||
lastSel.removeClass("selectedOption");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (event.keyCode === 40) {
|
|
||||||
event.preventDefault();
|
|
||||||
if (lastSel === undefined) {
|
|
||||||
first.addClass("selectedOption");
|
|
||||||
last.removeClass("selectedOption");
|
|
||||||
} else {
|
|
||||||
if (next.length === 0) {
|
|
||||||
first.addClass("selectedOption");
|
|
||||||
lastSel.removeClass("selectedOption");
|
|
||||||
} else {
|
|
||||||
next.addClass("selectedOption");
|
|
||||||
lastSel.removeClass("selectedOption");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (event.keyCode === 13) {
|
|
||||||
lastSel[0].click();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'focus .dropdown' (event) {
|
|
||||||
$(".selectedOption").removeClass("selectedOption");
|
|
||||||
|
|
||||||
$("#" + modifyingInput).next()
|
|
||||||
.css('opacity', 0)
|
|
||||||
.slideDown(300)
|
|
||||||
.animate({
|
|
||||||
opacity: 1
|
|
||||||
}, {
|
|
||||||
queue: false,
|
|
||||||
duration: 100
|
|
||||||
});
|
|
||||||
},
|
|
||||||
'click .optionText' (event) { // Click each preferences setting.
|
|
||||||
var option = event.target.childNodes[0].nodeValue;
|
|
||||||
var userSettings = ["description", "school", "grade"];
|
|
||||||
var newSetting = Session.get("user");
|
|
||||||
|
|
||||||
if (modifyingInput === "privacy" || modifyingInput === "category") {
|
|
||||||
document.getElementById(modifyingInput).value = option;
|
|
||||||
$("#" + modifyingInput).next()
|
|
||||||
.fadeOut(250, "linear");
|
|
||||||
$(".selectedOption").removeClass("selectedOption");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_.contains(userSettings, modifyingInput)) {
|
|
||||||
newSetting[modifyingInput] = (modifyingInput === "grade") ? parseInt(option) : option;
|
|
||||||
} else {
|
|
||||||
newSetting.preferences[modifyingInput] = (function() {
|
|
||||||
var value = options[modifyingInput].filter(function(entry) {
|
|
||||||
return option === entry.alias;
|
|
||||||
})[0].val;
|
|
||||||
return (modifyingInput === 'theme') ? themeColors[value] : value;
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
Session.set("user", newSetting);
|
|
||||||
serverData = Session.get("user");
|
|
||||||
sendData("editProfile");
|
|
||||||
|
|
||||||
$("#" + modifyingInput).next()
|
|
||||||
.fadeOut(250, "linear");
|
|
||||||
|
|
||||||
$(".selectedOption").removeClass("selectedOption");
|
|
||||||
},
|
|
||||||
'input .restrict' (event) {
|
|
||||||
var restrict = event.target.maxLength;
|
|
||||||
var chars = restrict - event.target.value.length;
|
|
||||||
var newSetting = Session.get("restrictText");
|
|
||||||
newSetting[event.target.id] = (chars === restrict) ? "" : (chars.toString() + ((chars === 1) ? " character " : " characters ") + "left");
|
|
||||||
newSetting.selected = event.target.id;
|
|
||||||
Session.set("restrictText", newSetting);
|
|
||||||
},
|
|
||||||
// AUTOCOMPLETE HANDLING
|
|
||||||
'input #profClassSearch' (event) { // Auto-complete updater
|
|
||||||
if (event.target.value.length === 0) {
|
|
||||||
Session.set("notsearching", true);
|
|
||||||
} else {
|
|
||||||
Session.set("notsearching", false);
|
|
||||||
}
|
|
||||||
Session.set("autocompleteDivs", null);
|
|
||||||
var divs = [];
|
|
||||||
try {
|
|
||||||
var items = document.getElementsByClassName("-autocomplete-container")[0].childNodes[3].childNodes;
|
|
||||||
if (items.length === 0) { // If no results.
|
|
||||||
Session.set("notfound", true);
|
|
||||||
} else {
|
|
||||||
Session.set("notfound", false);
|
|
||||||
}
|
|
||||||
for (var i = 2; i < items.length; i += 3) { // Iterate through autocomplete div.
|
|
||||||
var item = items[i].childNodes[3];
|
|
||||||
if (Meteor.user().profile.classes.indexOf(item.getAttribute("classid")) !== -1) continue;
|
|
||||||
divs.push({
|
|
||||||
name: item.childNodes[1].childNodes[0].nodeValue,
|
|
||||||
teacher: item.childNodes[3].childNodes[0].nodeValue,
|
|
||||||
hour: item.childNodes[5].childNodes[0].nodeValue,
|
|
||||||
subscribers: Math.floor(item.childNodes[7].childNodes[0].nodeValue.replace(",", "").length / 17),
|
|
||||||
_id: item.getAttribute("classid")
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Session.set("autocompleteDivs", divs.sort(function(a, b) {
|
|
||||||
return b.subscribers - a.subscribers
|
|
||||||
}));
|
|
||||||
} catch (err) {}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function openDivFade(div) {
|
|
||||||
div.style.display = "block";
|
|
||||||
div.style.opacity = "0";
|
|
||||||
setTimeout(function() {
|
|
||||||
div.style.opacity = "1";
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
function closeDivFade(div) {
|
|
||||||
div.style.opacity = "0";
|
|
||||||
setTimeout(function() {
|
|
||||||
div.style.display = "none";
|
|
||||||
}, 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendData(funcName) {
|
|
||||||
Meteor.call(funcName, serverData, function(err, result) {
|
|
||||||
if (funcName === "trackUserInClass") {
|
|
||||||
var selectedClass = Session.get("selectedClass");
|
|
||||||
var array = classes.findOne({
|
|
||||||
_id: selectedClass._id
|
|
||||||
});
|
|
||||||
var usertype = ["moderators", "banned"];
|
|
||||||
for (var i = 0; i < usertype.length; i++) {
|
|
||||||
var users = array[usertype[i]];
|
|
||||||
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.services.google.email;
|
|
||||||
detailusers.name = user.profile.name;
|
|
||||||
array[usertype[i]].push(detailusers);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
selectedClass.moderators = array.moderators;
|
|
||||||
selectedClass.banned = array.banned;
|
|
||||||
Session.set("selectedClass", selectedClass);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getProfileData() { // Gets all data related to profile.
|
|
||||||
var profile = Session.get("user");
|
|
||||||
|
|
||||||
profile.description = document.getElementById("motd").childNodes[0].nodeValue;
|
|
||||||
if (profile.description.includes("Say something about yourself!")) profile.description = "";
|
|
||||||
|
|
||||||
profile.school = document.getElementById("school").childNodes[0].nodeValue;
|
|
||||||
if (profile.school === "Click here to edit...") profile.school = "";
|
|
||||||
|
|
||||||
var gradein = document.getElementById("grade").childNodes[0].nodeValue;
|
|
||||||
profile.grade = parseInt(gradein.substring(gradein.length - 2, gradein));
|
|
||||||
if (!profile.grade) profile.grade = "";
|
|
||||||
|
|
||||||
profile.avatar = document.getElementById("profAvatar").src;
|
|
||||||
profile.banner = document.getElementById("profBanner").src;
|
|
||||||
|
|
||||||
var themename = document.getElementById("prefTheme").childNodes[0].nodeValue.toLowerCase();
|
|
||||||
var themeobj = themeColors[themename];
|
|
||||||
profile.preferences = {
|
|
||||||
"theme": themeobj,
|
|
||||||
"mode": document.getElementById("prefMode").childNodes[0].nodeValue.toLowerCase(),
|
|
||||||
"timeHide": ref[document.getElementById("prefHide").childNodes[0].nodeValue],
|
|
||||||
"done": ref[document.getElementById("prefDone").childNodes[0].nodeValue],
|
|
||||||
"hideReport": ref[document.getElementById("prefReport").childNodes[0].nodeValue]
|
|
||||||
};
|
|
||||||
return profile;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCreateFormData() { // Gets create class form data, and returns null.
|
|
||||||
var stop;
|
|
||||||
var form = document.getElementsByClassName("creInput");
|
|
||||||
for (var i = 0; i < form.length; i++) { // Checks for missing/invalid fields.
|
|
||||||
if (i === 1 || i === 2) continue;
|
|
||||||
if (form[i].value === "") {
|
|
||||||
form[i].focus();
|
|
||||||
form[i].placeholder = "Missing field";
|
|
||||||
form[i].className += " formInvalid";
|
|
||||||
stop = true;
|
|
||||||
} else {
|
|
||||||
form[i].className = form[i].className.replace(" formInvalid", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (stop) return null;
|
|
||||||
|
|
||||||
var school = form[0].value;
|
|
||||||
var hour = form[1].value;
|
|
||||||
var teacher = form[2].value;
|
|
||||||
var name = form[3].value;
|
|
||||||
if (form[4].value == "Public") {
|
|
||||||
var privacy = false;
|
|
||||||
} else {
|
|
||||||
var privacy = true;
|
|
||||||
}
|
|
||||||
var category = form[5].value.toLowerCase();
|
|
||||||
return {
|
|
||||||
school: school,
|
|
||||||
hour: hour,
|
|
||||||
teacher: teacher,
|
|
||||||
name: name,
|
|
||||||
privacy: privacy,
|
|
||||||
category: category,
|
|
||||||
status: false,
|
|
||||||
code: ""
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function checkUser(email, classid) { // Checks if user email exists.
|
|
||||||
var user = Meteor.users.findOne({
|
|
||||||
"services.google.email": email
|
|
||||||
});
|
|
||||||
if (user === undefined) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
if (classes.findOne({
|
|
||||||
_id: classid
|
|
||||||
}).subscribers)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -13,8 +13,9 @@ Router.route('/', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
action: function() {
|
action: function() {
|
||||||
if(_.contains([null, undefined, ""], Meteor.user().profile.school)) {
|
if(_.contains([null, undefined, ""], Meteor.user().profile.school ||
|
||||||
this.redirect('/login');
|
_.contains([null, undefined, ""], Meteor.user().profile.grade))) {
|
||||||
|
this.redirect('/profile');
|
||||||
} else {
|
} else {
|
||||||
Session.set("user", Meteor.user().profile);
|
Session.set("user", Meteor.user().profile);
|
||||||
this.render("main");
|
this.render("main");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user