displays schedule

This commit is contained in:
yamanq 2016-02-07 02:03:06 -05:00
parent 942b1b1911
commit dbc766a754
2 changed files with 51 additions and 11 deletions

View File

@ -9,10 +9,30 @@
</body> </body>
<template name="day">
<p>{{pretext}} {{aftertext}} </p>
</template>
<template name="recent">
<p>{{pretext}} {{aftertext}} </p>
</template>
<template name="client"> <template name="client">
<input type="text" class="form-control" id="date"> <input type="text" class="form-control" id="date">
<div>
{{#each mostrecent}}
{{> recent}}
{{/each}}
</div>
<div>
{{#each sched}}
<div>
{{> day}}
</div>
{{/each}}
</div>
{{#if allowed}} {{#if allowed}}
<select id="post"> <select id="post">
<option value="AC">AC</option> <option value="AC">AC</option>
@ -21,4 +41,4 @@
<button>Submit</button> <button>Submit</button>
{{/if}} {{/if}}
</template> </template>

View File

@ -6,15 +6,17 @@ var done = false;
Meteor.subscribe('schedule'); Meteor.subscribe('schedule');
Template.client.rendered=function() {
}
// schedule.find({}, {sort: {timestamp: 1}, limit: 2}).fetch()
Template.client.helpers({ Template.client.helpers({
sched: function() {
return schedule.find({}, {sort: {timestamp: 1}, limit: 5}).fetch();
},
mostrecent: function() {
return schedule.find({}, {sort: {timestamp: 1}, limit: 1}).fetch();
},
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) {
return true return true
@ -24,7 +26,7 @@ Template.client.helpers({
} }
}) });
Template.client.events({ Template.client.events({
"focus input": function() { "focus input": function() {
@ -47,4 +49,22 @@ Template.client.events({
post = document.getElementById('post').value; post = document.getElementById('post').value;
Meteor.call('add_button', this, pre, post); Meteor.call('add_button', this, pre, post);
} }
}) });
Template.day.helpers({
pretext: function() {
return this.pretext;
},
aftertext: function() {
return this.aftertext;
}
});
Template.recent.helpers({
pretext: function() {
return this.pretext;
},
aftertext: function() {
return this.aftertext;
}
});