Skip to content

Commit 7b88b88

Browse files
committed
Fixes file size by setting it to 100mb. Adds messages for errors
Signed-off-by: Akash Manohar J <[email protected]>
1 parent c4baac9 commit 7b88b88

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

app/assets/javascripts/backbone/plugins/attachments.js.coffee

+15-1
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,28 @@ class Kandan.Plugins.Attachments
8787
fallback_id: "file"
8888
url : "/channels/#{channel_id}/attachments.json",
8989
paramname : "file"
90+
maxfilesize: 100
91+
queuefiles : 1
9092

91-
uploadStarted: =>
93+
uploadStarted: ->
9294
$(".dropzone").text("Uploading...")
9395

96+
error: (err, file)->
97+
if err == "BrowserNotSupported"
98+
$(".dropzone").text("Browser not supported")
99+
else if err == "FileTooLarge"
100+
$(".dropzone").text("File too large")
101+
else
102+
$(".dropzone").text("Sorry bud! couldn't upload")
103+
104+
94105
uploadFinished: (i, file, response, time)->
95106
$(".dropzone").text("Drop files here to upload")
96107
Kandan.Widgets.render "Kandan.Plugins.Attachments"
97108

109+
progressUpdated: (i, file, progress)->
110+
# TODO update dropzone text
111+
98112
dragOver: ->
99113
console.log "reached dropzone!"
100114
})

0 commit comments

Comments
 (0)