a mini social media app for small communities
at main 2.0 kB view raw
1@include 'partial/header.html' 2 3<script src="/static/js/post.js" defer></script> 4<script src="/static/js/render_body.js" defer></script> 5<script src="/static/js/text_area_counter.js"></script> 6 7<h1>edit post</h1> 8 9<div class="post post-full"> 10 <form action="/api/post/edit" method="post" beep-redirect="/post/@post.id"> 11 <input 12 type="number" 13 name="id" 14 id="id" 15 placeholder="post id" 16 value="@post.id" 17 required 18 readonly 19 hidden 20 aria-hidden 21 > 22 23 <p id="title_chars">0/@{app.config.post.title_max_len}</p> 24 <input 25 type="text" 26 name="title" 27 id="title" 28 minlength="@app.config.post.title_min_len" 29 maxlength="@app.config.post.title_max_len" 30 pattern="@app.config.post.title_pattern" 31 placeholder="title" 32 value="@post.title" 33 required 34 > 35 <br> 36 37 <p id="body_chars">0/@{app.config.post.body_max_len}</p> 38 <textarea 39 name="body" 40 id="body" 41 minlength="@app.config.post.body_min_len" 42 maxlength="@app.config.post.body_max_len" 43 rows="10" 44 cols="30" 45 placeholder="body" 46 required 47 >@post.body</textarea> 48 <br> 49 50 @if app.config.post.allow_nsfw 51 <div> 52 <label for="nsfw">is nsfw:</label> 53 <input 54 type="checkbox" 55 name="nsfw" 56 id="nsfw" 57 @if post.nsfw 58 checked aria-checked 59 @end 60 /> 61 </div> 62 <br> 63 @else 64 <input type="checkbox" name="nsfw" id="nsfw" hidden aria-hidden /> 65 @end 66 67 <input type="submit" value="save"> 68 </form> 69</div> 70 71<hr> 72 73<div> 74 <h2>danger zone:</h2> 75 <form action="/api/post/delete" method="post" beep-redirect="/"> 76 <input 77 type="number" 78 name="id" 79 id="id" 80 placeholder="post id" 81 value="@post.id" 82 required aria-required 83 readonly aria-readonly 84 hidden aria-hidden 85 > 86 <input type="submit" value="delete"> 87 </form> 88</div> 89 90<script> 91 add_character_counter('title', 'title_chars', @{app.config.post.title_max_len}) 92 add_character_counter('body', 'body_chars', @{app.config.post.body_max_len}) 93</script> 94 95@include 'partial/footer.html'