Much progress
This commit is contained in:
parent
ca35e6760d
commit
c6975d3814
6 changed files with 133 additions and 19 deletions
36
templates/base.tmpl.html
Normal file
36
templates/base.tmpl.html
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{{define "base"}}
|
||||
<!doctype html>
|
||||
<html lang='en'>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{{template "title" .}}</title>
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css"
|
||||
rel="stylesheet"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH"
|
||||
crossorigin="anonymous">
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-sm bg-body-tertiary mb-3">
|
||||
<div class="container-fluid">
|
||||
<a class="navbar-brand" href="#">GoNotes</a>
|
||||
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="/notes/">All Notes</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
<div class="container">
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col-md-6">
|
||||
<h1>{{template "title" .}}</h1>
|
||||
<main>
|
||||
{{template "main" .}}
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
{{end}}
|
||||
|
|
@ -1,6 +1,27 @@
|
|||
<h1>Editing {{.Title}}</h1>
|
||||
{{define "title"}}Edit {{.Title}}{{end}}
|
||||
|
||||
{{define "main"}}
|
||||
<form action="save/" method="POST">
|
||||
<textarea name="body">{{printf "%s" .Body}}</textarea>
|
||||
<input type="submit" value="Save">
|
||||
<div class="mb-3">
|
||||
<label for="noteBodyInput" class="form-label">Note</label>
|
||||
<div id="toolbar"></div>
|
||||
<textarea class="form-control" id="noteBodyInput" name="body" aria-described-by="bodyHelp">{{printf "%s" .Body}}</textarea>
|
||||
<div id="bodyHelp" class="form-text">Enter your note content in markdown</div>
|
||||
</div>
|
||||
<button class="btn btn-primary" type="submit">Save</button>
|
||||
</form>
|
||||
|
||||
<script src="https://unpkg.com/tiny-markdown-editor/dist/tiny-mde.min.js"></script>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
type="text/css"
|
||||
href="https://unpkg.com/tiny-markdown-editor/dist/tiny-mde.min.css"
|
||||
/>
|
||||
<script type="text/javascript">
|
||||
var tinyMDE = new TinyMDE.Editor({ textarea: "noteBodyInput" });
|
||||
var commandBar = new TinyMDE.CommandBar({
|
||||
element: "toolbar",
|
||||
editor: tinyMDE,
|
||||
});
|
||||
</script>
|
||||
{{end}}
|
||||
|
|
|
|||
10
templates/list.tmpl.html
Normal file
10
templates/list.tmpl.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{{define "title"}}All Notes{{end}}
|
||||
{{define "main"}}
|
||||
<ul>
|
||||
{{range $title := .titles}}
|
||||
<li>
|
||||
<a href="{{$title}}/">{{$title}}</a>
|
||||
</li>
|
||||
{{end}}
|
||||
</ul>
|
||||
{{end}}
|
||||
|
|
@ -1,3 +1,10 @@
|
|||
<h1>{{.Title}}</h1>
|
||||
{{define "title"}}{{.Title}}{{end}}
|
||||
{{define "main"}}
|
||||
<div>
|
||||
{{.BodyRendered}}
|
||||
</div>
|
||||
<div>
|
||||
<a href="edit/">Edit</a>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<div>{{printf "%s" .BodyRendered}}</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue