dkforest

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

forum.gohtml (2921B)


      1 {{ define "extra-head" }}
      2 <style>
      3     .timestamp {
      4         color: #aaa;
      5         font-size: 11px;
      6     }
      7 </style>
      8 {{ end }}
      9 
     10 {{ define "title" }}dkf - forum{{ end }}
     11 
     12 {{ define "content" }}
     13 
     14 <div class="container-fluid">
     15     <div class="pb-2 mb-4 border-bottom d-flex justify-content-between align-items-center">
     16         <h2>Forum</h2>
     17         <div>
     18             <form method="get" action="/forum/search" class="d-inline-block">
     19                 <div class="input-group" style="width: 250px;">
     20                     <input type="text" name="search" class="form-control form-control-sm d-inline" value="" placeholder="Search" />
     21                     <div class="input-group-append">
     22                         <button class="btn btn-secondary btn-sm">search</button>
     23                     </div>
     24                 </div>
     25             </form>
     26             <a href="/new-thread" class="btn btn-success ml-4">
     27                 <i class="fa fa-plus fa-fw"></i> New thread
     28             </a>
     29         </div>
     30     </div>
     31 
     32     {{ if .Data.ForumCategories }}
     33         <table class="table table-striped" style="border: 1px solid #444;">
     34             <tr>
     35                 <th>Category name</th>
     36             </tr>
     37             {{ range .Data.ForumCategories }}
     38                 <tr>
     39                     <td><a href="/forum/c/{{ .Slug }}">{{ .Name }}</a></td>
     40                 </tr>
     41             {{ end }}
     42         </table>
     43     {{ end }}
     44 
     45     <table class="table table-striped" style="border: 1px solid #444;">
     46         <tr>
     47             <th><div style="width: 30px; display: inline-block;">&nbsp;</div>Thread name</th>
     48             <th class="text-center">Messages</th>
     49             <th>Author</th>
     50             <th>Last Message</th>
     51         </tr>
     52         {{ range .Data.ForumThreads }}
     53         <tr>
     54             <td style="vertical-align: middle;">
     55                 {{ if .IsUnread }}
     56                     <div style="color: green; width: 30px; display: inline-block;">&#9679;</div>
     57                 {{ else }}
     58                     <div style="color: #757575; width: 30px; display: inline-block;">&#9679;</div>
     59                 {{ end }}
     60                 <a href="/t/{{ .UUID }}">{{ .Name }}</a>
     61             </td>
     62             <td class="text-center" style="vertical-align: middle;">{{ .RepliesCount }}</td>
     63             <td>
     64                 <a style="color: {{ .AuthorChatColor }};" href="/u/{{ .Author }}">{{ .Author }}</a><br />
     65                 <span class="timestamp">{{ .CreatedAt.Format "Jan 02, 2006 15:04:05" }}</span>
     66             </td>
     67             <td>
     68                 <a style="color: {{ .LastMsgChatColor }};" href="/u/{{ .LastMsgAuthor }}">{{ .LastMsgAuthor }}</a><br />
     69                 <span class="timestamp">{{ .LastMsgCreatedAt.Format "Jan 02, 2006 15:04:05" }}</span>
     70             </td>
     71         </tr>
     72         {{ else }}
     73         <tr>
     74             <td colspan="4"><em>No thread to display</em></td>
     75         </tr>
     76         {{ end }}
     77     </table>
     78 </div>
     79 
     80 {{ end }}