dkforest

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

chat-snippets.gohtml (3320B)


      1 {{ define "extra-head" }}
      2 <style>
      3     .btn-xs {
      4         margin: 0 !important;
      5         padding: 0 4px !important;
      6         font-size: 11px !important;
      7     }
      8 </style>
      9 {{ end }}
     10 
     11 {{ define "sub-content" }}
     12 
     13 <ul class="nav nav-tabs mb-3">
     14     <li class="nav-item">
     15         <a class="nav-link" href="/settings/chat">General</a>
     16     </li>
     17     <li class="nav-item">
     18         <a class="nav-link" href="/settings/chat/pm">PM</a>
     19     </li>
     20     <li class="nav-item">
     21         <a class="nav-link" href="/settings/chat/ignore">Ignore</a>
     22     </li>
     23     <li class="nav-item">
     24         <a class="nav-link active" href="/settings/chat/snippets">Snippets</a>
     25     </li>
     26 </ul>
     27 
     28 {{ if .Data.Error }}
     29     <div class="alert alert-danger">{{ .Data.Error }}</div>
     30 {{ end }}
     31 
     32 
     33 <div class="card mb-3">
     34     <div class="card-header">
     35         {{ t "Snippets" . }}
     36         ({{ .Data.Snippets | len }}/20)
     37     </div>
     38     <div class="card-body">
     39         <p>
     40             Snippets are text replacements that are going to be applied to messages that you send.<br />
     41             You can use them by prefixing a <code>!</code> to the name of your snippet.<br />
     42             For example, if you define a snippet named <code>test</code> with value <code>this is a test</code><br />
     43             Typing <code>Hi, !test, and it works!</code> is the same as typing <code>Hi, this is a test, and it works!</code>
     44         </p>
     45         <div>
     46             <table class="table table-striped table-hover table-sm table-novpadding">
     47                 <tr>
     48                     <th></th>
     49                     <th style="width: 180px;">Name</th>
     50                     <th>Text</th>
     51                 </tr>
     52                 {{ range .Data.Snippets }}
     53                     <tr>
     54                         <td style="width: 40px;">
     55                             <form method="post" class="d-inline">
     56                                 <input type="hidden" name="csrf" value="{{ $.CSRF }}" />
     57                                 <input type="hidden" name="formName" value="rmSnippet" />
     58                                 <input type="hidden" name="snippetName" value="{{ .Name }}" />
     59                                 <button class="btn btn-xs btn-danger" title="delete">×</button>
     60                             </form>
     61                         </td>
     62                         <td>{{ .Name }}</td>
     63                         <td>{{ .Text }}</td>
     64                     </tr>
     65                 {{ else }}
     66                     <tr><td colspan="3"><em>No snippets</em></td></tr>
     67                 {{ end }}
     68             </table>
     69             <form method="post" autocomplete="off">
     70                 <input type="hidden" name="csrf" value="{{ $.CSRF }}" />
     71                 <input type="hidden" name="formName" value="addSnippet" />
     72                 <div class="input-group">
     73                     <input type="text" name="name" value="{{ .Data.Name }}" class="form-control" placeholder="Name (1-20 chars)" style="max-width: 180px;" />
     74                     <input type="text" name="text" value="{{ .Data.Text }}" class="form-control" placeholder="Text (1-1000 chars)" style="width: 300px;" />
     75                     <div class="input-group-append">
     76                         <button class="btn btn-sm btn-primary">Add</button>
     77                     </div>
     78                 </div>
     79             </form>
     80         </div>
     81     </div>
     82 </div>
     83 
     84 {{ end }}