summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2018-06-21 11:37:11 +0200
committerJules Laplace <julescarbon@gmail.com>2018-06-21 11:37:18 +0200
commita930387282551c58c04a563cd5b432ffb0334043 (patch)
treea08374237f88e6d68f7a398b80b9aa588eb05ff1
parent9f73794615e3707e9374df1ba130b902d804a1cc (diff)
comment form appends files
-rw-r--r--bucky/app/api.js3
-rw-r--r--bucky/app/bucky.js1
-rw-r--r--public/assets/js/lib/views/details/commentform.js5
3 files changed, 7 insertions, 2 deletions
diff --git a/bucky/app/api.js b/bucky/app/api.js
index 744d675..b4231e7 100644
--- a/bucky/app/api.js
+++ b/bucky/app/api.js
@@ -168,7 +168,8 @@ function route (app){
bucky.bumpThreadRevisions,
function(req, res){
res.json({
- comment: res.comment
+ comment: res.comment,
+ files: res.files,
})
})
app.get("/api/comment/:id",
diff --git a/bucky/app/bucky.js b/bucky/app/bucky.js
index 70cfeec..3824c5e 100644
--- a/bucky/app/bucky.js
+++ b/bucky/app/bucky.js
@@ -511,6 +511,7 @@ var bucky = module.exports = {
})
})
Promise.all(promises).then(values => {
+ res.files = values
next()
}).catch(err => {
console.log(err)
diff --git a/public/assets/js/lib/views/details/commentform.js b/public/assets/js/lib/views/details/commentform.js
index d4a9149..2b76171 100644
--- a/public/assets/js/lib/views/details/commentform.js
+++ b/public/assets/js/lib/views/details/commentform.js
@@ -54,6 +54,9 @@ var CommentForm = FormView.extend({
// window.location.reload()
console.log(this)
console.log(this.parent)
- this.parent.comments.load([data.comment])
+ console.log(data)
+ data.comment && this.parent.comments.load([data.comment])
+ data.files && this.parent.files.load(data.files)
+ data.files && this.parent.gallery.load(data.files)
}
})