From abe12120374d07cf5f87192964a9d1c10741e475 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 6 Sep 2015 11:48:08 -0400 Subject: header --- public/assets/js/lib/views/index/lastlog.js | 34 +++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 public/assets/js/lib/views/index/lastlog.js (limited to 'public/assets/js/lib/views/index/lastlog.js') diff --git a/public/assets/js/lib/views/index/lastlog.js b/public/assets/js/lib/views/index/lastlog.js new file mode 100644 index 0000000..2f7b224 --- /dev/null +++ b/public/assets/js/lib/views/index/lastlog.js @@ -0,0 +1,34 @@ +/* +age_class +views_class +comments_class +size_class +files_class +*/ + +var LastLog = View.extend({ + el: ".lastlog", + + events: { + }, + + initialize: function(){ + this.__super__.initialize.call(this) + this.template = this.$(".template").html() + }, + + load: function(lastlog){ + var s = lastlog.map(this.parse.bind(this)).join(', ') + this.$el.html(s) + }, + + parse: function(user){ + var t = this.template + .replace(/{{username}}/g, user.username) + .replace(/{{age}}/g, get_age(user.lastseen) ) + .replace(/{{age_class}}/g, carbon_date(user.lastseen) ) + .trim() + return t + }, + +}) -- cgit v1.2.3-70-g09d2