summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views/index
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-09-06 11:48:08 -0400
committerJules Laplace <jules@okfoc.us>2015-09-06 11:48:08 -0400
commitabe12120374d07cf5f87192964a9d1c10741e475 (patch)
tree48a5c09e51863fe1508e7404cec2a9340e29f686 /public/assets/js/lib/views/index
parent5b1461e7b4d32e96eaa8386b4b7ea96ec4b18d5a (diff)
header
Diffstat (limited to 'public/assets/js/lib/views/index')
-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
},