From 43d8951296ce2f232ca94f0577e2e726291bf783 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sun, 26 May 2024 21:16:02 +0200 Subject: Replace URL building methods with the URLBuilder --- src/http/posts.go | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/http/posts.go') diff --git a/src/http/posts.go b/src/http/posts.go index daaaafc..8488996 100644 --- a/src/http/posts.go +++ b/src/http/posts.go @@ -30,13 +30,6 @@ func (a *api) postPreprocessFuncImage(args ...string) (string, error) { } tpl := txttpl.New("image.html") - - tpl.Funcs(txttpl.FuncMap{ - "AssetURL": func(id string) string { - return a.assetURL(id, false) - }, - }) - tpl = txttpl.Must(tpl.Parse(mustReadTplFile("image.html"))) tplPayload := struct { @@ -189,7 +182,9 @@ func (a *api) postPostHandler() http.Handler { return } - a.executeRedirectTpl(rw, r, a.editPostURL(p.ID, false)) + a.executeRedirectTpl( + rw, r, a.urlBuilder.Post(p.ID).MethodEdit().String(), + ) }) } @@ -223,9 +218,13 @@ func (a *api) deletePostHandler(isDraft bool) http.Handler { } if isDraft { - a.executeRedirectTpl(rw, r, a.manageDraftPostsURL(false)) + a.executeRedirectTpl( + rw, r, a.urlBuilder.Drafts().MethodManage().String(), + ) } else { - a.executeRedirectTpl(rw, r, a.managePostsURL(false)) + a.executeRedirectTpl( + rw, r, a.urlBuilder.Posts().MethodManage().String(), + ) } }) } -- cgit v1.2.3