Snippet page and edit
This commit is contained in:
parent
5e7478fda7
commit
497fda3251
|
@ -24,8 +24,13 @@ function makeSnippetEdit(ownerName, ownerAvatar, ownerUrl, date, text, attachmen
|
||||||
let attachmentChanged = false;
|
let attachmentChanged = false;
|
||||||
let hasAttachment = false;
|
let hasAttachment = false;
|
||||||
snippetEdit.redirect.value = location.href;
|
snippetEdit.redirect.value = location.href;
|
||||||
snippetEdit.avatarImg.src = ownerAvatar;
|
if (ownerAvatar) {
|
||||||
snippetEdit.avatarLink.href = ownerUrl;
|
snippetEdit.avatarImg.src = ownerAvatar;
|
||||||
|
snippetEdit.avatarLink.href = ownerUrl;
|
||||||
|
snippetEdit.avatarImg.hidden = false;
|
||||||
|
} else {
|
||||||
|
snippetEdit.avatarImg.hidden = true;
|
||||||
|
}
|
||||||
snippetEdit.username.textContent = ownerName;
|
snippetEdit.username.textContent = ownerName;
|
||||||
snippetEdit.username.href = ownerUrl;
|
snippetEdit.username.href = ownerUrl;
|
||||||
snippetEdit.date.textContent = new Intl.DateTimeFormat([], { month: "2-digit", day: "2-digit", year: "numeric" }).format(date);
|
snippetEdit.date.textContent = new Intl.DateTimeFormat([], { month: "2-digit", day: "2-digit", year: "numeric" }).format(date);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<template id="snippet-edit">
|
<template id="snippet-edit">
|
||||||
<form data-tmpl="root" class="snippet-edit-root timeline-item pa3 mb2" method="POST" action="{{ .SnippetEdit.SubmitUrl }}" enctype="multipart/form-data">
|
<form data-tmpl="root" class="hmn-form snippet-edit-root ba b--theme-dim pa3 mb2" method="POST" action="{{ .SnippetEdit.SubmitUrl }}" enctype="multipart/form-data">
|
||||||
{{ csrftoken .Session }}
|
{{ csrftoken .Session }}
|
||||||
<input data-tmpl="redirect" type="hidden" name="redirect" />
|
<input data-tmpl="redirect" type="hidden" name="redirect" />
|
||||||
<input data-tmpl="snippetId" type="hidden" name="snippet_id" />
|
<input data-tmpl="snippetId" type="hidden" name="snippet_id" />
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
<textarea data-tmpl="text" placeholder="Description and/or links" class="w-100 h4 mt3" name="text"></textarea>
|
<textarea data-tmpl="text" placeholder="Description and/or links" class="w-100 h4 mt3" name="text"></textarea>
|
||||||
<div class="mv3">
|
<div class="mv3">
|
||||||
<div data-tmpl="uploadBox">
|
<div data-tmpl="uploadBox">
|
||||||
<a data-tmpl="uploadLink" class="upload-box flex flex-column items-center pa4 b--dimmest br3 mw6" href="javascript:;">
|
<a data-tmpl="uploadLink" class="b--dashed flex flex-column items-center pa4 b--dimmest br3" href="javascript:;">
|
||||||
Upload image, video, or other file
|
Upload image, video, or other file
|
||||||
</a>
|
</a>
|
||||||
<div data-tmpl="uploadResetBox" class="mt2 dn">
|
<div data-tmpl="uploadResetBox" class="mt2 dn">
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
{{ template "base.html" . }}
|
{{ template "base-2024.html" . }}
|
||||||
|
|
||||||
{{ define "extrahead" }}
|
{{ define "extrahead" }}
|
||||||
<script src="{{ static "js/templates.js" }}"></script>
|
<script src="{{ static "js/templates.js" }}"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
{{ define "content" }}
|
{{ define "content" }}
|
||||||
<div class="content-block">
|
<div class="mw-site pa3 center">
|
||||||
{{ template "timeline_item.html" .Snippet }}
|
{{ template "timeline_item.html" .Snippet }}
|
||||||
</div>
|
</div>
|
||||||
{{ if .CanEditSnippet }}
|
{{ if .CanEditSnippet }}
|
||||||
|
|
Loading…
Reference in New Issue