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
ongoworks:security
percolate:synced-cron
momentjs:moment
fortawesome:fontawesome

View File

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

View File

@ -28,7 +28,7 @@ h1 {
.eachDay {
font-family: Lato;
font-color: #353535;
color: #353535;
max-width:30%;
background-color: #136FB5;
box-shadow: 4px 5px 3px 2px #444;
@ -54,12 +54,13 @@ h1 {
}
.recent {
font-color: #353535;
color: #353535;
background-color: #5BEF78;
max-width:30%;
}
.scheduleList {
margin-top: 20%;
margin-top: 10%;
}
.type {
@ -120,3 +121,14 @@ h1 {
-ms-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

@ -9,10 +9,16 @@
<template name="day">
<p class="type">{{aftertext}} </p><p class="date">{{pretext}} </p>
{{#if allowed}}
<i class="fa fa-times"></i>
{{/if}}
</template>
<template name="recent">
<p class="type">{{aftertext}} </p><p class="date">{{pretext}}</p>
{{#if allowed}}
<i class="fa fa-times"></i>
{{/if}}
</template>
<template name="client">

View File

@ -6,11 +6,11 @@ allowedu["ksjdragon@gmail.com"]= true;
Meteor.subscribe('schedule');
Template.client.helpers({
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() {
@ -22,6 +22,7 @@ Template.client.helpers({
Template.client.events({
"click button": function() {
pre = document.getElementById("date").value;
console.log(pre);
document.getElementById("date").value = "";
post = document.getElementById('post').value;
Meteor.call('add_button', this, pre, post);
@ -53,19 +54,67 @@ Template.client.events({
Template.day.helpers({
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() {
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({
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() {
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["ksjdragon@gmail.com"] = true;
schedule.permit(['insert', 'update', 'remove']).never().apply();
// schedule.remove({});
SyncedCron.add({
name: 'Remove Entries past today',
schedule: function(parser) {
@ -26,19 +27,24 @@ Meteor.methods({
add_button: function(chrome, pre, post) {
if (Meteor.user() != undefined && Meteor.user().services.google.email in allowed) {
madate = pre.split("/");
date = new Date();
date.setMonth(madate[0]);
date.setDate(madate[1]);
date.setFullYear(madate[2]);
mymoment = moment(pre.replace("/", "-"), "MM-DD-YYYY").toISOString().split("T")[0];
if (pre !== undefined && post !== undefined) {
schedule.insert({
"pretext": date.toDateString().slice(0,date.length),
"pretext": mymoment,
"aftertext": post,
"timestamp": date
});
}
}
},
remove: function(chrome) {
if (Meteor.user() != undefined && Meteor.user().services.google.email in allowed) {
schedule.remove(chrome._id);
}
}
})