Started styling the app and have got editing posts working.
This commit is contained in:
parent
7ef6725bdb
commit
bf5d6cbe52
20 changed files with 511 additions and 41 deletions
|
|
@ -4,5 +4,5 @@ import "embed"
|
|||
|
||||
//go:embed *.html
|
||||
//go:embed layouts/*.html
|
||||
//go:embed sites/*.html
|
||||
//go:embed posts/*.html
|
||||
var FS embed.FS
|
||||
|
|
|
|||
|
|
@ -1,7 +1,11 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>TEMP</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/assets/css/reset.css">
|
||||
<link rel="stylesheet" href="/assets/css/main.css">
|
||||
<title>Hugo CRM</title>
|
||||
</head>
|
||||
<body>
|
||||
{{embed}}
|
||||
|
|
|
|||
30
templates/layouts/site.html
Normal file
30
templates/layouts/site.html
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="/assets/css/reset.css">
|
||||
<link rel="stylesheet" href="/assets/css/main.css">
|
||||
<title>Hugo CRM</title>
|
||||
</head>
|
||||
<body class="role-site">
|
||||
<header>
|
||||
<h1>Hugo CRM</h1>
|
||||
<nav>
|
||||
<span>{{.site.Name}}</span>
|
||||
<a href="#">User</a>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="client-area">
|
||||
<nav class="vert">
|
||||
<ul>
|
||||
<li><a href="/sites/{{.site.ID}}/posts">Posts</a></li>
|
||||
<li><a href="/sites/{{.site.ID}}/pages">Pages</a></li>
|
||||
<li><a href="/sites/{{.site.ID}}/uploads">Uploads</a></li>
|
||||
<li><a href="/sites/{{.site.ID}}/settings">Settings</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<main>{{embed}}</main>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
20
templates/posts/index.html
Normal file
20
templates/posts/index.html
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
<div>
|
||||
<a href="/sites/{{.site.ID}}/posts/new">New Post</a>
|
||||
</div>
|
||||
|
||||
{{range .posts}}
|
||||
{{if .Title}}
|
||||
<h3>{{.Title}}</h3>
|
||||
{{end}}
|
||||
|
||||
<div class="post">
|
||||
{{.Body | markdown}}
|
||||
|
||||
<div>
|
||||
<a href="/sites/{{$.site.ID}}/posts/{{.ID}}">Edit</a>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
{{else}}
|
||||
<p>No posts yet</p>
|
||||
{{end}}
|
||||
13
templates/posts/new.html
Normal file
13
templates/posts/new.html
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{{- $postTarget := printf "/sites/%v/posts" .site.ID -}}
|
||||
{{- if .post.ID -}}
|
||||
{{- $postTarget = printf "/sites/%v/posts/%v" .site.ID .post.ID -}}
|
||||
{{- end -}}
|
||||
<form method="post" action="{{$postTarget}}" class="post-form">
|
||||
<input name="title" placeholder="Title" value="{{.post.Title}}">
|
||||
|
||||
<textarea name="body">{{.post.Body}}</textarea>
|
||||
|
||||
<div class="bottom-bar">
|
||||
<input type="submit" value="Post">
|
||||
</div>
|
||||
</form>
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
<h1>Site {{.site.Title}}</h1>
|
||||
|
||||
<form method="post" action="/sites/{{.site.ID}}/posts">
|
||||
<textarea name="body"></textarea>
|
||||
<input type="submit" value="Post">
|
||||
</form>
|
||||
|
||||
<form method="post" action="/sites/{{.site.ID}}/rebuild">
|
||||
<input type="submit" value="Rebuild">
|
||||
</form>
|
||||
|
||||
{{range .posts}}
|
||||
<div class="post">
|
||||
{{.Body}}
|
||||
</div>
|
||||
<hr>
|
||||
{{else}}
|
||||
<p>No posts yet</p>
|
||||
{{end}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue