diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-12-07 22:24:50 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-12-07 22:24:50 +0100 |
| commit | 340c3080b38518976c5c833399d8e07a7fc561bf (patch) | |
| tree | a81a5e5e1022557650e71f7f282b9175509c3f6f /public/assets/js/lib/views/details/index.js | |
| parent | 72ef99ec0666ce0a4d7051a4a7a89c54a86014b8 (diff) | |
show post metadata and thread list
Diffstat (limited to 'public/assets/js/lib/views/details/index.js')
| -rw-r--r-- | public/assets/js/lib/views/details/index.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/public/assets/js/lib/views/details/index.js b/public/assets/js/lib/views/details/index.js index 554c475..6290738 100644 --- a/public/assets/js/lib/views/details/index.js +++ b/public/assets/js/lib/views/details/index.js @@ -6,11 +6,13 @@ var DetailsView = View.extend({ action: "/api/thread/", keywordAction: "/api/keyword/", + initialize: function(opt){ this.comments = new CommentsView ({ parent: this }) this.files = new FilesView ({ parent: this }) this.gallery = new GalleryView ({ parent: this }) this.threadbox = new ThreadBox ({ parent: this }) + this.metadataTemplate = $(".metadata_template").html() }, load: function(id){ @@ -19,7 +21,20 @@ var DetailsView = View.extend({ }, populate: function(data){ - $("h1").html(data.thread.title) + var thread = data.thread + $("h1").html(thread.title) + var datetime = verbose_date(thread.createdate, true) + var age = get_age(thread.lastmodified, true) + var t = this.metadataTemplate + .replace(/{{ username }}/g, thread.username) + .replace(/{{ date }}/g, datetime[0]) + .replace(/{{ time }}/g, datetime[1]) + .replace(/{{ active }}/g, age + " ago") + .replace(/{{ views }}/g, thread.viewed + " " + courtesy_s(thread.viewed, "view")) +console.log(t) + console.log(data.thread) +// name date time active views + $(".metadata").html(t) this.comments.load(data.comments) this.files.load(data.files) this.gallery.load(data.files) |
