summaryrefslogtreecommitdiff
path: root/src/http/tpl.go
diff options
context:
space:
mode:
authorBrian Picciano <mediocregopher@gmail.com>2022-11-29 20:59:31 +0100
committerBrian Picciano <mediocregopher@gmail.com>2022-11-29 20:59:31 +0100
commit1f3ae665ed2e58ca572678ce7caf8b711f226392 (patch)
treee023602e07e2a80d24ef9d9527ddca0e1640e929 /src/http/tpl.go
parent31f8f37c5ad3ad4ac7b3cc93d0257dd80c877c7c (diff)
Introduce EDIT and MANAGE methods
All admin "index" pages are moved under MANAGE, so that we can have (for example) and normal "GET /posts" page later which would replace the current index page, and potentially corresponding pages for the other categories. The EDIT method replaces the old `?edit` pattern, which normalizes how we differentiate page functionality generally.
Diffstat (limited to 'src/http/tpl.go')
-rw-r--r--src/http/tpl.go24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/http/tpl.go b/src/http/tpl.go
index 3e1a2ba..a9f89d7 100644
--- a/src/http/tpl.go
+++ b/src/http/tpl.go
@@ -49,19 +49,31 @@ func (a *api) postURL(id string, abs bool) string {
return a.blogURL(path, abs)
}
-func (a *api) postsURL(abs bool) string {
- return a.blogURL("posts", abs)
+func (a *api) editPostURL(id string, abs bool) string {
+ return a.postURL(id, abs) + "?method=edit"
}
-func (a *api) assetsURL(abs bool) string {
- return a.blogURL("assets", abs)
+func (a *api) managePostsURL(abs bool) string {
+ return a.blogURL("posts?method=manage", abs)
}
-func (a *api) draftURL(id string, abs bool) string {
+func (a *api) manageAssetsURL(abs bool) string {
+ return a.blogURL("assets?method=manage", abs)
+}
+
+func (a *api) draftPostURL(id string, abs bool) string {
path := filepath.Join("drafts", id)
return a.blogURL(path, abs)
}
+func (a *api) editDraftPostURL(id string, abs bool) string {
+ return a.draftPostURL(id, abs) + "?method=edit"
+}
+
+func (a *api) manageDraftPostsURL(abs bool) string {
+ return a.blogURL("drafts", abs) + "?method=manage"
+}
+
func (a *api) draftsURL(abs bool) string {
return a.blogURL("drafts", abs)
}
@@ -88,7 +100,7 @@ func (a *api) tplFuncs() template.FuncMap {
return a.blogURL(path, false)
},
"DraftURL": func(id string) string {
- return a.draftURL(id, false)
+ return a.draftPostURL(id, false)
},
"DateTimeFormat": func(t time.Time) string {
return t.Format("2006-01-02")