From 27941b20170bea1071edb8ada710917bd539b040 Mon Sep 17 00:00:00 2001 From: James Collins Date: Tue, 23 Apr 2024 02:17:19 +1000 Subject: [PATCH] only show rename info on update of file --- resources/views/components/ui/file.blade.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/resources/views/components/ui/file.blade.php b/resources/views/components/ui/file.blade.php index 3ffa7f9..2db12be 100644 --- a/resources/views/components/ui/file.blade.php +++ b/resources/views/components/ui/file.blade.php @@ -35,11 +35,6 @@ document.getElementById('{{ $name }}_name').innerText = fileName; document.getElementById('{{ $name }}_name').classList.add('italic'); - const newFileInfo = document.createElement('i'); - newFileInfo.classList.add('fa-solid', 'fa-info-circle', 'text-gray-500', 'ml-2'); - newFileInfo.setAttribute('data-tooltip', 'The filename may change from the actual file name if a file with the same name already exists.'); - document.getElementById('{{ $name }}_name').appendChild(newFileInfo); - document.getElementById('{{ $name }}_size').innerText = SM.bytesToString(fileSize); if(fileType.startsWith('image/')) { @@ -61,6 +56,12 @@ const reader = new FileReader(); reader.onload = function(e) { updateDetails(file.name, file.type, file.size, e.target.result); + + const newFileInfo = document.createElement('i'); + newFileInfo.classList.add('fa-solid', 'fa-info-circle', 'text-gray-500', 'ml-2'); + newFileInfo.setAttribute('data-tooltip', 'The filename may change from the actual file name if a file with the same name already exists.'); + document.getElementById('{{ $name }}_name').appendChild(newFileInfo); + if('{{ $onchange }}' !== '' && typeof window['{{ $onchange }}'] === 'function') { window['{{ $onchange }}'](file, file.name); }