From 8631c4ba8e68fc6d29962597cc86ff06606037a5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Thu, 25 Jan 2018 02:30:55 +0100 Subject: more on profile --- public/assets/js/lib/views/index/threadbox.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'public/assets/js/lib/views/index/threadbox.js') diff --git a/public/assets/js/lib/views/index/threadbox.js b/public/assets/js/lib/views/index/threadbox.js index 01d1de4..157b672 100644 --- a/public/assets/js/lib/views/index/threadbox.js +++ b/public/assets/js/lib/views/index/threadbox.js @@ -9,6 +9,7 @@ var ThreadBox = View.extend({ this.template = this.$(".template").html() this.keywordTemplate = this.$(".keywordTemplate").html() this.welcomeTemplate = this.$(".welcomeTemplate").html() + this.profileTemplate = this.$(".profileTemplate").html() }, load: function(data){ @@ -19,6 +20,10 @@ var ThreadBox = View.extend({ this.appendKeyword(data.keyword) this.appendThreads(data.threads) } + else if (data.user) { + this.appendProfile(data.user) + this.appendThreads(data.threads) + } else { if (this.options.latest) { var latest = data.threads.sort( (a,b) => { @@ -123,4 +128,8 @@ var ThreadBox = View.extend({ this.$el.append(this.welcomeTemplate) }, + appendProfile: function(user){ + this.$el.append(this.profileTemplate.replace(/{{username}}/g, user.username)) + }, + }) -- cgit v1.2.3-70-g09d2