added comment feature

This commit is contained in:
yamanq 2016-03-01 16:46:37 -05:00
parent 15e3a136b9
commit f4279b6d63
4 changed files with 35 additions and 13 deletions

View File

@ -27,11 +27,19 @@ h1 {
max-width: 50%;
}
#other {
margin-top: 3%;
margin-bottom: 2%;
width: 89%;
margin-left: 3%;
padding-left:5%;
}
#post {
font-size: 150%;
float: right;
display: inline;
margin-top: -10.5%;
margin-top: -15.5%;
margin-right: 8%;
width: 35%;
min-height: 50%;

View File

@ -13,7 +13,7 @@
<template name="day">
<p class="type">{{aftertext}} </p><p class="date">{{pretext}} </p>
<p class="type">{{aftertext}} </p><p class="date">{{pretext}}</p> <p class="other">{{other}}</p>
{{#if allowed}}
<i class="fa fa-times fa-3x"></i>
{{/if}}
@ -21,7 +21,7 @@
<template name="recent">
<div class="recent eachDay {{aftertext}}">
<p class="type">{{aftertext}} </p><p class="date">{{pretext}}</p>
<p class="type">{{aftertext}} </p><p class="date">{{pretext}}</p> <p class="other">{{other}}</p>
{{#if allowed}}
<i class="fa fa-times fa-3x"></i>
{{/if}}
@ -52,12 +52,13 @@
<h1>AC/Health Schedule</h1>
{{> loginButtons}}
{{#if allowed}}
<input type="text" class="form-control" id="date">
<select id="post">
<option value="AC">AC</option>
<option value="Health">Health</option>
</select>
<button id="button">Update!</button>
<input type="text" class="form-control" id="date" placeholder="date">
<select id="post">
<option value="AC">AC</option>
<option value="Health">Health</option>
</select>
<input type="text" id="other" placeholder="comments">
<button id="button">Update!</button>
{{/if}}
<div class='about'>
<p>Developed by Yaman Qalieh</p>

View File

@ -25,7 +25,9 @@ Template.client.events({
pre = document.getElementById("date").value;
document.getElementById("date").value = "";
post = document.getElementById('post').value;
Meteor.call('add_button', this, pre, post);
other = document.getElementById("other").value;
document.getElementById("other").value = "";
Meteor.call('add_button', this, pre, post, other);
},
"click .pulltab": function() {
@ -68,6 +70,10 @@ Template.day.helpers({
return this.aftertext;
},
other: function() {
return this.other;
},
allowed: function() {
if (!(Meteor.user() === undefined) && Meteor.user().services.google.email in allowedu) {
return true;
@ -112,6 +118,10 @@ Template.recent.helpers({
return this.aftertext;
},
other: function() {
return this.other;
},
allowed: function() {
if (!(Meteor.user() === undefined) && Meteor.user().services.google.email in allowedu) {
return true;

View File

@ -13,10 +13,12 @@ SyncedCron.add({
return parser.recur().on('19:35:00').time();
},
job: function() {
var today = moment().format("X");
var thedate = moment();
var today = thedate.format("X");
// Remove matchng Documents
schedule.remove({timestamp: {$lt: today}});
console.log(thedate.format());
}
});
@ -25,7 +27,7 @@ SyncedCron.start();
Meteor.methods({
add_button: function(chrome, pre, post) {
add_button: function(chrome, pre, post, other) {
if ((Meteor.user() != undefined) && (Meteor.user().services.google.email in allowed) && !(pre === "")) {
mymoment = moment(pre.replace("/", "-"), "MM-DD-YYYY");
thepretext = mymoment.toISOString().split("T")[0];
@ -33,11 +35,12 @@ Meteor.methods({
previous = schedule.find({"pretext": thepretext}).fetch();
if (previous.length > 0) {
entry = previous[0]
schedule.update(entry._id, {"aftertext": post, "pretext": entry.pretext, "timestamp": entry.timestamp});
schedule.update(entry._id, {"aftertext": post, "pretext": entry.pretext, "other": other, "timestamp": entry.timestamp});
} else {
schedule.insert({
"pretext": thepretext,
"aftertext": post,
"other": other,
"timestamp": time
});
}