Add lists

This commit is contained in:
r 2022-02-11 11:18:02 +00:00
parent c2f237e901
commit c390a0c327
13 changed files with 322 additions and 33 deletions

View file

@ -46,11 +46,11 @@
<td> <kbd>6</kbd> </td>
</tr>
<tr>
<td> Settings </td>
<td> Lists </td>
<td> <kbd>7</kbd> </td>
</tr>
<tr>
<td> Signout </td>
<td> Settings </td>
<td> <kbd>8</kbd> </td>
</tr>
<tr>

63
templates/list.tmpl Normal file
View file

@ -0,0 +1,63 @@
{{with .Data}}
{{template "header.tmpl" (WithContext .CommonData $.Ctx)}}
<div class="page-title"> List {{.List.Title}} </div>
<form action="/list/{{.List.ID}}/rename" method="POST">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input id="title" name="title" value="{{.List.Title}}">
<button type="submit"> Rename </button>
</form>
<div class="page-title"> Users </div>
{{if .Accounts}}
<table>
{{range .Accounts}}
<tr>
<td class="p-0"> {{template "userlistitem.tmpl" (WithContext . $.Ctx)}} </td>
<td class="p-0">
<form class="user-list-action" action="/list/{{$.Data.List.ID}}/removeuser?uid={{.ID}}" method="POST">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<button type="submit"> Remove </button>
</form>
</td>
</tr>
{{end}}
</table>
{{else}}
<div class="no-data-found">No data found</div>
{{end}}
<div class="page-title"> Add user </div>
<form class="search-form" action="/list/{{.List.ID}}" method="GET">
<span class="post-form-field">
<label for="query"> Query </label>
<input id="query" name="q" value="{{.Q | html}}">
</span>
<button type="submit"> Search </button>
</form>
{{if .Q}}
{{if .SearchAccounts}}
<table>
{{range .SearchAccounts}}
<tr>
<td> {{template "userlistitem.tmpl" (WithContext . $.Ctx)}} </td>
<td>
<form class="user-list-action" action="/list/{{$.Data.List.ID}}/adduser?uid={{.ID}}" method="POST">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<button type="submit"> Add </button>
</form>
</td>
</tr>
{{end}}
</table>
{{else}}
<div class="no-data-found">No data found</div>
{{end}}
{{end}}
{{template "footer.tmpl"}}
{{end}}

35
templates/lists.tmpl Normal file
View file

@ -0,0 +1,35 @@
{{with .Data}}
{{template "header.tmpl" (WithContext .CommonData $.Ctx)}}
<div class="page-title"> Lists </div>
{{range .Lists}}
<div>
<a href="/timeline/list?list={{.ID}}"> {{.Title}} timeline </a>
-
<form class="d-inline" action="/list/{{.ID}}" method="GET">
<button type="submit" class="btn-link"> edit </button>
</form>
-
<form class="d-inline" action="/list/{{.ID}}/remove" method="POST">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<button type="submit" class="btn-link"> delete </button>
</form>
</div>
{{else}}
<div class="no-data-found">No data found</div>
{{end}}
<div class="page-title"> Add list </div>
<form action="/list" method="POST">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<span class="settings-form-field">
<label for="title"> Title </label>
<input id="title" name="title" required>
</span>
<button type="submit"> Add </button>
</form>
{{template "footer.tmpl"}}
{{end}}

View file

@ -17,16 +17,17 @@
<a class="nav-link" href="/timeline/home" accesskey="1" title="Home timeline (1)">home</a>
<a class="nav-link" href="/timeline/direct" accesskey="2" title="Direct timeline (2)">direct</a>
<a class="nav-link" href="/timeline/local" accesskey="3" title="Local timeline (3)">local</a>
<a class="nav-link" href="/timeline/twkn" accesskey="5" title="The Whole Known Netwwork (4)">twkn</a>
<a class="nav-link" href="/timeline/remote" accesskey="4" title="Remote timeline (5)">remote</a>
<a class="nav-link" href="/timeline/twkn" accesskey="4" title="The Whole Known Netwwork (4)">twkn</a>
<a class="nav-link" href="/timeline/remote" accesskey="5" title="Remote timeline (5)">remote</a>
<a class="nav-link" href="/search" accesskey="6" title="Search (6)">search</a>
</div>
<div>
<a class="nav-link" href="/settings" target="_top" accesskey="7" title="Settings (7)">settings</a>
<a class="nav-link" href="/lists" accesskey="7" title="Lists (7)">lists</a>
<a class="nav-link" href="/settings" target="_top" accesskey="8" title="Settings (8)">settings</a>
<form class="signout" action="/signout" method="post" target="_top">
<input type="hidden" name="csrf_token" value="{{$.Ctx.CSRFToken}}">
<input type="hidden" name="referrer" value="{{$.Ctx.Referrer}}">
<input type="submit" value="signout" class="btn-link nav-link" accesskey="8" title="Signout (8)">
<input type="submit" value="signout" class="btn-link nav-link" title="Signout">
</form>
<a class="nav-link" href="/about" accesskey="9" title="About (9)">about</a>
</div>

View file

@ -1,19 +1,7 @@
{{with .Data}}
<div>
{{range .}}
<div class="user-list-item">
<div class="user-list-profile-img">
<a class="img-link" href="/user/{{.ID}}">
<img class="status-profile-img" src="{{.Avatar}}" title="@{{.Acct}}" alt="avatar" height="48" />
</a>
</div>
<div class="user-list-name">
<div class="status-dname"> {{EmojiFilter (html .DisplayName) .Emojis}} </div>
<a class="img-link" href="/user/{{.ID}}">
<div class="status-uname"> @{{.Acct}} </div>
</a>
</div>
</div>
{{template "userlistitem.tmpl" (WithContext . $.Ctx)}}
{{else}}
<div class="no-data-found">No data found</div>
{{end}}

View file

@ -0,0 +1,15 @@
{{with .Data}}
<div class="user-list-item">
<div class="user-list-profile-img">
<a class="img-link" href="/user/{{.ID}}">
<img class="status-profile-img" src="{{.Avatar}}" title="@{{.Acct}}" alt="avatar" height="48" />
</a>
</div>
<div class="user-list-name">
<div class="status-dname"> {{EmojiFilter (html .DisplayName) .Emojis}} </div>
<a class="img-link" href="/user/{{.ID}}">
<div class="status-uname"> @{{.Acct}} </div>
</a>
</div>
</div>
{{end}}