From 52fad572324d165691f2ca77913e4a8f5f85c9ed Mon Sep 17 00:00:00 2001 From: Jan-Lukas Else Date: Sat, 11 Dec 2021 19:56:40 +0100 Subject: [PATCH] Show scheduled posts in editor --- httpRouters.go | 2 ++ posts.go | 9 +++++++++ templates/editor.gohtml | 1 + templates/strings/de.yaml | 1 + templates/strings/default.yaml | 1 + templates/strings/pt-br.yaml | 1 + 6 files changed, 15 insertions(+) diff --git a/httpRouters.go b/httpRouters.go index 1589699..58d744f 100644 --- a/httpRouters.go +++ b/httpRouters.go @@ -344,6 +344,8 @@ func (a *goBlog) blogEditorRouter(conf *configBlog) func(r chi.Router) { r.Get("/unlisted", a.serveUnlisted) r.Get("/unlisted"+feedPath, a.serveUnlisted) r.Get("/unlisted"+paginationPath, a.serveUnlisted) + r.Get("/scheduled", a.serveScheduled) + r.Get("/scheduled"+feedPath, a.serveScheduled) r.HandleFunc("/preview", a.serveEditorPreview) } } diff --git a/posts.go b/posts.go index 2381e09..660adab 100644 --- a/posts.go +++ b/posts.go @@ -149,6 +149,15 @@ func (a *goBlog) serveUnlisted(w http.ResponseWriter, r *http.Request) { }))) } +func (a *goBlog) serveScheduled(w http.ResponseWriter, r *http.Request) { + blog := r.Context().Value(blogKey).(string) + a.serveIndex(w, r.WithContext(context.WithValue(r.Context(), indexConfigKey, &indexConfig{ + path: a.getRelativePath(blog, "/editor/scheduled"), + title: a.ts.GetTemplateStringVariant(a.cfg.Blogs[blog].Lang, "scheduledposts"), + status: statusScheduled, + }))) +} + func (a *goBlog) serveDate(w http.ResponseWriter, r *http.Request) { var year, month, day int if ys := chi.URLParam(r, "year"); ys != "" && ys != "x" { diff --git a/templates/editor.gohtml b/templates/editor.gohtml index 9124786..0b9df28 100644 --- a/templates/editor.gohtml +++ b/templates/editor.gohtml @@ -30,6 +30,7 @@

{{ string .Blog.Lang "drafts" }}

{{ string .Blog.Lang "privateposts" }}

{{ string .Blog.Lang "unlistedposts" }}

+

{{ string .Blog.Lang "scheduledposts" }}

{{ string .Blog.Lang "upload" }}

diff --git a/templates/strings/de.yaml b/templates/strings/de.yaml index 5261681..c23fd60 100644 --- a/templates/strings/de.yaml +++ b/templates/strings/de.yaml @@ -43,6 +43,7 @@ prev: "Zurück" privateposts: "Private Posts" publishedon: "Veröffentlicht am" replyto: "Antwort an" +scheduledposts: "Geplante Posts" search: "Suchen" send: "Senden (zur Überprüfung)" share: "Online teilen" diff --git a/templates/strings/default.yaml b/templates/strings/default.yaml index 78f379f..831518b 100644 --- a/templates/strings/default.yaml +++ b/templates/strings/default.yaml @@ -54,6 +54,7 @@ privateposts: "Private posts" publishedon: "Published on" replyto: "Reply to" reverify: "Reverify" +scheduledposts: "Scheduled posts" scopes: "Scopes" search: "Search" send: "Send (to review)" diff --git a/templates/strings/pt-br.yaml b/templates/strings/pt-br.yaml index 2bfefe4..a6e0252 100644 --- a/templates/strings/pt-br.yaml +++ b/templates/strings/pt-br.yaml @@ -54,6 +54,7 @@ privateposts: "Posts privados" publishedon: "Publicado em" replyto: "Responder para" reverify: "Reverificar" +scheduledposts: "Posts programados" scopes: "Scopes" search: "Busca" send: "Enviar (para revisão)"