diff options
| author | Bobby Wibowo <[email protected]> | 2018-04-26 13:51:17 +0700 |
|---|---|---|
| committer | Crawl <[email protected]> | 2018-04-26 08:51:17 +0200 |
| commit | 08637b9ea98b63612f419f580a091d40798a76a1 (patch) | |
| tree | 0059d2d9fcccb90d3e4f903418892004f25d5003 /public | |
| parent | SEMICOLONS, ermahgerd (#93) (diff) | |
| download | host.fuwn.me-08637b9ea98b63612f419f580a091d40798a76a1.tar.xz host.fuwn.me-08637b9ea98b63612f419f580a091d40798a76a1.zip | |
fixed "add to album" error on uploads (#92)
* Updates
Fixed the way error when adding album is being handled.
* I guess that sounds about right.
Diffstat (limited to 'public')
| -rw-r--r-- | public/js/home.js | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/public/js/home.js b/public/js/home.js index 383e245..771244a 100644 --- a/public/js/home.js +++ b/public/js/home.js @@ -155,20 +155,21 @@ upload.prepareDropzone = function(){ // Handle the responseText here. For example, add the text to the preview element: - if(response.success === false){ - var span = document.createElement('span'); - span.innerHTML = response.description; - file.previewTemplate.querySelector('.link').appendChild(span); - return; + if (response.success === false) { + var p = document.createElement('p'); + p.innerHTML = response.description; + file.previewTemplate.querySelector('.link').appendChild(p); } - a = document.createElement('a'); - a.href = response.files[0].url; - a.target = '_blank'; - a.innerHTML = response.files[0].url; - file.previewTemplate.querySelector('.link').appendChild(a); - - file.previewTemplate.querySelector('.progress').style.display = 'none'; + if (response.files[0].url) { + a = document.createElement('a'); + a.href = response.files[0].url; + a.target = '_blank'; + a.innerHTML = response.files[0].url; + file.previewTemplate.querySelector('.link').appendChild(a); + + file.previewTemplate.querySelector('.progress').style.display = 'none'; + } }); |