summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bucky/app/bucky.js6
-rw-r--r--bucky/app/router.js7
-rw-r--r--public/assets/js/lib/views/details/editcomment.js4
3 files changed, 9 insertions, 8 deletions
diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js
index 2689c4b..8b829da 100644
--- a/bucky/app/bucky.js
+++ b/bucky/app/bucky.js
@@ -235,7 +235,9 @@ var bucky = module.exports = {
}
res.comment.set('comment', req.body.comment)
res.comment.set('date', util.now())
- res.comment.save().then(next).catch(err => {
+ res.comment.save().then(() => {
+ next()
+ }).catch(err => {
res.sendStatus(500)
})
},
@@ -243,7 +245,7 @@ var bucky = module.exports = {
res.comment.destroy().then(() => {
next()
}).catch(err => {
- res.send(500)
+ res.sendStatus(500)
})
},
diff --git a/bucky/app/router.js b/bucky/app/router.js
index 2383ab2..8ff9d87 100644
--- a/bucky/app/router.js
+++ b/bucky/app/router.js
@@ -34,17 +34,17 @@ module.exports = function(app){
app.get("/post/",
middleware.ensureAuthenticated,
function(req, res){
- res.render("pages/post", {title: "Start a new thread" })
+ res.render("pages/post", {title: "Start a new thread"})
}
)
app.get("/post/:keyword",
middleware.ensureAuthenticated,
function(req, res){
- res.render("pages/post", {title: "Start a new thread" })
+ res.render("pages/post", {title: "Start a new thread"})
}
)
app.get("/comment/:id/edit", middleware.ensureAuthenticated, function(req, res){
- res.render("pages/editcomment", {})
+ res.render("pages/editcomment", {title: "Edit comment"})
})
app.get("/api/index",
@@ -138,7 +138,6 @@ module.exports = function(app){
bucky.checkCommentPrivacy,
bucky.destroyComment,
function(req, res){
- console.log("BUAHLAHA")
res.send(200)
})
app.delete("/api/thread/:id",
diff --git a/public/assets/js/lib/views/details/editcomment.js b/public/assets/js/lib/views/details/editcomment.js
index 1e1474f..a290ac4 100644
--- a/public/assets/js/lib/views/details/editcomment.js
+++ b/public/assets/js/lib/views/details/editcomment.js
@@ -7,6 +7,7 @@ var EditCommentForm = FormView.extend({
},
action: "",
+ method: 'put',
initialize: function(){
this.__super__.initialize.call(this)
@@ -17,7 +18,6 @@ var EditCommentForm = FormView.extend({
load: function(id){
this.action = "/api/comment/" + id
$.get(this.action, function(data){
- console.log(data)
this.$comment.val(data.comment.comment).focus()
$("body").removeClass("loading")
}.bind(this))
@@ -37,6 +37,6 @@ var EditCommentForm = FormView.extend({
},
success: function(data){
- window.location.href = "/details/" + data.comment.id
+ window.location.href = "/details/" + data.comment.thread
}
}) \ No newline at end of file