summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/js/lib/views')
-rw-r--r--public/assets/js/lib/views/index/index.js2
-rw-r--r--public/assets/js/lib/views/index/lastlog.js34
-rw-r--r--public/assets/js/lib/views/index/threadbox.js1
3 files changed, 37 insertions, 0 deletions
diff --git a/public/assets/js/lib/views/index/index.js b/public/assets/js/lib/views/index/index.js
index 473df38..3d4dc72 100644
--- a/public/assets/js/lib/views/index/index.js
+++ b/public/assets/js/lib/views/index/index.js
@@ -9,6 +9,7 @@ var IndexView = View.extend({
// opt.parent = parent
this.hootbox = new HootBox ({ parent: this })
this.threadbox = new ThreadBox ({ parent: this })
+ this.lastlog = new LastLog ({ parent: this })
this.load()
},
@@ -19,6 +20,7 @@ var IndexView = View.extend({
populate: function(data){
this.hootbox.load(data.hootbox)
this.threadbox.load(data.threads)
+ this.lastlog.load(data.lastlog)
},
success: function(){
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
+ },
+
+})
diff --git a/public/assets/js/lib/views/index/threadbox.js b/public/assets/js/lib/views/index/threadbox.js
index 3137c7c..069f85d 100644
--- a/public/assets/js/lib/views/index/threadbox.js
+++ b/public/assets/js/lib/views/index/threadbox.js
@@ -44,6 +44,7 @@ var ThreadBox = View.extend({
.replace(/{{files_class}}/g, files[0])
.replace(/{{show_files}}/g, thread.file_count == 0 ? "hidden" : "")
.replace(/{{size_class}}/g, size[0] )
+ .replace(/{{color}}/g, thread.color || "plain" )
return t
},