dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

rooms.gohtml (2404B)


      1 {{ define "sub-content" }}
      2 <div class="pb-2 mt-4 mb-4 border-bottom">
      3     <h2>{{ .Data.RoomsCount | comma }} Rooms</h2>
      4 </div>
      5 
      6 <table class="table table-striped table-sm table-novpadding table-dark">
      7     <thead>
      8     <tr>
      9         <th>Name</th>
     10         <th>Owner</th>
     11         <th>Created at</th>
     12         <th class="text-center">Password</th>
     13         <th class="text-center">Listed</th>
     14         <th class="text-center">Ephemeral</th>
     15         <th class="text-right" style="width: 140px;">Actions</th>
     16     </tr>
     17     </thead>
     18     <tbody>
     19     {{ range .Data.Rooms }}
     20         <tr>
     21             <td><a href="/chat/{{ .Name }}">{{ .Name }}</a></td>
     22             <td>{{ if .OwnerUser }}<a href="/admin/users/{{ .OwnerUser.ID }}/edit">{{ .OwnerUser.Username }}</a>{{ else }}<em>n/a</em>{{ end }}</td>
     23             <td>{{ .CreatedAt.Format "Jan 02, 2006 - 15:04:05" }}</td>
     24             <td class="text-center align-middle">
     25                 {{ (ne .Password "") | fmtBool }}
     26             </td>
     27             <td class="text-center align-middle">
     28                 {{ .IsListed | fmtBool }}
     29             </td>
     30             <td class="text-center align-middle">
     31                 {{ .IsEphemeral | fmtBool }}
     32             </td>
     33             <td class="text-right">
     34                 {{ if not .OwnerUser }}
     35                     <a href="/admin/rooms/{{ .ID }}/edit" class="btn btn-sm btn-secondary disabled">E</a>
     36                     <button type="submit" class="btn btn-danger btn-sm disabled" title="Delete user" disabled>X</button>
     37                 {{ else }}
     38                     <a href="/admin/rooms/{{ .ID }}/edit" class="btn btn-sm btn-secondary">E</a>
     39                     <form class="d-inline" id="delete_user_{{ .ID }}" action="/admin/rooms/{{ .ID }}/delete" method="post">
     40                         <input type="hidden" name="csrf" value="{{ $.CSRF }}" />
     41                         <button type="submit" class="btn btn-danger btn-sm" title="Delete room">X</button>
     42                     </form>
     43                 {{ end }}
     44             </td>
     45         </tr>
     46     {{ end }}
     47     </tbody>
     48 </table>
     49 
     50 <div class="mb-5">
     51     <a href="?p={{ add .Data.CurrentPage -1 }}" class="btn btn-light{{ if le .Data.CurrentPage 1 }} disabled{{ end }}">&laquo; {{ t "Prev" . }}</a>
     52     <a href="?p={{ add .Data.CurrentPage 1 }}" class="btn btn-light{{ if eq .Data.CurrentPage .Data.MaxPage }} disabled{{ end }}">{{ t "Next" . }} &raquo;</a>
     53 </div>
     54 {{ end }}