From 497fda32515dca296d7258a445d225ffbc11a1a6 Mon Sep 17 00:00:00 2001 From: Asaf Gartner Date: Sun, 23 Jun 2024 17:12:20 +0300 Subject: [PATCH] Snippet page and edit --- public/js/snippetedit.js | 9 +++++++-- src/templates/src/include/snippet_edit.html | 4 ++-- src/templates/src/snippet.html | 4 ++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/public/js/snippetedit.js b/public/js/snippetedit.js index 4d4e9d4d..8716b528 100644 --- a/public/js/snippetedit.js +++ b/public/js/snippetedit.js @@ -24,8 +24,13 @@ function makeSnippetEdit(ownerName, ownerAvatar, ownerUrl, date, text, attachmen let attachmentChanged = false; let hasAttachment = false; snippetEdit.redirect.value = location.href; - snippetEdit.avatarImg.src = ownerAvatar; - snippetEdit.avatarLink.href = ownerUrl; + if (ownerAvatar) { + snippetEdit.avatarImg.src = ownerAvatar; + snippetEdit.avatarLink.href = ownerUrl; + snippetEdit.avatarImg.hidden = false; + } else { + snippetEdit.avatarImg.hidden = true; + } snippetEdit.username.textContent = ownerName; snippetEdit.username.href = ownerUrl; snippetEdit.date.textContent = new Intl.DateTimeFormat([], { month: "2-digit", day: "2-digit", year: "numeric" }).format(date); diff --git a/src/templates/src/include/snippet_edit.html b/src/templates/src/include/snippet_edit.html index f53d1a3e..229c9a91 100644 --- a/src/templates/src/include/snippet_edit.html +++ b/src/templates/src/include/snippet_edit.html @@ -9,7 +9,7 @@