added A and B day feature
This commit is contained in:
parent
649458be6c
commit
9de18f3b4f
@ -39,14 +39,20 @@ h1 {
|
|||||||
padding-left:5%;
|
padding-left:5%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#post {
|
.selection {
|
||||||
font-size: 150%;
|
font-size: 150%;
|
||||||
float: right;
|
|
||||||
display: inline;
|
|
||||||
margin-top: -15.5%;
|
|
||||||
margin-right: 8%;
|
|
||||||
width: 35%;
|
width: 35%;
|
||||||
min-height: 50%;
|
min-height: 50%;
|
||||||
|
float: right;
|
||||||
|
margin-right: 8%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#post {
|
||||||
|
margin-top: -18%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#day {
|
||||||
|
margin-top: -4%;
|
||||||
}
|
}
|
||||||
|
|
||||||
#button {
|
#button {
|
||||||
|
|||||||
@ -63,10 +63,14 @@
|
|||||||
{{> loginButtons}}
|
{{> loginButtons}}
|
||||||
{{#if allowed}}
|
{{#if allowed}}
|
||||||
<input type="text" class="form-control" id="date" placeholder="date">
|
<input type="text" class="form-control" id="date" placeholder="date">
|
||||||
<select id="post">
|
<select class='selection' id="post">
|
||||||
<option value="AC">AC</option>
|
<option value="AC">AC</option>
|
||||||
<option value="Health">Health</option>
|
<option value="Health">Health</option>
|
||||||
</select>
|
</select>
|
||||||
|
<select class='selection' id="day">
|
||||||
|
<option value="A">A</option>
|
||||||
|
<option value="B">B</option>
|
||||||
|
</select>
|
||||||
<input type="text" id="other" placeholder="comments">
|
<input type="text" id="other" placeholder="comments">
|
||||||
<button id="button">Update!</button>
|
<button id="button">Update!</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|||||||
@ -25,9 +25,10 @@ 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;
|
||||||
|
day = document.getElementById('day').value;
|
||||||
other = document.getElementById("other").value;
|
other = document.getElementById("other").value;
|
||||||
document.getElementById("other").value = "";
|
document.getElementById("other").value = "";
|
||||||
Meteor.call('add_button', this, pre, post, other);
|
Meteor.call('add_button', this, pre, post, day, other);
|
||||||
},
|
},
|
||||||
|
|
||||||
"keypress input": function(event) {
|
"keypress input": function(event) {
|
||||||
@ -37,7 +38,7 @@ Template.client.events({
|
|||||||
post = document.getElementById('post').value;
|
post = document.getElementById('post').value;
|
||||||
other = document.getElementById("other").value;
|
other = document.getElementById("other").value;
|
||||||
document.getElementById("other").value = "";
|
document.getElementById("other").value = "";
|
||||||
Meteor.call('add_button', this, pre, post, other);
|
Meteor.call('add_button', this, pre, post, day, other);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -74,7 +75,7 @@ Template.day.helpers({
|
|||||||
lastWeek: '[Last] dddd',
|
lastWeek: '[Last] dddd',
|
||||||
sameElse: 'MM/DD/YYYY'
|
sameElse: 'MM/DD/YYYY'
|
||||||
});
|
});
|
||||||
return date;
|
return date + " (" + this.day + ")";
|
||||||
},
|
},
|
||||||
|
|
||||||
aftertext: function() {
|
aftertext: function() {
|
||||||
@ -122,7 +123,7 @@ Template.recent.helpers({
|
|||||||
lastWeek: '[Last] dddd',
|
lastWeek: '[Last] dddd',
|
||||||
sameElse: 'MM/DD/YYYY'
|
sameElse: 'MM/DD/YYYY'
|
||||||
});
|
});
|
||||||
return date
|
return date + " (" + this.day + ")"
|
||||||
},
|
},
|
||||||
|
|
||||||
aftertext: function() {
|
aftertext: function() {
|
||||||
|
|||||||
@ -16,7 +16,7 @@ SyncedCron.add({
|
|||||||
var thedate = moment();
|
var thedate = moment();
|
||||||
var today = thedate.format("X");
|
var today = thedate.format("X");
|
||||||
|
|
||||||
// Remove matchng Documents
|
// Remove matching Documents
|
||||||
schedule.remove({timestamp: {$lt: today}});
|
schedule.remove({timestamp: {$lt: today}});
|
||||||
console.log(thedate.format());
|
console.log(thedate.format());
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ SyncedCron.start();
|
|||||||
|
|
||||||
Meteor.methods({
|
Meteor.methods({
|
||||||
|
|
||||||
add_button: function(chrome, pre, post, other) {
|
add_button: function(chrome, pre, post, day, 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];
|
||||||
@ -35,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, "other": other, "timestamp": entry.timestamp});
|
schedule.update(entry._id, {"aftertext": post, "pretext": entry.pretext, "day": day, "other": other, "timestamp": entry.timestamp});
|
||||||
} else {
|
} else {
|
||||||
schedule.insert({
|
schedule.insert({
|
||||||
"pretext": thepretext,
|
"pretext": thepretext,
|
||||||
"aftertext": post,
|
"aftertext": post,
|
||||||
|
"day": day,
|
||||||
"other": other,
|
"other": other,
|
||||||
"timestamp": time
|
"timestamp": time
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user