diff options
Diffstat (limited to 'public/assets/js/lib/views/details/index.js')
| -rw-r--r-- | public/assets/js/lib/views/details/index.js | 28 |
1 files changed, 28 insertions, 0 deletions
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" + }, + +}) |
