From 1f3ae665ed2e58ca572678ce7caf8b711f226392 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Tue, 29 Nov 2022 20:59:31 +0100 Subject: 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. --- src/http/tpl.go | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'src/http/tpl.go') 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") -- cgit v1.2.3