new.html form added
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>NoteHub — Add note</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport">
|
||||
<link href="/style.css" rel="stylesheet" type="text/css" />
|
||||
<base target="_blank">
|
||||
</head>
|
||||
<body>
|
||||
<form action="/note" autocomplete="off" method="POST" target="_self">
|
||||
<textarea autofocus name="text"></textarea>
|
||||
<fieldset>
|
||||
<input class="ui-elem"
|
||||
name="plain-password"
|
||||
placeholder="Password for editing"
|
||||
type="text"
|
||||
autocomplete="off">
|
||||
<label style="margin-right: 1em">
|
||||
<input id="tos" name="tos" type="checkbox" onClick="toggleButton()">
|
||||
Accept <a href="/TOS.md">Terms of Service</a>
|
||||
</label>
|
||||
<input class="button ui-elem" disabled id="publish-button" name="button" type="submit" value="Publish">
|
||||
</fieldset>
|
||||
</form>
|
||||
<footer>
|
||||
<a href="https://github.com/chmllr/NoteHub">source code</a> ·
|
||||
<a href="/TOS.md">terms of service</a>
|
||||
</footer>
|
||||
<script>
|
||||
function $(id) { return document.getElementById(id) }
|
||||
function toggleButton() { $('publish-button').disabled = !$('tos').checked }
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
+13
-4
@@ -236,10 +236,13 @@ td {
|
||||
}
|
||||
|
||||
textarea {
|
||||
font-size: 1em;
|
||||
background-color: #303535;
|
||||
font-size: 1.2em;
|
||||
color: #b0b0b0;
|
||||
border-radius: 5px;
|
||||
flex: 1 0;
|
||||
margin: 1em;
|
||||
margin: 3em;
|
||||
padding: 2em;
|
||||
}
|
||||
|
||||
textarea, fieldset {
|
||||
@@ -247,7 +250,13 @@ textarea, fieldset {
|
||||
}
|
||||
|
||||
fieldset {
|
||||
padding-left: 1em;
|
||||
padding-right: 1em;
|
||||
margin-left: 3em;
|
||||
margin-right: 3em;
|
||||
margin-bottom: 3em;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex: 1 0;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
@@ -43,6 +44,7 @@ func main() {
|
||||
e.File("/robots.txt", "assets/public/robots.txt")
|
||||
e.File("/style.css", "assets/public/style.css")
|
||||
e.File("/index.html", "assets/public/index.html")
|
||||
e.File("/new", "assets/public/new.html")
|
||||
e.File("/", "assets/public/index.html")
|
||||
|
||||
e.GET("/TOS.md", func(c echo.Context) error {
|
||||
@@ -65,6 +67,15 @@ func main() {
|
||||
return c.Render(code, "Note", n)
|
||||
})
|
||||
|
||||
e.POST("/note", func(c echo.Context) error {
|
||||
vals, err := c.FormParams()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("DEBUG %+v", vals)
|
||||
return nil
|
||||
})
|
||||
|
||||
e.Logger.Fatal(e.Start(":3000"))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user