Cleanup edit file page Link to file Allow window resizing
alex wennerberg alex@alexwennerberg.com
Sat, 21 Nov 2020 00:28:32 -0800
3 files changed,
6 insertions(+),
4 deletions(-)
M
http.go
→
http.go
@@ -116,7 +116,9 @@ data := struct {
FileName string FileText string PageTitle string - }{fileName, string(fileBytes), c.SiteTitle} + AuthUser string + Host string + }{fileName, string(fileBytes), c.SiteTitle, authUser, c.Host} err = t.ExecuteTemplate(w, "edit_file.html", data) if err != nil { log.Println(err)
M
templates/edit_file.html
→
templates/edit_file.html
@@ -1,9 +1,9 @@
{{template "header" .}} -<h2>Editing {{.FileName}}</h2> +<h2>Editing <a href="//{{.AuthUser}}.{{.Host}}/{{.FileName}}">{{.FileName}}</a></h2> <form id="edit-form" action="/edit/{{.FileName}}" method="POST"> <label for="rename">Rename:</label> <input type="text" value="{{.FileName}}" id="rename" name="rename"> - <textarea rows="20" name="file_text" id="editor">{{.FileText}}</textarea> + <textarea rows="25" name="file_text" id="editor">{{.FileText}}</textarea> <br> <input type="submit" value="Save file" class="button"> </form>
M
templates/static/style.css
→
templates/static/style.css
@@ -39,7 +39,7 @@ border: 1px solid #999999;
width: 100%; margin: 5px 0; padding: 3px; - resize: none; + resize: vertical; } .button {