diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-12-11 04:25:19 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-12-11 04:25:19 +0100 |
| commit | 4c775f12ff6eda48fc22bec9ed336e60c1a0e07e (patch) | |
| tree | 792b3906107442dc6823440fa0bf21a7bea1a224 /public/assets/js/lib/views/index | |
| parent | 6702125f12820c504ae18114f99fee3e13b2616f (diff) | |
cssssssss
Diffstat (limited to 'public/assets/js/lib/views/index')
| -rw-r--r-- | public/assets/js/lib/views/index/hootbox.js | 4 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/index.js | 13 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/lastlog.js | 4 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/threadbox.js | 2 |
4 files changed, 19 insertions, 4 deletions
diff --git a/public/assets/js/lib/views/index/hootbox.js b/public/assets/js/lib/views/index/hootbox.js index cdd3eb0..64fc756 100644 --- a/public/assets/js/lib/views/index/hootbox.js +++ b/public/assets/js/lib/views/index/hootbox.js @@ -15,6 +15,10 @@ var HootBox = FormView.extend({ }, load: function(comments){ + if (!comments || !comments.length) { + this.$el.hide() + return + } comments.forEach(this.appendComment.bind(this)) }, diff --git a/public/assets/js/lib/views/index/index.js b/public/assets/js/lib/views/index/index.js index 840f150..5acfe8b 100644 --- a/public/assets/js/lib/views/index/index.js +++ b/public/assets/js/lib/views/index/index.js @@ -4,17 +4,24 @@ var IndexView = View.extend({ }, action: "/api/index", + keywordAction: "/api/keyword/", initialize: function(opt){ // opt.parent = parent this.hootbox = new HootBox ({ parent: this }) this.threadbox = new ThreadBox ({ parent: this, latest: true, welcome: true, }) this.lastlog = new LastLog ({ parent: this }) - this.load() }, - load: function(){ - $.get(this.action, this.populate.bind(this)) + load: function(keyword){ + if (keyword) { + $(".subtitle").html('<a href="/">< Home</a>') + this.threadbox.options.welcome = false + $.get(this.keywordAction + keyword, this.populate.bind(this)) + } + else { + $.get(this.action, this.populate.bind(this)) + } }, populate: function(data){ diff --git a/public/assets/js/lib/views/index/lastlog.js b/public/assets/js/lib/views/index/lastlog.js index fe50e0f..02b3cca 100644 --- a/public/assets/js/lib/views/index/lastlog.js +++ b/public/assets/js/lib/views/index/lastlog.js @@ -18,6 +18,10 @@ var LastLog = View.extend({ }, load: function(lastlog){ + if (!lastlog || !lastlog.length) { + this.$el.hide() + return + } var s = lastlog.map(this.parse.bind(this)).filter(s => s).join(', ') this.$el.html(s) }, diff --git a/public/assets/js/lib/views/index/threadbox.js b/public/assets/js/lib/views/index/threadbox.js index 6efce22..79dc4bc 100644 --- a/public/assets/js/lib/views/index/threadbox.js +++ b/public/assets/js/lib/views/index/threadbox.js @@ -25,7 +25,7 @@ var ThreadBox = View.extend({ return b.lastmodified - a.lastmodified }).slice(0, 15) this.appendThreads(latest) - data.threads = data.threads.filter((thread) => thread && !! thread.keyword) + data.threads = data.threads.slice(15).filter((thread) => thread && !! thread.keyword) } var keywords = {} data.threads.forEach((thread) => { |
