Compare commits

..

2 Commits

Author SHA1 Message Date
Chris Sexton d9342f184e web: make cards display in grid 2024-05-21 12:36:33 -04:00
Chris Sexton 87bf26e039 web: refactor site into picocss from foundation 2024-05-21 08:54:12 -04:00
14 changed files with 371 additions and 352 deletions

View File

@ -4,8 +4,24 @@ import "fmt"
templ (w *Web) Header(title string) { templ (w *Web) Header(title string) {
<head> <head>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/foundation-sites@6.8.1/dist/css/foundation.min.css" />
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css"
/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/flexboxgrid/6.3.1/flexboxgrid.min.css" type="text/css" />
<style>
.navTitle {
text-style: none;
color: var(--pico-h1-color);
}
input:invalid {
border: 2px dashed red;
}
button {
padding: 5px;
}
</style>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
if title != "" { if title != "" {
<title>{ w.botName() } - { title }</title> <title>{ w.botName() } - { title }</title>
@ -17,8 +33,6 @@ templ (w *Web) Header(title string) {
templ (w *Web) Footer() { templ (w *Web) Footer() {
<script src="//unpkg.com/htmx.org@1.9.10" integrity="sha384-D1Kt99CQMDuVetoL1lrYwg5t+9QdHe7NLX/SoJYkXDFfX37iInKRy5xLSi8nO7UC" crossorigin="anonymous"></script> <script src="//unpkg.com/htmx.org@1.9.10" integrity="sha384-D1Kt99CQMDuVetoL1lrYwg5t+9QdHe7NLX/SoJYkXDFfX37iInKRy5xLSi8nO7UC" crossorigin="anonymous"></script>
<script src="//cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/foundation-sites@6.8.1/dist/js/foundation.min.js"></script>
} }
templ (w *Web) Index(title string, contents templ.Component) { templ (w *Web) Index(title string, contents templ.Component) {
@ -29,21 +43,26 @@ templ (w *Web) Index(title string, contents templ.Component) {
@w.Nav(title) @w.Nav(title)
<main class="container-fluid">
if contents != nil { if contents != nil {
@contents @contents
} }
</main>
<footer>
@w.Footer() @w.Footer()
</footer>
</body> </body>
</html> </html>
} }
templ (w *Web) Nav(currentPage string) { templ (w *Web) Nav(currentPage string) {
<header>
<div class="top-bar"> <nav style="margin-right: 2em; margin-left: 2em">
<div class="top-bar-left"> <ul>
<ul class="menu"> <li><strong><a href="/" class="navTitle">{ w.botName() }</a></strong></li>
<li><a style="color: black; font-weight: bold;" href="/">{ w.botName() }</a></li> </ul>
<ul>
for _, item := range w.GetWebNavigation() { for _, item := range w.GetWebNavigation() {
<li> <li>
if currentPage == item.Name { if currentPage == item.Name {
@ -54,16 +73,12 @@ templ (w *Web) Nav(currentPage string) {
</li> </li>
} }
</ul> </ul>
</div> </nav>
</div> </header>
} }
templ (w *Web) showStats() { templ (w *Web) showStats() {
<div class="grid-container">
<div class="cell">
<h2>Stats</h2> <h2>Stats</h2>
</div>
<div class="cell">
<table> <table>
<tr> <tr>
@ -79,6 +94,4 @@ templ (w *Web) showStats() {
<td>{ w.stats.Uptime() }</td> <td>{ w.stats.Uptime() }</td>
</tr> </tr>
</table> </table>
</div>
</div>
} }

View File

@ -25,7 +25,7 @@ func (w *Web) Header(title string) templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent templ_7745c5c3_Var1 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<head><link rel=\"stylesheet\" href=\"//cdn.jsdelivr.net/npm/foundation-sites@6.8.1/dist/css/foundation.min.css\"><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><meta charset=\"UTF-8\">") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"><link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.min.css\"><link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/flexboxgrid/6.3.1/flexboxgrid.min.css\" type=\"text/css\"><style>\n .navTitle {\n text-style: none;\n color: var(--pico-h1-color);\n }\n input:invalid {\n border: 2px dashed red;\n }\n button {\n padding: 5px;\n }\n </style><meta charset=\"UTF-8\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -37,7 +37,7 @@ func (w *Web) Header(title string) templ.Component {
var templ_7745c5c3_Var2 string var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(w.botName()) templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(w.botName())
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 10, Col: 32} return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 26, Col: 32}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -50,7 +50,7 @@ func (w *Web) Header(title string) templ.Component {
var templ_7745c5c3_Var3 string var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(title) templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(title)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 10, Col: 44} return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 26, Col: 44}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -68,7 +68,7 @@ func (w *Web) Header(title string) templ.Component {
var templ_7745c5c3_Var4 string var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(w.botName()) templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(w.botName())
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 12, Col: 32} return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 28, Col: 32}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -103,7 +103,7 @@ func (w *Web) Footer() templ.Component {
templ_7745c5c3_Var5 = templ.NopComponent templ_7745c5c3_Var5 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script src=\"//unpkg.com/htmx.org@1.9.10\" integrity=\"sha384-D1Kt99CQMDuVetoL1lrYwg5t+9QdHe7NLX/SoJYkXDFfX37iInKRy5xLSi8nO7UC\" crossorigin=\"anonymous\"></script><script src=\"//cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js\"></script><script src=\"//cdn.jsdelivr.net/npm/foundation-sites@6.8.1/dist/js/foundation.min.js\"></script>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<script src=\"//unpkg.com/htmx.org@1.9.10\" integrity=\"sha384-D1Kt99CQMDuVetoL1lrYwg5t+9QdHe7NLX/SoJYkXDFfX37iInKRy5xLSi8nO7UC\" crossorigin=\"anonymous\"></script>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -143,17 +143,25 @@ func (w *Web) Index(title string, contents templ.Component) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<main class=\"container-fluid\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if contents != nil { if contents != nil {
templ_7745c5c3_Err = contents.Render(ctx, templ_7745c5c3_Buffer) templ_7745c5c3_Err = contents.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</main><footer>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = w.Footer().Render(ctx, templ_7745c5c3_Buffer) templ_7745c5c3_Err = w.Footer().Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</body></html>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</footer></body></html>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -177,20 +185,20 @@ func (w *Web) Nav(currentPage string) templ.Component {
templ_7745c5c3_Var7 = templ.NopComponent templ_7745c5c3_Var7 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"top-bar\"><div class=\"top-bar-left\"><ul class=\"menu\"><li><a style=\"color: black; font-weight: bold;\" href=\"/\">") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<header><nav style=\"margin-right: 2em; margin-left: 2em\"><ul><li><strong><a href=\"/\" class=\"navTitle\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var8 string var templ_7745c5c3_Var8 string
templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(w.botName()) templ_7745c5c3_Var8, templ_7745c5c3_Err = templ.JoinStringErrs(w.botName())
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 45, Col: 86} return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 62, Col: 62}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var8))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a></li>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</a></strong></li></ul><ul>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -216,7 +224,7 @@ func (w *Web) Nav(currentPage string) templ.Component {
var templ_7745c5c3_Var10 string var templ_7745c5c3_Var10 string
templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(item.Name) templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.JoinStringErrs(item.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 49, Col: 109} return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 68, Col: 101}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var10))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -243,7 +251,7 @@ func (w *Web) Nav(currentPage string) templ.Component {
var templ_7745c5c3_Var12 string var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(item.Name) templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(item.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 51, Col: 71} return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 70, Col: 63}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -259,7 +267,7 @@ func (w *Web) Nav(currentPage string) templ.Component {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</ul></div></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</ul></nav></header>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -283,14 +291,14 @@ func (w *Web) showStats() templ.Component {
templ_7745c5c3_Var13 = templ.NopComponent templ_7745c5c3_Var13 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"grid-container\"><div class=\"cell\"><h2>Stats</h2></div><div class=\"cell\"><table><tr><td>Messages Seen</td><td>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h2>Stats</h2><table><tr><td>Messages Seen</td><td>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var14 string var templ_7745c5c3_Var14 string
templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", w.stats.MessagesRcv)) templ_7745c5c3_Var14, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", w.stats.MessagesRcv))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 70, Col: 56} return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 85, Col: 56}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var14))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -303,7 +311,7 @@ func (w *Web) showStats() templ.Component {
var templ_7745c5c3_Var15 string var templ_7745c5c3_Var15 string
templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", w.stats.MessagesSent)) templ_7745c5c3_Var15, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", w.stats.MessagesSent))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 74, Col: 57} return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 89, Col: 57}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var15))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -316,13 +324,13 @@ func (w *Web) showStats() templ.Component {
var templ_7745c5c3_Var16 string var templ_7745c5c3_Var16 string
templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(w.stats.Uptime()) templ_7745c5c3_Var16, templ_7745c5c3_Err = templ.JoinStringErrs(w.stats.Uptime())
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 78, Col: 34} return templ.Error{Err: templ_7745c5c3_Err, FileName: `bot/web/index.templ`, Line: 93, Col: 34}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var16))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td></tr></table></div></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</td></tr></table>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }

View File

@ -3,44 +3,31 @@ package admin
import "fmt" import "fmt"
templ (a *AdminPlugin) page() { templ (a *AdminPlugin) page() {
<div class="grid-container">
<form> <form>
<div class="grid-x grid-margin-x align-bottom">
<h2>App Pass</h2> <h2>App Pass</h2>
</div>
<div class="grid-x grid-margin-x align-bottom">
<div class="cell auto">
<label for="password">Password: <label for="password">Password:
<input type="text" name="password"></input> <input type="text" name="password"></input>
</label> </label>
</div>
<div class="cell auto">
<label for="secret">Secret: <label for="secret">Secret:
<input type="text" name="secret"></input> <input type="text" name="secret"></input>
</label> </label>
</div>
<div class="cell auto">
<button hx-post="/apppass/api" hx-target="#data" class="button">List</button> <button hx-post="/apppass/api" hx-target="#data" class="button">List</button>
<button hx-put="/apppass/api" hx-target="#data" class="submit success button">New</button> <button hx-put="/apppass/api" hx-target="#data" class="submit success button">New</button>
</div>
</div>
<div class="grid-x"> <div style="margin-top: 2em" class="cell" id="data"></div>
<div class="cell" id="data"></div>
</div>
</form> </form>
</div>
} }
templ (a *AdminPlugin) showPassword(entry PassEntry) { templ (a *AdminPlugin) showPassword(entry PassEntry) {
<div><span style="margin-right: 2em">ID</span><span>{ fmt.Sprintf(" %d", entry.ID) }</span></div> <h2>New Entry</h2>
<div><span style="margin-right: 2em">Password</span><span> { entry.Secret }:{ entry.Pass }</span></div> <p>ID: { fmt.Sprintf(" %d", entry.ID) }</p>
<p>Password: { entry.Secret }:{ entry.Pass }</p>
} }
templ (a *AdminPlugin) entries(items []PassEntry) { templ (a *AdminPlugin) entries(items []PassEntry) {
<div> <h2>Entry List</h2>
if len(items) == 0 { if len(items) == 0 {
<span>No items</span> <p>No items</p>
} }
<ul> <ul>
for _, entry := range items { for _, entry := range items {
@ -56,7 +43,6 @@ templ (a *AdminPlugin) entries(items []PassEntry) {
</li> </li>
} }
</ul> </ul>
</div>
} }
templ renderError(err error) { templ renderError(err error) {
@ -64,7 +50,6 @@ templ renderError(err error) {
} }
templ vars(items []configEntry) { templ vars(items []configEntry) {
<div class="container">
<h2>Variables</h2> <h2>Variables</h2>
<table class="hover striped"> <table class="hover striped">
<thead> <thead>
@ -86,5 +71,4 @@ templ vars(items []configEntry) {
} }
</tbody> </tbody>
</table> </table>
</div>
} }

View File

@ -25,7 +25,7 @@ func (a *AdminPlugin) page() templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent templ_7745c5c3_Var1 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"grid-container\"><form><div class=\"grid-x grid-margin-x align-bottom\"><h2>App Pass</h2></div><div class=\"grid-x grid-margin-x align-bottom\"><div class=\"cell auto\"><label for=\"password\">Password: <input type=\"text\" name=\"password\"></label></div><div class=\"cell auto\"><label for=\"secret\">Secret: <input type=\"text\" name=\"secret\"></label></div><div class=\"cell auto\"><button hx-post=\"/apppass/api\" hx-target=\"#data\" class=\"button\">List</button> <button hx-put=\"/apppass/api\" hx-target=\"#data\" class=\"submit success button\">New</button></div></div><div class=\"grid-x\"><div class=\"cell\" id=\"data\"></div></div></form></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<form><h2>App Pass</h2><label for=\"password\">Password: <input type=\"text\" name=\"password\"></label> <label for=\"secret\">Secret: <input type=\"text\" name=\"secret\"></label> <button hx-post=\"/apppass/api\" hx-target=\"#data\" class=\"button\">List</button> <button hx-put=\"/apppass/api\" hx-target=\"#data\" class=\"submit success button\">New</button><div style=\"margin-top: 2em\" class=\"cell\" id=\"data\"></div></form>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -49,27 +49,27 @@ func (a *AdminPlugin) showPassword(entry PassEntry) templ.Component {
templ_7745c5c3_Var2 = templ.NopComponent templ_7745c5c3_Var2 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div><span style=\"margin-right: 2em\">ID</span><span>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h2>New Entry</h2><p>ID: ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var3 string var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf(" %d", entry.ID)) templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf(" %d", entry.ID))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 35, Col: 86} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 22, Col: 41}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span></div><div><span style=\"margin-right: 2em\">Password</span><span>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p><p>Password: ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var4 string var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(entry.Secret) templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(entry.Secret)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 36, Col: 77} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 23, Col: 31}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -82,13 +82,13 @@ func (a *AdminPlugin) showPassword(entry PassEntry) templ.Component {
var templ_7745c5c3_Var5 string var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(entry.Pass) templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(entry.Pass)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 36, Col: 92} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 23, Col: 46}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</span></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -112,12 +112,12 @@ func (a *AdminPlugin) entries(items []PassEntry) templ.Component {
templ_7745c5c3_Var6 = templ.NopComponent templ_7745c5c3_Var6 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h2>Entry List</h2>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
if len(items) == 0 { if len(items) == 0 {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<span>No items</span>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<p>No items</p>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -150,7 +150,7 @@ func (a *AdminPlugin) entries(items []PassEntry) templ.Component {
var templ_7745c5c3_Var7 string var templ_7745c5c3_Var7 string
templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", entry.ID)) templ_7745c5c3_Var7, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", entry.ID))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 54, Col: 57} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 41, Col: 49}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var7))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -161,7 +161,7 @@ func (a *AdminPlugin) entries(items []PassEntry) templ.Component {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</ul></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</ul>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -192,7 +192,7 @@ func renderError(err error) templ.Component {
var templ_7745c5c3_Var9 string var templ_7745c5c3_Var9 string
templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(err.Error()) templ_7745c5c3_Var9, templ_7745c5c3_Err = templ.JoinStringErrs(err.Error())
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 62, Col: 22} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 48, Col: 22}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var9))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -222,7 +222,7 @@ func vars(items []configEntry) templ.Component {
templ_7745c5c3_Var10 = templ.NopComponent templ_7745c5c3_Var10 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"container\"><h2>Variables</h2><table class=\"hover striped\"><thead><tr><th>Key</th><th>Value</th></tr></thead> <tbody>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h2>Variables</h2><table class=\"hover striped\"><thead><tr><th>Key</th><th>Value</th></tr></thead> <tbody>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -234,7 +234,7 @@ func vars(items []configEntry) templ.Component {
var templ_7745c5c3_Var11 string var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(item.Key) templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.JoinStringErrs(item.Key)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 78, Col: 38} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 63, Col: 30}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var11))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -247,7 +247,7 @@ func vars(items []configEntry) templ.Component {
var templ_7745c5c3_Var12 string var templ_7745c5c3_Var12 string
templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(item.Value) templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.JoinStringErrs(item.Value)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 78, Col: 61} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/admin/admin.templ`, Line: 63, Col: 53}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var12))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -264,7 +264,7 @@ func vars(items []configEntry) templ.Component {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</tbody></table></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</tbody></table>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }

View File

@ -9,31 +9,26 @@ func urlFor(who, what, dir string) string {
func (p *CounterPlugin) allItems() map[string][]Item { func (p *CounterPlugin) allItems() map[string][]Item {
items, err := GetAllItemsByUser(p.db) items, err := GetAllItemsByUser(p.db)
if err != nil { if err != nil {
return map[string][]Item{"error": []Item{}} return map[string][]Item{"error": {}}
} }
return items return items
} }
templ (p *CounterPlugin) index() { templ (p *CounterPlugin) index() {
<div class="grid-container">
<div class="grid-x">
<h2>Counter</h2> <h2>Counter</h2>
</div> <label>Password
<div class="grid-x">
<div class="input-group">
<span class="input-group-label">Password</span>
<input class="input-group-field" type="text" name="password" /> <input class="input-group-field" type="text" name="password" />
</div> </label>
</div> <table class="striped">
<table>
for user, items := range p.allItems() { for user, items := range p.allItems() {
<thead>
<tr><th class="text-left" colspan="3">{ user }</th></tr> <tr><th class="text-left" colspan="3">{ user }</th></tr>
</thead>
for _, thing := range items { for _, thing := range items {
@p.renderItem(user, thing) @p.renderItem(user, thing)
} }
} }
</table> </table>
</div>
} }
templ (p *CounterPlugin) renderItem(user string, item Item) { templ (p *CounterPlugin) renderItem(user string, item Item) {

View File

@ -19,7 +19,7 @@ func urlFor(who, what, dir string) string {
func (p *CounterPlugin) allItems() map[string][]Item { func (p *CounterPlugin) allItems() map[string][]Item {
items, err := GetAllItemsByUser(p.db) items, err := GetAllItemsByUser(p.db)
if err != nil { if err != nil {
return map[string][]Item{"error": []Item{}} return map[string][]Item{"error": {}}
} }
return items return items
} }
@ -37,25 +37,25 @@ func (p *CounterPlugin) index() templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent templ_7745c5c3_Var1 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"grid-container\"><div class=\"grid-x\"><h2>Counter</h2></div><div class=\"grid-x\"><div class=\"input-group\"><span class=\"input-group-label\">Password</span> <input class=\"input-group-field\" type=\"text\" name=\"password\"></div></div><table>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h2>Counter</h2><label>Password <input class=\"input-group-field\" type=\"text\" name=\"password\"></label><table class=\"striped\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
for user, items := range p.allItems() { for user, items := range p.allItems() {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<tr><th class=\"text-left\" colspan=\"3\">") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<thead><tr><th class=\"text-left\" colspan=\"3\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var2 string var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(user) templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(user)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/counter/counter.templ`, Line: 29, Col: 60} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/counter/counter.templ`, Line: 24, Col: 60}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</th></tr>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</th></tr></thead> ")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -66,7 +66,7 @@ func (p *CounterPlugin) index() templ.Component {
} }
} }
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</table></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</table>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -105,7 +105,7 @@ func (p *CounterPlugin) renderItem(user string, item Item) templ.Component {
var templ_7745c5c3_Var4 string var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(item.Item) templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(item.Item)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/counter/counter.templ`, Line: 41, Col: 23} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/counter/counter.templ`, Line: 36, Col: 23}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -118,7 +118,7 @@ func (p *CounterPlugin) renderItem(user string, item Item) templ.Component {
var templ_7745c5c3_Var5 string var templ_7745c5c3_Var5 string
templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", item.Count)) templ_7745c5c3_Var5, templ_7745c5c3_Err = templ.JoinStringErrs(fmt.Sprintf("%d", item.Count))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/counter/counter.templ`, Line: 44, Col: 43} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/counter/counter.templ`, Line: 39, Col: 43}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var5))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {

View File

@ -207,6 +207,18 @@ func InvertEmojyList(emojy map[string]string) map[string]string {
return out return out
} }
func (p *EmojyPlugin) allCountsFlat(threshold int) ([]EmojyCount, error) {
emoji, err := p.allCounts(threshold)
if err != nil {
return nil, err
}
output := []EmojyCount{}
for _, v := range emoji {
output = append(output, v...)
}
return output, nil
}
func (p *EmojyPlugin) allCounts(threshold int) (map[string][]EmojyCount, error) { func (p *EmojyPlugin) allCounts(threshold int) (map[string][]EmojyCount, error) {
out := map[string][]EmojyCount{} out := map[string][]EmojyCount{}
onServerList := InvertEmojyList(p.b.GetEmojiList(true)) onServerList := InvertEmojyList(p.b.GetEmojiList(true))

View File

@ -1,35 +1,29 @@
package emojy package emojy
templ (p *EmojyPlugin) listTempl(emojy emojyMap) { templ (p *EmojyPlugin) listTempl(emojy []EmojyCount) {
<div class="grid-container"> <h1>Emojy</h1>
<div class="grid-x">
<div class="cell">
<h2>Emojy</h2>
</div>
</div>
<div class="grid-x">
<div class="cell">
@p.emojyNav() @p.emojyNav()
<div class="row">
for _, e := range emojy {
<div class="col-xs">
<div class="box">@p.listItem(e)</div>
</div> </div>
}
</div> </div>
<div class="grid-x grid-margin-x small-up-3 medium-up-6 large-up-8"> }
for _, v := range emojy {
for _, c := range v { templ (p *EmojyPlugin) listItem(e EmojyCount) {
<div class="cell"> <article
<div class="card" style="width: 100px">
style="max-width: 100px"> <img src={ e.URL }
<img src={ c.URL }
style="max-height: 100px" style="max-height: 100px"
style="max-width: 100px" style="max-width: 100px"
alt={ c.Emojy } alt={ e.Emojy }
/> />
<div class="card-divider"> <footer>
{ c.Emojy } { e.Emojy }
</div> </footer>
</div> </article>
</div>
}
}
</div>
</div>
} }

View File

@ -10,7 +10,7 @@ import "context"
import "io" import "io"
import "bytes" import "bytes"
func (p *EmojyPlugin) listTempl(emojy emojyMap) templ.Component { func (p *EmojyPlugin) listTempl(emojy []EmojyCount) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) { return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer) templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
if !templ_7745c5c3_IsBuffer { if !templ_7745c5c3_IsBuffer {
@ -23,7 +23,7 @@ func (p *EmojyPlugin) listTempl(emojy emojyMap) templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent templ_7745c5c3_Var1 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"grid-container\"><div class=\"grid-x\"><div class=\"cell\"><h2>Emojy</h2></div></div><div class=\"grid-x\"><div class=\"cell\">") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h1>Emojy</h1>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -31,51 +31,81 @@ func (p *EmojyPlugin) listTempl(emojy emojyMap) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div><div class=\"grid-x grid-margin-x small-up-3 medium-up-6 large-up-8\">") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"row\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
for _, v := range emojy { for _, e := range emojy {
for _, c := range v { _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"col-xs\"><div class=\"box\">")
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"cell\"><div class=\"card\" style=\"max-width: 100px\"><img src=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(c.URL)) templ_7745c5c3_Err = p.listItem(e).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" style=\"max-height: 100px\" style=\"max-width: 100px\" alt=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(c.Emojy))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><div class=\"card-divider\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var2 string
templ_7745c5c3_Var2, templ_7745c5c3_Err = templ.JoinStringErrs(c.Emojy)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/emojy/list.templ`, Line: 26, Col: 33}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var2))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if !templ_7745c5c3_IsBuffer {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
}
return templ_7745c5c3_Err
})
}
func (p *EmojyPlugin) listItem(e EmojyCount) templ.Component {
return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
if !templ_7745c5c3_IsBuffer {
templ_7745c5c3_Buffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
}
ctx = templ.InitializeContext(ctx)
templ_7745c5c3_Var2 := templ.GetChildren(ctx)
if templ_7745c5c3_Var2 == nil {
templ_7745c5c3_Var2 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<article style=\"width: 100px\"><img src=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(e.URL))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" style=\"max-height: 100px\" style=\"max-width: 100px\" alt=\"")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(e.Emojy))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><footer>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(e.Emojy)
if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/emojy/list.templ`, Line: 25, Col: 17}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</footer></article>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
if !templ_7745c5c3_IsBuffer { if !templ_7745c5c3_IsBuffer {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
} }

View File

@ -43,7 +43,7 @@ func (p *EmojyPlugin) handleUploadForm(w http.ResponseWriter, r *http.Request) {
func (p *EmojyPlugin) handleList(w http.ResponseWriter, r *http.Request) { func (p *EmojyPlugin) handleList(w http.ResponseWriter, r *http.Request) {
threshold := p.c.GetInt("emojy.statthreshold", 1) threshold := p.c.GetInt("emojy.statthreshold", 1)
emojy, err := p.allCounts(threshold) emojy, err := p.allCountsFlat(threshold)
if err != nil { if err != nil {
fmt.Fprintf(w, "Error: %s", err) fmt.Fprintf(w, "Error: %s", err)
return return

View File

@ -1,83 +1,70 @@
package meme package meme
templ (p *MemePlugin) index(all webResps) { templ (p *MemePlugin) index(all webResps) {
<div class="grid-container"> <h2>New Meme</h2>
<h2>Meme</h2>
<form> <form>
<div class="grid-x grid-margin-x">
<div class="cell auto">
<input type="text" name="name" placeholder="Name..." /> <input type="text" name="name" placeholder="Name..." />
</div>
<div class="cell auto">
<input type="text" name="url" placeholder="URL..." /> <input type="text" name="url" placeholder="URL..." />
</div>
<div class="cell auto">
<textarea name="config"> <textarea name="config">
</textarea> </textarea>
</div>
<div class="cell small-2">
<button class="button" <button class="button"
hx-post="/meme/add" hx-post="/meme/add"
hx-target="#newMemes" hx-target="#newMemes"
>Save</button> >Save</button>
</div>
</div>
</form> </form>
<h2>Current Memes</h2>
<div id="newMemes"> <div id="newMemes">
</div> </div>
<div class="row">
for _, meme := range all { for _, meme := range all {
@p.Show(meme) <div class="col-xs">
<div class="box">@p.Show(meme)</div>
</div>
} }
</div> </div>
} }
templ (p *MemePlugin) Show(meme webResp) { templ (p *MemePlugin) Show(meme webResp) {
<div class="grid-x grid-margin-x" id={ meme.Name }> <article id={ meme.Name } style="width: 300px">
<div class="cell small-3"> <header>
<div class="card"
style="max-width: 200px">
<img <img
class="thumbnail" class="thumbnail"
style="max-height: 250px; max-width: 250px;" style="max-height: 300px; max-width: 300px;"
alt={ meme.Name } alt={ meme.Name }
src={ meme.URL } /> src={ meme.URL } />
<div class="card-divider">
<p>{ meme.Name }</p> <p>{ meme.Name }</p>
</div> </header>
</div> <pre style="max-width: 300px; overflow: auto">
</div>
<div class="cell small-7">
<pre>
{ meme.Config } { meme.Config }
</pre> </pre>
</div> <footer>
<div class="cell small-2">
<button class="button" <button class="button"
hx-get={ "/meme/edit/"+meme.Name } hx-get={ "/meme/edit/"+meme.Name }
hx-target={ "#"+meme.Name } hx-target={ "#"+meme.Name }
hx-swap="outerHTML" hx-swap="outerHTML"
>Edit</button> >Edit</button>
</div> </footer>
</div> </article>
} }
templ (p *MemePlugin) Edit(meme webResp) { templ (p *MemePlugin) Edit(meme webResp) {
<form> <form style="width: 300px">
<div class="grid-x grid-margin-x" id={ meme.Name }> <article id={ meme.Name }>
<div class="cell-small-3"> <header>
<img <img
class="thumbnail" class="thumbnail"
style="max-height: 150px" style="max-height: 250px"
alt={ meme.Name } alt={ meme.Name }
src={ meme.URL } /> src={ meme.URL } />
</div> </header>
<div class="cell small-7">
<textarea name="config" rows="10"> <textarea name="config" rows="10">
{ meme.Config } { meme.Config }
</textarea> </textarea>
<input type="text" name="url" value={ meme.URL } /> <input type="text" name="url" value={ meme.URL } />
</div> <footer>
<div class="cell small-2">
<button class="button" <button class="button"
hx-put={ "/meme/save/"+meme.Name } hx-put={ "/meme/save/"+meme.Name }
hx-target={ "#"+meme.Name } hx-target={ "#"+meme.Name }
@ -88,7 +75,7 @@ templ (p *MemePlugin) Edit(meme webResp) {
hx-target={ "#"+meme.Name } hx-target={ "#"+meme.Name }
hx-swap="outerHTML" hx-swap="outerHTML"
>Delete</button> >Delete</button>
</div> </footer>
</div> </article>
</form> </form>
} }

View File

@ -23,15 +23,23 @@ func (p *MemePlugin) index(all webResps) templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent templ_7745c5c3_Var1 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"grid-container\"><h2>Meme</h2><form><div class=\"grid-x grid-margin-x\"><div class=\"cell auto\"><input type=\"text\" name=\"name\" placeholder=\"Name...\"></div><div class=\"cell auto\"><input type=\"text\" name=\"url\" placeholder=\"URL...\"></div><div class=\"cell auto\"><textarea name=\"config\"></textarea></div><div class=\"cell small-2\"><button class=\"button\" hx-post=\"/meme/add\" hx-target=\"#newMemes\">Save</button></div></div></form><div id=\"newMemes\"></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h2>New Meme</h2><form><input type=\"text\" name=\"name\" placeholder=\"Name...\"> <input type=\"text\" name=\"url\" placeholder=\"URL...\"> <textarea name=\"config\"></textarea> <button class=\"button\" hx-post=\"/meme/add\" hx-target=\"#newMemes\">Save</button></form><h2>Current Memes</h2><div id=\"newMemes\"></div><div class=\"row\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
for _, meme := range all { for _, meme := range all {
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"col-xs\"><div class=\"box\">")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = p.Show(meme).Render(ctx, templ_7745c5c3_Buffer) templ_7745c5c3_Err = p.Show(meme).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div>")
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -57,7 +65,7 @@ func (p *MemePlugin) Show(meme webResp) templ.Component {
templ_7745c5c3_Var2 = templ.NopComponent templ_7745c5c3_Var2 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"grid-x grid-margin-x\" id=\"") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<article id=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -65,7 +73,7 @@ func (p *MemePlugin) Show(meme webResp) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><div class=\"cell small-3\"><div class=\"card\" style=\"max-width: 200px\"><img class=\"thumbnail\" style=\"max-height: 250px; max-width: 250px;\" alt=\"") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" style=\"width: 300px\"><header><img class=\"thumbnail\" style=\"max-height: 300px; max-width: 300px;\" alt=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -81,33 +89,33 @@ func (p *MemePlugin) Show(meme webResp) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><div class=\"card-divider\"><p>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><p>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var3 string var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(meme.Name) templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(meme.Name)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/meme/meme.templ`, Line: 44, Col: 34} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/meme/meme.templ`, Line: 37, Col: 26}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p></div></div></div><div class=\"cell small-7\"><pre>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</p></header><pre style=\"max-width: 300px; overflow: auto\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var4 string var templ_7745c5c3_Var4 string
templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(meme.Config) templ_7745c5c3_Var4, templ_7745c5c3_Err = templ.JoinStringErrs(meme.Config)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/meme/meme.templ`, Line: 50, Col: 29} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/meme/meme.templ`, Line: 40, Col: 25}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var4))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</pre></div><div class=\"cell small-2\"><button class=\"button\" hx-get=\"") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</pre><footer><button class=\"button\" hx-get=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -123,7 +131,7 @@ func (p *MemePlugin) Show(meme webResp) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"outerHTML\">Edit</button></div></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"outerHTML\">Edit</button></footer></article>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -147,7 +155,7 @@ func (p *MemePlugin) Edit(meme webResp) templ.Component {
templ_7745c5c3_Var5 = templ.NopComponent templ_7745c5c3_Var5 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<form><div class=\"grid-x grid-margin-x\" id=\"") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<form style=\"width: 300px\"><article id=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -155,7 +163,7 @@ func (p *MemePlugin) Edit(meme webResp) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><div class=\"cell-small-3\"><img class=\"thumbnail\" style=\"max-height: 150px\" alt=\"") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><header><img class=\"thumbnail\" style=\"max-height: 250px\" alt=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -171,14 +179,14 @@ func (p *MemePlugin) Edit(meme webResp) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"></div><div class=\"cell small-7\"><textarea name=\"config\" rows=\"10\">") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"></header><textarea name=\"config\" rows=\"10\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
var templ_7745c5c3_Var6 string var templ_7745c5c3_Var6 string
templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(meme.Config) templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.JoinStringErrs(meme.Config)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/meme/meme.templ`, Line: 75, Col: 29} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/meme/meme.templ`, Line: 63, Col: 25}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var6))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
@ -192,7 +200,7 @@ func (p *MemePlugin) Edit(meme webResp) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"></div><div class=\"cell small-2\"><button class=\"button\" hx-put=\"") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\"><footer><button class=\"button\" hx-put=\"")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -224,7 +232,7 @@ func (p *MemePlugin) Edit(meme webResp) templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"outerHTML\">Delete</button></div></div></form>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("\" hx-swap=\"outerHTML\">Delete</button></footer></article></form>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }

View File

@ -3,38 +3,26 @@ package secrets
import "fmt" import "fmt"
templ (s *SecretsPlugin) index() { templ (s *SecretsPlugin) index() {
<div class="grid-container">
<form hx-post="/secrets/add" hx-target="#data">
<div class="grid-x">
<h2>Secrets</h2> <h2>Secrets</h2>
</div> <form hx-post="/secrets/add" hx-target="#data">
<div class="grid-x"> <fieldset>
<div class="cell auto"> <label>Key
<div class="input-group">
<span class="input-group-label">Key</span>
<input class="input-group-field" placeholder="Key..." name="key" /> <input class="input-group-field" placeholder="Key..." name="key" />
</div> </label>
</div> <label>Value
<div class="cell auto">
<div class="input-group">
<span class="input-group-label">Value</span>
<input class="input-group-field" placeholder="Value..." name="value" /> <input class="input-group-field" placeholder="Value..." name="value" />
<div class="input-group-button"> </label>
</fieldset>
<button class="button primary" type="submit">Add Secret</button> <button class="button primary" type="submit">Add Secret</button>
</div>
</div>
</div>
</div>
</form> </form>
<div class="grid-x grid-margin-x">
<div id="data"> <div id="data" style="margin-top: 2em">
@s.keysList() @s.keysList()
</div> </div>
</div>
</div>
} }
templ (s *SecretsPlugin) keysList() { templ (s *SecretsPlugin) keysList() {
<h2>Keys List</h2>
<ul class="no-bullet"> <ul class="no-bullet">
for _, key := range s.keys() { for _, key := range s.keys() {
<li> <li>

View File

@ -25,7 +25,7 @@ func (s *SecretsPlugin) index() templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent templ_7745c5c3_Var1 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"grid-container\"><form hx-post=\"/secrets/add\" hx-target=\"#data\"><div class=\"grid-x\"><h2>Secrets</h2></div><div class=\"grid-x\"><div class=\"cell auto\"><div class=\"input-group\"><span class=\"input-group-label\">Key</span> <input class=\"input-group-field\" placeholder=\"Key...\" name=\"key\"></div></div><div class=\"cell auto\"><div class=\"input-group\"><span class=\"input-group-label\">Value</span> <input class=\"input-group-field\" placeholder=\"Value...\" name=\"value\"><div class=\"input-group-button\"><button class=\"button primary\" type=\"submit\">Add Secret</button></div></div></div></div></form><div class=\"grid-x grid-margin-x\"><div id=\"data\">") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h2>Secrets</h2><form hx-post=\"/secrets/add\" hx-target=\"#data\"><fieldset><label>Key <input class=\"input-group-field\" placeholder=\"Key...\" name=\"key\"></label> <label>Value <input class=\"input-group-field\" placeholder=\"Value...\" name=\"value\"></label></fieldset><button class=\"button primary\" type=\"submit\">Add Secret</button></form><div id=\"data\" style=\"margin-top: 2em\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -33,7 +33,7 @@ func (s *SecretsPlugin) index() templ.Component {
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div></div></div>") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("</div>")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -57,7 +57,7 @@ func (s *SecretsPlugin) keysList() templ.Component {
templ_7745c5c3_Var2 = templ.NopComponent templ_7745c5c3_Var2 = templ.NopComponent
} }
ctx = templ.ClearChildren(ctx) ctx = templ.ClearChildren(ctx)
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<ul class=\"no-bullet\">") _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<h2>Keys List</h2><ul class=\"no-bullet\">")
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err return templ_7745c5c3_Err
} }
@ -85,7 +85,7 @@ func (s *SecretsPlugin) keysList() templ.Component {
var templ_7745c5c3_Var3 string var templ_7745c5c3_Var3 string
templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(key) templ_7745c5c3_Var3, templ_7745c5c3_Err = templ.JoinStringErrs(key)
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {
return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/secrets/secrets.templ`, Line: 48, Col: 17} return templ.Error{Err: templ_7745c5c3_Err, FileName: `plugins/secrets/secrets.templ`, Line: 36, Col: 17}
} }
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3)) _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var3))
if templ_7745c5c3_Err != nil { if templ_7745c5c3_Err != nil {