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%; max-width: 50%;
} }
#other {
margin-top: 3%;
margin-bottom: 2%;
width: 89%;
margin-left: 3%;
padding-left:5%;
}
#post { #post {
font-size: 150%; font-size: 150%;
float: right; float: right;
display: inline; display: inline;
margin-top: -10.5%; margin-top: -15.5%;
margin-right: 8%; margin-right: 8%;
width: 35%; width: 35%;
min-height: 50%; min-height: 50%;

View File

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

View File

@ -25,7 +25,9 @@ Template.client.events({
pre = document.getElementById("date").value; pre = document.getElementById("date").value;
document.getElementById("date").value = ""; document.getElementById("date").value = "";
post = document.getElementById('post').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() { "click .pulltab": function() {
@ -67,6 +69,10 @@ Template.day.helpers({
aftertext: function() { aftertext: function() {
return this.aftertext; return this.aftertext;
}, },
other: function() {
return this.other;
},
allowed: function() { allowed: function() {
if (!(Meteor.user() === undefined) && Meteor.user().services.google.email in allowedu) { if (!(Meteor.user() === undefined) && Meteor.user().services.google.email in allowedu) {
@ -111,6 +117,10 @@ Template.recent.helpers({
aftertext: function() { aftertext: function() {
return this.aftertext; return this.aftertext;
}, },
other: function() {
return this.other;
},
allowed: function() { allowed: function() {
if (!(Meteor.user() === undefined) && Meteor.user().services.google.email in allowedu) { if (!(Meteor.user() === undefined) && Meteor.user().services.google.email in allowedu) {

View File

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