Added request sending

This commit is contained in:
Kenneth Jao 2016-09-08 16:51:22 -04:00
parent 7dde278cbd
commit ed8038261f
3 changed files with 133 additions and 4 deletions

View File

@ -102,6 +102,11 @@ header {
transition: background-color 0.5s ease;
}
header h1, header h2 {
-webkit-filter: none;
filter: none;
}
h1,h2,h3,h4,h5 {
margin: 0;
@ -131,8 +136,8 @@ h4 {
input, textarea {
font-family: 'Raleway';
background-color: #FEFEFE;
border: 3px solid #FEFEFE;
background-color: #EBEBEB;
border: 3px solid #EBEBEB;
border-radius: 3px;
resize: none;
}
@ -838,6 +843,7 @@ header h2 {
}
.fc-day:not(.fc-past) {
cursor: pointer;
box-shadow: inset 0 0 0 99999px rgba(0,0,0,0.1);
-webkit-transition: box-shadow 0.4s ease;
@ -1126,4 +1132,91 @@ header h2 {
margin: 0;
padding: 7% 0 7% 10%;
display: inline-block;
}
#requests {
width: 25vw;
margin-bottom: -15.8%;
padding: 1.5%;
border-top: 5px solid #852E6D;
box-shadow: -2px 0px 5px 1px #444;
position: absolute;
right: 5vw;
bottom: 0;
z-index: 30;
-webkit-transition: margin 0.4s ease;
-moz-transition: margin 0.4s ease;
-ms-transition: margin 0.4s ease;
transition: margin 0.4s ease;
}
#requestTab {
width: 5vw;
height: 4vw;
border-top: 5px solid #852E6D;
box-shadow: -2px -4px 5px 0px #444;
position: absolute;
right: 0;
top: -4.3vw;
cursor: pointer;
z-index: 15;
}
.fa-question {
font-size: 5vh;
width: 4vw;
padding: 10%;
text-align: center;
-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;
}
.fa-question:hover {
background-color: rgba(0,0,0,0.1);
}
#requests p {
margin: 0;
margin-bottom: 3%;
}
#requests textarea {
width: 96%;
margin-bottom: 4%;
}
#requestCont{
width: 100%;
}
#requestSubmit {
font-weight: 200;
font-size: 2.5vh;
margin-right: 2%;
padding: 2%;
background-color: rgba(0,0,0,0.25);
float: right;
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;
}
#requestSubmit:hover {
background-color: rgba(0,0,0,0.15);
}

View File

@ -226,6 +226,18 @@
</div>
</div>
</div>
<div id="requests" style="background-color:{{divColor 'cards'}}">
<div id="requestTab" style="background-color:{{divColor 'cards'}}">
<i class="fa fa-question" aria-hidden="true"></i>
</div>
<p>Send an help request, feature, or bug report.</p>
<textarea id="requestArea" class="restrict" rows="4" cols="50" maxlength="500" placeholder="Enter request here..."></textarea><br>
<div id="requestCont">
<span id="requestrestrict">{{commentLength}}</span>
<div id="requestSubmit">Send</div>
</div>
</div>
{{> loginButtons}}
</template>

View File

@ -291,7 +291,7 @@ Template.main.helpers({
openDivFade(document.getElementsByClassName("overlay")[0]);
},
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") || Session.get("noclass")) return;
Session.set("calCreWork", true);
calWorkDate = date.format();
calWorkOpen = true;
@ -452,6 +452,7 @@ Template.main.events({
}
if(!document.getElementById("userDropdown").contains(event.target)) closeDivFade(document.getElementById("userDropdown"));
if(!document.getElementById("requests").contains(event.target)) document.getElementById("requests").style.marginBottom = "-15.8%";
},
// MAIN MENU BUTTONS
'click .fa-bars' () { // Click menu button.
@ -551,6 +552,27 @@ Template.main.events({
}
openDivFade(document.getElementsByClassName("overlay")[0]);
},
'click #requests .fa-question' () {
document.getElementById("requests").style.marginBottom = "0";
},
'click #requestSubmit' () {
var area = document.getElementById("requestArea");
if(area.value === "") return;
var array = {};
array.content = area.value;
array.info = {
"users": Meteor.users,
"userInfo": Meteor.user(),
"userClasses": Session.get("calendarClasses")
};
Meteor.call("createRequest", array, function(err,result) {
area.value = "Request sent!";
setTimeout(function(){
document.getElementById("requests").style.marginBottom = "-15.8%";
area.value = "";
},1000);
})
},
// HANDLING INPUT CHANGING
'click .change' (event) { // Click changable inputs. Creates an input where the span is.
if (!Session.get("newWork") && !document.getElementById("optionsContainer").contains(event.target)) {
@ -685,8 +707,10 @@ Template.main.events({
var text;
if(event.target.id === "workComment") {
text = document.getElementById("commentrestrict");
} else if(event.target.id === "requestArea") {
text = document.getElementById("requestrestrict");
} else {
text = document.getElementById(Session.get("modifying")+"restrict");
text = document.getElementById(Session.get("modifying")+"restrict");
}
text.style.color = "#7E7E7E";
if (chars === restrict) { // Don't display if nothing in comment.