mirror of https://github.com/velour/catbase.git
40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
package secrets
|
|
|
|
import "fmt"
|
|
|
|
templ (s *SecretsPlugin) index() {
|
|
<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">
|
|
@s.keysList()
|
|
</div>
|
|
}
|
|
|
|
templ (s *SecretsPlugin) keysList() {
|
|
<h2>Keys List</h2>
|
|
<ul class="no-bullet">
|
|
for _, key := range s.keys() {
|
|
<li>
|
|
<button
|
|
class="button tiny alert middle"
|
|
style="vertical-align: baseline"
|
|
hx-delete="/secrets/remove"
|
|
hx-confirm={ fmt.Sprintf("Are you sure you want to delete %s?", key) }
|
|
hx-target="#data"
|
|
hx-include="this"
|
|
name="key" value={ key }>X</button>
|
|
{ key }</li>
|
|
}
|
|
</ul>
|
|
} |