diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-12-13 00:22:20 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-12-13 00:22:20 +0100 |
| commit | 279ca7c208f6f645ef9a2c91e8a9ee263652d644 (patch) | |
| tree | 6e64b1308efa48b080ebaaa206d76d785906fd56 | |
| parent | 1d38c91fbc8aed5b909c0ce9f60014b219fe792a (diff) | |
sort threads
| -rw-r--r-- | public/assets/js/lib/views/index/index.js | 5 | ||||
| -rw-r--r-- | public/assets/js/lib/views/index/threadbox.js | 4 |
2 files changed, 7 insertions, 2 deletions
diff --git a/public/assets/js/lib/views/index/index.js b/public/assets/js/lib/views/index/index.js index 21aec39..0f2a80e 100644 --- a/public/assets/js/lib/views/index/index.js +++ b/public/assets/js/lib/views/index/index.js @@ -9,17 +9,20 @@ var IndexView = View.extend({ initialize: function(opt){ // opt.parent = parent this.hootbox = new HootBox ({ parent: this }) - this.threadbox = new ThreadBox ({ parent: this, latest: true, welcome: true, }) + this.threadbox = new ThreadBox ({ parent: this }) this.lastlog = new LastLog ({ parent: this }) }, load: function(keyword){ if (keyword) { $(".subtitle").html('<a href="/">< Home</a>') + this.threadbox.options.latest = false this.threadbox.options.welcome = false $.get(this.keywordAction + keyword, this.populate.bind(this)) } else { + this.threadbox.options.latest = true + this.threadbox.options.welcome = true $.get(this.action, this.populate.bind(this)) } }, diff --git a/public/assets/js/lib/views/index/threadbox.js b/public/assets/js/lib/views/index/threadbox.js index f3c4e0f..83ac269 100644 --- a/public/assets/js/lib/views/index/threadbox.js +++ b/public/assets/js/lib/views/index/threadbox.js @@ -35,7 +35,9 @@ var ThreadBox = View.extend({ }) Object.keys(keywords).sort().forEach((keyword) => { this.appendKeyword({ keyword }) - this.appendThreads(keywords[keyword]) + this.appendThreads(keywords[keyword].sort( (a,b) => { + return b.lastmodified - a.lastmodified + })) }) } if (is_mobile || window.innerWidth < 700) { |
