summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <jules@okfoc.us>2015-09-06 11:06:37 -0400
committerJules Laplace <jules@okfoc.us>2015-09-06 11:06:37 -0400
commit5b1461e7b4d32e96eaa8386b4b7ea96ec4b18d5a (patch)
tree70439f3a8f08cbf31c14bef5570af6e9d8f47653
parentf496fe34ecebd92b7c43b2beface68893adcae97 (diff)
showing file counts
-rw-r--r--lib/bucky.js15
-rw-r--r--lib/index.js2
-rw-r--r--public/assets/css/bucky.css3
-rw-r--r--public/assets/js/lib/views/index/threadbox.js4
-rw-r--r--views/pages/index.ejs2
5 files changed, 12 insertions, 14 deletions
diff --git a/lib/bucky.js b/lib/bucky.js
index dddbae9..2488c31 100644
--- a/lib/bucky.js
+++ b/lib/bucky.js
@@ -23,17 +23,12 @@ var bucky = module.exports = {
ensureFileCountsForThreads: function (req, res, next){
db.getFileCounts(res.threads_ids).then(function(counts){
var lookup = {}
- counts.forEach(function(c,i){
- res.threads.at(i).set("file_count", c.count)
+ counts.forEach(function(c){
+ lookup[c.thread] = c
})
- next()
- })
- },
- ensureFileSizeForThreads: function (req, res, next){
- db.getFileSizes(res.threads_ids).then(function(sizes){
- var lookup = {}
- sizes.forEach(function(c,i){
- res.threads.at(i).set("file_size", c.size)
+ res.threads.forEach(function(t){
+ var c = lookup[t.id]
+ t.set("file_count", c ? c.count : 0)
})
next()
})
diff --git a/lib/index.js b/lib/index.js
index 2ccf812..e84c32a 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -87,7 +87,7 @@ site.route = function(){
bucky.ensureLatestThreads,
bucky.ensureCommentCountsForThreads,
bucky.ensureFileCountsForThreads,
- bucky.ensureFileSizeForThreads,
+// bucky.ensureFileSizeForThreads,
bucky.ensureHootbox,
function(req, res){
res.json({
diff --git a/public/assets/css/bucky.css b/public/assets/css/bucky.css
index 67521f7..5dc41cf 100644
--- a/public/assets/css/bucky.css
+++ b/public/assets/css/bucky.css
@@ -1,3 +1,6 @@
+html {
+ padding-bottom: 300px;
+}
body {
background-color: #e6f0f0;
color: #111111;
diff --git a/public/assets/js/lib/views/index/threadbox.js b/public/assets/js/lib/views/index/threadbox.js
index defeaff..3137c7c 100644
--- a/public/assets/js/lib/views/index/threadbox.js
+++ b/public/assets/js/lib/views/index/threadbox.js
@@ -22,9 +22,8 @@ var ThreadBox = View.extend({
},
parse: function(thread){
- console.log(thread)
var views = hush_views(thread.viewed)
- var size = thread.file_count == 0 ? ["hidden", 0] : hush_size(thread.size)
+ var size = hush_size(thread.size)
var comments = hush_null(thread.comment_count, "c")
var files = hush_null(thread.file_count, "f")
var dot = privacy_dot(thread.private)
@@ -43,6 +42,7 @@ var ThreadBox = View.extend({
.replace(/{{views_class}}/g, views[0])
.replace(/{{comments_class}}/g, comments[0])
.replace(/{{files_class}}/g, files[0])
+ .replace(/{{show_files}}/g, thread.file_count == 0 ? "hidden" : "")
.replace(/{{size_class}}/g, size[0] )
return t
},
diff --git a/views/pages/index.ejs b/views/pages/index.ejs
index b6a8a5f..35143cb 100644
--- a/views/pages/index.ejs
+++ b/views/pages/index.ejs
@@ -51,7 +51,7 @@
<td class="{{comments_class}}">
{{comments}}
</td>
- <td>
+ <td class="{{show_files}}">
<span class="{{size_class}}">{{size}}</span>
in
<span class="{{files_class}}">{{files}}</span>