a mini social media app for small communities
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"> 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 <input type="submit" value="save"> 51 </form> 52</div> 53 54<hr> 55 56<div> 57 <h2>danger zone:</h2> 58 <form action="/api/post/delete" method="post"> 59 <input 60 type="number" 61 name="id" 62 id="id" 63 placeholder="post id" 64 value="@post.id" 65 required aria-required 66 readonly aria-readonly 67 hidden aria-hidden 68 > 69 <input type="submit" value="delete"> 70 </form> 71</div> 72 73<script> 74 add_character_counter('title', 'title_chars', @{app.config.post.title_max_len}) 75 add_character_counter('body', 'body_chars', @{app.config.post.body_max_len}) 76</script> 77 78@include 'partial/footer.html'