Vulcan/packages/telescope-search/lib/client/views/search_logs.js

30 lines
930 B
JavaScript
Raw Normal View History

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