summaryrefslogtreecommitdiff
path: root/public/assets/js/lib/views
diff options
context:
space:
mode:
Diffstat (limited to 'public/assets/js/lib/views')
-rw-r--r--public/assets/js/lib/views/details/commentform.js1
-rw-r--r--public/assets/js/lib/views/details/files.js2
-rw-r--r--public/assets/js/lib/views/details/settings.js48
3 files changed, 26 insertions, 25 deletions
diff --git a/public/assets/js/lib/views/details/commentform.js b/public/assets/js/lib/views/details/commentform.js
index 51295cb..f3d79ac 100644
--- a/public/assets/js/lib/views/details/commentform.js
+++ b/public/assets/js/lib/views/details/commentform.js
@@ -54,6 +54,7 @@ var CommentForm = FormView.extend({
// window.location.reload()
console.log(this)
console.log(this.parent)
+ console.log("this is data")
console.log(data)
data.comment && this.parent.comments.load([data.comment])
data.files && this.parent.files.load(data.files)
diff --git a/public/assets/js/lib/views/details/files.js b/public/assets/js/lib/views/details/files.js
index 98b9350..915f90b 100644
--- a/public/assets/js/lib/views/details/files.js
+++ b/public/assets/js/lib/views/details/files.js
@@ -21,7 +21,7 @@ var FilesView = FormView.extend({
}
var total = 0, has_music = false
- this.files = files || this.files
+ this.files = this.files.concat(files)
this.thread = thread || this.thread
this.files.forEach(function(file){
if (is_image(file.filename)) {
diff --git a/public/assets/js/lib/views/details/settings.js b/public/assets/js/lib/views/details/settings.js
index a027b12..b270f02 100644
--- a/public/assets/js/lib/views/details/settings.js
+++ b/public/assets/js/lib/views/details/settings.js
@@ -316,32 +316,32 @@ var ThreadSettingsForm = FormView.extend({
file_names.join("\n")
var should_remove = confirm(msg)
if (should_remove) {
- }
- var promises = inputs_checked.map(node => {
- return new Promise((resolve, reject) => {
- $.ajax({
- method: "DELETE",
- url: "/api/file/" + node.value,
- headers: { "csrf-token": $("[name=_csrf]").attr("value") },
- data: JSON.stringify({ csrf: csrf() }),
- dataType: "json",
- success: function(data){
- console.log(data)
- $(node).closest('.file').remove()
- },
- error: function(){
- console.log('error deleting file', node.value)
- reject()
- }
+ var promises = inputs_checked.map(node => {
+ return new Promise((resolve, reject) => {
+ $.ajax({
+ method: "DELETE",
+ url: "/api/file/" + node.value,
+ headers: { "csrf-token": $("[name=_csrf]").attr("value") },
+ data: JSON.stringify({ csrf: csrf() }),
+ dataType: "json",
+ success: function(data){
+ console.log(data)
+ $(node).closest('.file').remove()
+ },
+ error: function(){
+ console.log('error deleting file', node.value)
+ reject()
+ }
+ })
})
})
- })
- Promise.all(promises).then( () => {
- window.location.href = '/details/' + thread_id
- }).catch(() =>{
- console.error('whaaaaa')
- alert('there was a problem deleting the files...')
- })
+ Promise.all(promises).then( () => {
+ window.location.href = '/details/' + thread_id
+ }).catch(() =>{
+ console.error('whaaaaa')
+ alert('there was a problem deleting the files...')
+ })
+ }
},
deleteThread: function(e){