moment and css fixes and remove button and more

This commit is contained in:
yamanq 2016-02-08 20:53:43 -05:00
parent d781e1a73b
commit 2bf49118fd
6 changed files with 89 additions and 12 deletions

View File

@ -24,3 +24,5 @@ accounts-google
accounts-ui accounts-ui
ongoworks:security ongoworks:security
percolate:synced-cron percolate:synced-cron
momentjs:moment
fortawesome:fontawesome

View File

@ -29,6 +29,7 @@ ecmascript-runtime@0.2.6
ejson@1.0.7 ejson@1.0.7
es5-shim@4.1.14 es5-shim@4.1.14
fastclick@1.0.7 fastclick@1.0.7
fortawesome:fontawesome@4.5.0
geojson-utils@1.0.4 geojson-utils@1.0.4
google@1.1.7 google@1.1.7
hot-code-push@1.0.0 hot-code-push@1.0.0
@ -49,6 +50,7 @@ minifiers@1.1.7
minimongo@1.0.10 minimongo@1.0.10
mobile-experience@1.0.1 mobile-experience@1.0.1
mobile-status-bar@1.0.6 mobile-status-bar@1.0.6
momentjs:moment@2.11.2
mongo@1.1.3 mongo@1.1.3
mongo-id@1.0.1 mongo-id@1.0.1
npm-mongo@1.4.39_1 npm-mongo@1.4.39_1

View File

@ -28,7 +28,7 @@ h1 {
.eachDay { .eachDay {
font-family: Lato; font-family: Lato;
font-color: #353535; color: #353535;
max-width:30%; max-width:30%;
background-color: #136FB5; background-color: #136FB5;
box-shadow: 4px 5px 3px 2px #444; box-shadow: 4px 5px 3px 2px #444;
@ -54,12 +54,13 @@ h1 {
} }
.recent { .recent {
font-color: #353535; color: #353535;
background-color: #5BEF78; background-color: #5BEF78;
max-width:30%;
} }
.scheduleList { .scheduleList {
margin-top: 20%; margin-top: 10%;
} }
.type { .type {
@ -119,4 +120,15 @@ h1 {
-moz-transition: transform 0.3s ease; -moz-transition: transform 0.3s ease;
-ms-transition: transform 0.3s ease; -ms-transition: transform 0.3s ease;
transition: transform 0.3s ease; transition: transform 0.3s ease;
} }
.fa {
-webkit-transition: color 0.5s ease;
-moz-transition: color 0.5s ease;
-ms-transition: color 0.5s ease;
transition: color 0.5s ease;
}
.fa:hover {
color: #E14C2B;
}

View File

@ -8,11 +8,17 @@
<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>
{{#if allowed}}
<i class="fa fa-times"></i>
{{/if}}
</template> </template>
<template name="recent"> <template name="recent">
<p class="type">{{aftertext}} </p><p class="date">{{pretext}}</p> <p class="type">{{aftertext}} </p><p class="date">{{pretext}}</p>
{{#if allowed}}
<i class="fa fa-times"></i>
{{/if}}
</template> </template>
<template name="client"> <template name="client">

View File

@ -6,11 +6,11 @@ allowedu["ksjdragon@gmail.com"]= true;
Meteor.subscribe('schedule'); Meteor.subscribe('schedule');
Template.client.helpers({ Template.client.helpers({
sched: function() { sched: function() {
return schedule.find({}, {sort: {timestamp: 1}, limit: 5}).fetch(); beforeslice = schedule.find({}, {sort: {timestamp: 1}, limit: 5}).fetch();
return beforeslice.slice(1, beforeslice.length);
}, },
mostrecent: function() { mostrecent: function() {
@ -22,6 +22,7 @@ Template.client.helpers({
Template.client.events({ Template.client.events({
"click button": function() { "click button": function() {
pre = document.getElementById("date").value; pre = document.getElementById("date").value;
console.log(pre);
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); Meteor.call('add_button', this, pre, post);
@ -53,19 +54,67 @@ Template.client.events({
Template.day.helpers({ Template.day.helpers({
pretext: function() { pretext: function() {
return this.pretext; date = moment(this.pretext);
date = date.calendar(null, {
sameDay: '[Today]',
nextDay: '[Tomorrow]',
nextWeek: 'dddd',
lastDay: '[Yesterday]',
lastWeek: '[Last] dddd',
sameElse: 'DD/MM/YYYY'
});
return date;
}, },
aftertext: function() { aftertext: function() {
return this.aftertext; return this.aftertext;
},
allowed: function() {
if (!(Meteor.user() === undefined) && Meteor.user().services.google.email in allowedu) {
return true;
} else {
return false;
}
} }
}); });
Template.day.events({
'click .fa' : function() {
Meteor.call('remove', this);
}
})
Template.recent.events({
'click .fa' : function() {
Meteor.call('remove', this);
}
})
Template.recent.helpers({ Template.recent.helpers({
pretext: function() { pretext: function() {
return this.pretext; date = moment(this.pretext);
date = date.calendar(null, {
sameDay: '[Today]',
nextDay: '[Tomorrow]',
nextWeek: 'dddd',
lastDay: '[Yesterday]',
lastWeek: '[Last] dddd',
sameElse: 'DD/MM/YYYY'
});
return date
}, },
aftertext: function() { aftertext: function() {
return this.aftertext; return this.aftertext;
},
allowed: function() {
if (!(Meteor.user() === undefined) && Meteor.user().services.google.email in allowedu) {
return true;
} else {
return false;
}
} }
}); });

View File

@ -3,9 +3,10 @@ allowed["ybq987@gmail.com"] = true;
allowed["dweinger@bloomfield.org"] = true; allowed["dweinger@bloomfield.org"] = true;
allowed["ksjdragon@gmail.com"] = true; allowed["ksjdragon@gmail.com"] = true;
schedule.permit(['insert', 'update', 'remove']).never().apply(); schedule.permit(['insert', 'update', 'remove']).never().apply();
// schedule.remove({});
SyncedCron.add({ SyncedCron.add({
name: 'Remove Entries past today', name: 'Remove Entries past today',
schedule: function(parser) { schedule: function(parser) {
@ -26,19 +27,24 @@ Meteor.methods({
add_button: function(chrome, pre, post) { add_button: function(chrome, pre, post) {
if (Meteor.user() != undefined && Meteor.user().services.google.email in allowed) { if (Meteor.user() != undefined && Meteor.user().services.google.email in allowed) {
madate = pre.split("/"); madate = pre.split("/");
date = new Date(); date = new Date();
date.setMonth(madate[0]); date.setMonth(madate[0]);
date.setDate(madate[1]); date.setDate(madate[1]);
date.setFullYear(madate[2]); date.setFullYear(madate[2]);
mymoment = moment(pre.replace("/", "-"), "MM-DD-YYYY").toISOString().split("T")[0];
if (pre !== undefined && post !== undefined) { if (pre !== undefined && post !== undefined) {
schedule.insert({ schedule.insert({
"pretext": date.toDateString().slice(0,date.length), "pretext": mymoment,
"aftertext": post, "aftertext": post,
"timestamp": date "timestamp": date
}); });
} }
} }
},
remove: function(chrome) {
if (Meteor.user() != undefined && Meteor.user().services.google.email in allowed) {
schedule.remove(chrome._id);
}
} }
}) })