From 2bb87671b1c5b59d6c770627b99a17a784f81e1d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Mon, 7 Sep 2015 01:08:00 -0400 Subject: stub in details page --- public/assets/js/lib/views/details/index.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 public/assets/js/lib/views/details/index.js (limited to 'public/assets/js/lib/views/details/index.js') diff --git a/public/assets/js/lib/views/details/index.js b/public/assets/js/lib/views/details/index.js new file mode 100644 index 0000000..e2adb55 --- /dev/null +++ b/public/assets/js/lib/views/details/index.js @@ -0,0 +1,28 @@ +var DetailsView = View.extend({ + + events: { + }, + + action: "/api/thread/", + + initialize: function(opt){ + this.comments = new CommentsView ({ parent: this }) + this.files = new FilesView ({ parent: this }) + }, + + load: function(id){ + id = id.replace(/\D/g, "") + $.get(this.action + id, this.populate.bind(this)) + }, + + populate: function(data){ + $("h1").html(data.thread.title) + this.comments.load(data.comments) + this.files.load(data.files) + }, + + success: function(){ + window.location.href = "/index" + }, + +}) -- cgit v1.2.3-70-g09d2