dkforest

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

inbox.gohtml (5236B)


      1 {{ define "sub-extra-head" }}
      2 <style>
      3     .msg p:first-of-type { display: inline; }
      4     .delete_msg_btn {
      5         font-size: 15px;
      6         line-height: 1;
      7     }
      8     .delete_msg_btn::after { content: "×"; }
      9     .mod-btn {
     10         width: 16px; height: 16px;
     11         margin: 0; padding: 0;
     12         border: 1px solid gray;
     13         display: inline;
     14         text-align: center;
     15         vertical-align: middle;
     16         user-select: none;
     17         background-color: #444;
     18         color: #ea2a2a;
     19         -webkit-box-shadow: 1px 1px 1px rgba(0,0,0,0.25);
     20         -moz-box-shadow: 1px 1px 1px rgba(0,0,0,0.25);
     21         -webkit-border-radius: 3px;
     22         -moz-border-radius: 3px;
     23     }
     24     .mod-btn:hover {
     25         background-color: #222;
     26     }
     27 </style>
     28 {{ end }}
     29 
     30 {{ define "title" }}dkf - inbox{{ end }}
     31 
     32 {{ define "sub-content" }}
     33 
     34 <ul class="nav nav-tabs mb-3">
     35     <li class="nav-item">
     36         <a class="nav-link active" href="/settings/inbox">Inbox</a>
     37     </li>
     38     <li class="nav-item">
     39         <a class="nav-link" href="/settings/inbox/sent">Sent</a>
     40     </li>
     41 </ul>
     42 
     43 <div class="card mb-3">
     44     <div class="card-header">
     45         {{ t "Chat inbox" . }}
     46     </div>
     47     <div class="card-body">
     48 <!--        <div class="mb-3">Messages will be auto deleted after a week.</div>-->
     49         <div class="mb-3">
     50             <form method="post" action="/api/v1/inbox/delete-all" style="display: inline;">
     51                 <input type="hidden" name="csrf" value="{{ $.CSRF }}" />
     52                 <button type="submit" class="btn btn-danger btn-sm">Delete all</button>
     53             </form>
     54         </div>
     55         {{ range .Data.Notifs }}
     56             {{ if ne .Notification.ID 0 }}
     57                 <div style="border-bottom: 1px solid #444; color: #888;">
     58                     <form method="post" action="/api/v1/notifications/delete/{{ .Notification.ID }}" style="display: inline;">
     59                         <input type="hidden" name="csrf" value="{{ $.CSRF }}" />
     60                         <button class="mod-btn delete_msg_btn" title="delete"></button>
     61                     </form>
     62                     {{ if not .Notification.IsRead }}
     63                         <span style="color: white;">*</span>
     64                     {{ end }}
     65                     <span style="color: #999; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 23px;">{{ .Notification.CreatedAt.Format "01-02 15:04:05" }}</span> -
     66                     <span>{{ .Notification.Message | safe }}</span>
     67                 </div>
     68             {{ else if ne .SessionNotification.ID 0 }}
     69                 <div style="border-bottom: 1px solid #444; color: #888;">
     70                     <form method="post" action="/api/v1/session-notifications/delete/{{ .SessionNotification.ID }}" style="display: inline;">
     71                         <input type="hidden" name="csrf" value="{{ $.CSRF }}" />
     72                         <button class="mod-btn delete_msg_btn" title="delete"></button>
     73                     </form>
     74                     {{ if not .SessionNotification.IsRead }}
     75                         <span style="color: white;">*</span>
     76                     {{ end }}
     77                     <span style="color: #999; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 23px;">{{ .SessionNotification.CreatedAt.Format "01-02 15:04:05" }}</span> -
     78                     <span>{{ .SessionNotification.Message | safe }}</span>
     79                 </div>
     80             {{ else }}
     81                 <div style="border-bottom: 1px solid #444; color: #888;" class="msg">
     82                     <form method="post" action="/api/v1/inbox/delete/{{ .ChatInboxMessage.ID }}" style="display: inline;">
     83                         <input type="hidden" name="csrf" value="{{ $.CSRF }}" />
     84                         <button class="mod-btn delete_msg_btn" title="delete"></button>
     85                     </form>
     86                     {{ if not .ChatInboxMessage.IsRead }}
     87                         <span style="color: white;">*</span>
     88                     {{ end }}
     89                     Room: <a href="/chat/{{ .ChatInboxMessage.Room.Name }}">#{{ .Room.Name }}</a><br />
     90                     <span style="color: #999; font-family: 'Courier New', Courier, monospace; font-size: 14px; line-height: 23px;">{{ .ChatInboxMessage.CreatedAt.Format "01-02 15:04:05" }}</span> -
     91                     {{ if .IsPm }}
     92                         [<span {{ .ChatInboxMessage.User.GenerateChatStyle | attr }}>{{ .ChatInboxMessage.User.Username }}</span> → <span {{ .ChatInboxMessage.ToUser.GenerateChatStyle | attr }}>{{ .ToUser.Username }}</span>]
     93                     {{ else if .Moderators }}
     94                         [M] <span {{ .ChatInboxMessage.User.GenerateChatStyle | attr }}>{{ .ChatInboxMessage.User.Username }}</span>
     95                     {{ else }}
     96                         <span {{ .ChatInboxMessage.User.GenerateChatStyle | attr }}>{{ .ChatInboxMessage.User.Username }}</span>
     97                     {{ end }}
     98                     -
     99                     <span {{ .ChatInboxMessage.User.GenerateChatStyle | attr }}>{{ .ChatInboxMessage.Message | safe }}</span>
    100                 </div>
    101             {{ end }}
    102         {{ else }}
    103             <div><em>No message to display</em></div>
    104         {{ end }}
    105     </div>
    106 </div>
    107 
    108 {{ end }}