2013-11-22 14:20:47 +09:00
|
|
|
Template.logs.helpers({
|
2013-11-22 14:46:42 +09:00
|
|
|
getTime: function () {
|
2013-11-22 15:36:14 +09:00
|
|
|
return moment(this.timestamp).format("HH:mm:ss");
|
2013-11-22 14:46:42 +09:00
|
|
|
},
|
|
|
|
getDate: function () {
|
|
|
|
currentDate = moment(this.timestamp).format("MMMM DD");
|
|
|
|
return currentDate;
|
|
|
|
},
|
|
|
|
searchCount: function () {
|
2013-11-22 15:36:14 +09:00
|
|
|
// TODO: doesn't work properly with "load more"
|
2013-11-22 14:46:42 +09:00
|
|
|
var after = moment(this.timestamp).startOf('day').valueOf(),
|
|
|
|
before = moment(this.timestamp).endOf('day').valueOf();
|
|
|
|
|
|
|
|
return Searches.find({
|
|
|
|
timestamp: {
|
|
|
|
$gte: after,
|
|
|
|
$lt: before
|
|
|
|
}
|
|
|
|
}).count();
|
|
|
|
},
|
|
|
|
isNewDate: function () {
|
|
|
|
return (typeof currentDate === 'undefined') ? true : (currentDate !== moment(this.timestamp).format("MMMM DD"));
|
2013-11-22 14:20:47 +09:00
|
|
|
},
|
|
|
|
loadMoreUrl: function(){
|
|
|
|
var count = parseInt(Session.get('logsLimit')) + 100;
|
|
|
|
return '/logs/' + count;
|
|
|
|
},
|
|
|
|
});
|