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
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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue