diff options
Diffstat (limited to 'templates')
| -rw-r--r-- | templates/login.html.template | 17 | ||||
| -rw-r--r-- | templates/note.html.template | 30 |
2 files changed, 18 insertions, 29 deletions
diff --git a/templates/login.html.template b/templates/login.html.template index 658d477..53ab905 100644 --- a/templates/login.html.template +++ b/templates/login.html.template @@ -1,13 +1,12 @@ {{define "head"}}<title>Login</title>{{end}} -<p class="login-error">{{.Error}}</p> - <section> - <div style="display:flex"> - <form class="password-form" action="/login" method="post"> - <label class="password-label" for="password">Enter password</label> - <input id="password" class="password" type="password" name="password"> - <input type="hidden" name="redirect" value="{{.Redirect}}"> - </form> - </div> + {{if .Error}} + <p class="login-error">Incorrect password</p> + {{end}} + <form class="password-form" action="/login" method="post"> + <label class="password-label" for="password">Enter password</label> + <input id="password" class="password" type="password" name="password"> + <input type="hidden" name="redirect" value="{{.Redirect}}"> + </form> </section> diff --git a/templates/note.html.template b/templates/note.html.template index eac0e02..0a88fd6 100644 --- a/templates/note.html.template +++ b/templates/note.html.template @@ -1,31 +1,21 @@ {{define "head"}} -<script src="/static/htmx.min.js"></script> -<title>Notepad</title> + <script src="/static/note.js"></script> + <title>Notepad</title> -<meta name="viewport" content="interactive-widget=resizes-content"> <!-- https://stackoverflow.com/q/76026292 --> + <meta name="viewport" content="interactive-widget=resizes-content"> <!-- https://stackoverflow.com/q/76026292 --> {{end}} -<form method="post"> +<form id="form" method="post"> <div class="save-indicator-container"> - {{block "saveIndicator" ""}} - <span id="save-indicator">{{.}}</span> - {{end}} + <div id="save-indicator-wrapper"> + {{block "saveIndicator" ""}} + <span id="save-indicator">{{.}}</span> + {{end}} + </div> <noscript><input type="submit" value="Save"></noscript> </div> <div class="content-container"> - <textarea - name="content" - hx-post="/notepad/autosave" - hx-on:input=" - const indicator = htmx.find('#save-indicator'); - htmx.addClass(indicator, 'htmx-indicator'); - indicator.innerHTML = 'Saving...'; - " - hx-trigger="input delay:1s" - hx-indicator="#save-indicator" - hx-target="#save-indicator" - hx-swap="outerHTML" - autofocus> + <textarea id="content" name="content" oninput="autosave()" autofocus> {{- .Content -}} </textarea> </div> |
