a mini social media app for small communities
1@include 'partial/header.html' 2 3<h1> 4 @{viewing.get_name()} 5 (@@@viewing.username) 6 7 @if viewing.pronouns != '' 8 (@viewing.pronouns) 9 @end 10 11 @if viewing.muted 12 [muted] 13 @end 14 15 @if viewing.automated 16 [automated] 17 @end 18 19 @if viewing.admin 20 [admin] 21 @end 22</h1> 23 24@if app.logged_in_as(mut ctx, viewing.id) 25<p>this is you!</p> 26 27@if !user.automated 28<script src="/static/js/text_area_counter.js"></script> 29<div> 30 <form action="/api/post/new_post" method="post"> 31 <h2>new post:</h2> 32 33 <p id="title_chars">0/@{app.config.post.title_max_len}</p> 34 <input 35 type="text" 36 name="title" 37 id="title" 38 minlength="@app.config.post.title_min_len" 39 maxlength="@app.config.post.title_max_len" 40 pattern="@app.config.post.title_pattern" 41 placeholder="title" 42 required aria-required 43 autocomplete="off" aria-autocomplete="off" 44 > 45 <br> 46 47 <p id="body_chars">0/@{app.config.post.body_max_len}</p> 48 <textarea 49 name="body" 50 id="body" 51 minlength="@app.config.post.body_min_len" 52 maxlength="@app.config.post.body_max_len" 53 rows="10" 54 cols="30" 55 placeholder="body" 56 required aria-required 57 autocomplete="off" aria-autocomplete="off" 58 ></textarea> 59 <br> 60 61 <input type="submit" value="post!"> 62 </form> 63 64 <script> 65 add_character_counter('title', 'title_chars', @{app.config.post.title_max_len}) 66 add_character_counter('body', 'body_chars', @{app.config.post.body_max_len}) 67 </script> 68</div> 69<hr> 70@end 71@end 72 73@if viewing.bio != '' 74<div> 75 <h2>bio:</h2> 76 <pre id="bio">@viewing.bio</pre> 77</div> 78<hr> 79@end 80 81@if app.logged_in_as(mut ctx, viewing.id) 82<div> 83 <p><a href="/me/saved">saved posts</a></p> 84 <p><a href="/me/saved_for_later">saved for later</a></p> 85</div> 86<hr> 87@end 88 89<div> 90 <h2>recent posts:</h2> 91 @if posts.len > 0 92 @for post in posts 93 @include 'components/post_small.html' 94 @end 95 @else 96 <p>no posts!</p> 97 @end 98</div> 99 100@if ctx.is_logged_in() && user.admin 101<hr> 102 103<div> 104 <h2>admin powers:</h2> 105 <form action="/api/user/set_muted" method="post"> 106 <input 107 type="number" 108 name="id" 109 id="id" 110 value="@user.id" 111 required aria-required 112 readonly aria-readonly 113 hidden aria-hidden 114 > 115 @if !user.muted 116 <input 117 type="checkbox" 118 name="muted" 119 id="muted" 120 value="true" 121 checked aria-checked 122 readonly aria-readonly 123 hidden aria-hidden 124 > 125 <input type="submit" value="mute"> 126 @else 127 <input 128 type="checkbox" 129 name="muted" 130 id="muted" 131 value="false" 132 checked aria-checked 133 readonly aria-readonly 134 hidden aria-hidden 135 > 136 <input type="submit" value="unmute"> 137 @end 138 </form> 139</div> 140@end 141 142@if viewing.bio != '' 143<script src="/static/js/render_body.js"></script> 144<script> 145 render_body('bio') 146</script> 147@end 148 149@include 'partial/footer.html'