feat: add app code
- journal domain package - httpserver package - html templates - main.go in root dir
This commit is contained in:
parent
3cc4d28aac
commit
943922a6e1
20 changed files with 1032 additions and 0 deletions
74
templates/new-entry.html
Normal file
74
templates/new-entry.html
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
{{ template "layout.html" . }}
|
||||
|
||||
{{ define "title" }}New entry{{ end }}
|
||||
|
||||
{{ define "content" }}
|
||||
<style>
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
/* max-width: 600px; */
|
||||
margin: 0 auto;
|
||||
}
|
||||
form input,
|
||||
form textarea {
|
||||
font-size: 1rem;
|
||||
width: calc(100% - 1rem);
|
||||
}
|
||||
form input[type="date"] {
|
||||
padding: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
border-radius: 0.5rem;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
form input[type="text"] {
|
||||
padding: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
border-radius: 0.5rem;
|
||||
border: 1px solid #ccc;
|
||||
}
|
||||
form textarea {
|
||||
padding: 0.5rem;
|
||||
margin-bottom: 1rem;
|
||||
border-radius: 0.5rem;
|
||||
border: 1px solid #ccc;
|
||||
resize: none;
|
||||
height: 24rem;
|
||||
}
|
||||
/* form button {
|
||||
font-size: 1rem;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 0.5rem;
|
||||
border: none;
|
||||
background-color: #000;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
}
|
||||
form button:hover {
|
||||
background-color: #333;
|
||||
} */
|
||||
</style>
|
||||
<script>
|
||||
function saveEntry(event) {
|
||||
event.preventDefault();
|
||||
document.getElementById('new-entry').submit();
|
||||
}
|
||||
function clearForm(event) {
|
||||
event.preventDefault();
|
||||
document.getElementById('new-entry').reset();
|
||||
}
|
||||
</script>
|
||||
<main class="container">
|
||||
<h1>New entry</h1>
|
||||
<hr />
|
||||
<form id="new-entry" action="/entry/new" method="POST">
|
||||
<input type="text" name="title" placeholder="Title" required>
|
||||
<input type="date" name="date" value="{{ .Today }}" required>
|
||||
<textarea name="content" placeholder="Content" rows="12" required></textarea>
|
||||
<div>
|
||||
[<a href="#" onclick="saveEntry(event)">Save</a>] [<a href="#" onclick="clearForm(event)">Clear</a>]
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
{{ end }}
|
||||
Loading…
Add table
Add a link
Reference in a new issue