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 && viewing.admin 12 [muted admin, somehow] 13 @else if viewing.muted 14 [muted] 15 @else if viewing.admin 16 [admin] 17 @end 18</h1> 19 20@if app.logged_in_as(mut ctx, viewing.id) 21<p>this is you!</p> 22 23<div> 24 <form action="/api/post/new_post" method="post"> 25 <h2>new post:</h2> 26 <input 27 type="text" 28 name="title" 29 id="title" 30 minlength="@app.config.post.title_min_len" 31 maxlength="@app.config.post.title_max_len" 32 pattern="@app.config.post.title_pattern" 33 placeholder="title" 34 required 35 > 36 <br> 37 <textarea 38 name="body" 39 id="body" 40 minlength="@app.config.post.body_min_len" 41 maxlength="@app.config.post.body_max_len" 42 rows="10" 43 cols="30" 44 placeholder="body" 45 required 46 ></textarea> 47 <br> 48 <input type="submit" value="post!"> 49 </form> 50</div> 51@end 52 53@if viewing.bio != '' 54<div> 55 <h2>bio:</h2> 56 <p>@viewing.bio</p> 57</div> 58@end 59 60<div> 61 <h2>posts:</h2> 62 @for post in app.get_posts_from_user(viewing.id) 63 @include 'components/post_small.html' 64 @end 65</div> 66 67<div> 68 <h2>user info:</h2> 69 <p>id: @viewing.id</p> 70 <p>username: @viewing.username</p> 71 <p>display name: @viewing.get_name()</p> 72 @if app.logged_in_as(mut ctx, viewing.id) 73 <p><a href="/api/user/logout">log out</a></p> 74 <p><a href="/api/user/full_logout">log out of all devices</a></p> 75 @end 76</div> 77 78@if app.logged_in_as(mut ctx, viewing.id) 79<div> 80 <h2>user settings:</h2> 81 <form action="/api/user/set_bio" method="post"> 82 <label for="bio">bio:</label> 83 <br> 84 <textarea 85 name="bio" 86 id="bio" 87 cols="30" 88 rows="10" 89 minlength="@app.config.user.bio_min_len" 90 maxlength="@app.config.user.bio_max_len" 91 required 92 >@user.bio</textarea> 93 <input type="submit" value="save"> 94 </form> 95 <form action="/api/user/set_pronouns" method="post"> 96 <label for="pronouns">pronouns:</label> 97 <input 98 type="text" 99 name="pronouns" 100 id="pronouns" 101 minlength="@app.config.user.pronouns_min_len" 102 maxlength="@app.config.user.pronouns_max_len" 103 pattern="@app.config.user.pronouns_pattern" 104 value="@user.pronouns" 105 required 106 > 107 <br> 108 <input type="submit" value="save"> 109 </form> 110 <form action="/api/user/set_nickname" method="post"> 111 <label for="nickname">nickname:</label> 112 <input 113 type="text" 114 name="nickname" 115 id="nickname" 116 pattern="@app.config.user.nickname_pattern" 117 minlength="@app.config.user.nickname_min_len" 118 maxlength="@app.config.user.nickname_max_len" 119 value="@{user.nickname or { '' }}" 120 required 121 > 122 <input type="submit" value="save"> 123 </form> 124 <form action="/api/user/set_nickname" method="post"> 125 <input type="submit" value="reset nickname"> 126 </form> 127 @if app.config.instance.allow_changing_theme 128 <br> 129 <form action="/api/user/set_theme" method="post"> 130 <label for="url">theme:</label> 131 <input type="url" name="url" id="url" value="@{user.theme or { '' }}"> 132 <input type="submit" value="save"> 133 </form> 134 @end 135</div> 136@end 137 138@if ctx.is_logged_in() && user.admin 139<div> 140 <h2>admin powers:</h2> 141 <form action="/api/user/set_muted" method="post"> 142 <input 143 type="text" 144 name="id" 145 id="id" 146 value="@user.id" 147 required 148 readonly 149 hidden 150 aria-hidden 151 > 152 @if !user.muted 153 <input 154 type="checkbox" 155 name="muted" 156 id="muted" 157 value="true" 158 checked 159 readonly 160 hidden 161 aria-hidden 162 > 163 <input type="submit" value="mute"> 164 @else 165 <input 166 type="checkbox" 167 name="muted" 168 id="muted" 169 value="false" 170 checked 171 readonly 172 hidden 173 aria-hidden 174 > 175 <input type="submit" value="unmute"> 176 @end 177 </form> 178</div> 179@end 180 181@include 'partial/footer.html'