From 2e2b3c60678232daa3fd1494a66530e4fa097507 Mon Sep 17 00:00:00 2001 From: Azareal Date: Wed, 17 Apr 2019 13:30:02 +1000 Subject: [PATCH] Fixed a bug where users couldn't post non-image attachments. Fixed a visual padding bug for .uploadItem on Nox. #upload_files now uses .auto_hide instead of an inline style. --- public/global.js | 8 ++++++-- templates/topics_quick_topic.html | 2 +- themes/nox/public/main.css | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/public/global.js b/public/global.js index aa7f0339..f24d8673 100644 --- a/public/global.js +++ b/public/global.js @@ -939,6 +939,7 @@ function mainInit(){ }); } catch(e) { // TODO: Use a notice instead + console.log("e:",e); alert(e); } } @@ -952,11 +953,13 @@ function mainInit(){ let fileItem = document.createElement("label"); console.log("fileItem",fileItem); - let ext = getExt(filename) + let ext = getExt(filename); + // TODO: Push ImageFileExts to the client from the server in some sort of gen.js? + let isImage = ["png", "jpg", "jpeg", "svg", "bmp", "gif", "tif", "webp"].includes(ext); fileItem.innerText = "." + ext; fileItem.className = "formbutton uploadItem"; // TODO: Check if this is actually an image - fileItem.style.backgroundImage = "url("+e.target.result+")"; + if(isImage) fileItem.style.backgroundImage = "url("+e.target.result+")"; fileDock.appendChild(fileItem); },(e,hash, filename) => { @@ -976,6 +979,7 @@ function mainInit(){ }); } catch(e) { // TODO: Use a notice instead + console.log("e:",e); alert(e); } } diff --git a/templates/topics_quick_topic.html b/templates/topics_quick_topic.html index 2d511ed4..2d2c1195 100644 --- a/templates/topics_quick_topic.html +++ b/templates/topics_quick_topic.html @@ -18,7 +18,7 @@ {{if .CurrentUser.Perms.UploadFiles}} - +
{{end}} diff --git a/themes/nox/public/main.css b/themes/nox/public/main.css index 39c50a16..a69090d5 100644 --- a/themes/nox/public/main.css +++ b/themes/nox/public/main.css @@ -418,6 +418,9 @@ h2 { height: 100px; resize: vertical; } +.uploadItem { + display: inline-block; +} .more_topic_block_initial { display: none;