Skip to content

Instantly share code, notes, and snippets.

@kingluddite
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingluddite/02b138f3d8e5dece2f32 to your computer and use it in GitHub Desktop.
Save kingluddite/02b138f3d8e5dece2f32 to your computer and use it in GitHub Desktop.
Handlebars.registerHelper("formatDate", function(datetime) {
if (moment) {
return moment(datetime).format("MM/DD/YYYY");
}
else {
return datetime;
}
});
<template name="Projects">
<div class="page-header">
<h1>Projects<small> list</small></h1>
</div>
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>Name</th>
<th>Client</th>
<th>Due Date</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{{#each projectList}}
{{> ProjectRow}}
{{/each}}
</tbody>
</table>
</template>
<template name="ProjectRow">
<tr class="projectRow">
<td>{{name}}</td>
<td>{{client}}</td>
<td>{{duedate}}</td>
<td>{{status}}</td>
</tr>
</template>
Template.Projects.projectList = function() {
return Projects.find();
}
@kingluddite
Copy link
Author

Note: projects.js goes inside /client/views/pages/projects/ directory
I created a separate folder to hold all stuff for the projects page.

@kingluddite
Copy link
Author

helpers.js goes in /client/lib/helpers/ and is used to format date

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment