mirror of https://github.com/jlelse/GoBlog
Show possible states for post status
This commit is contained in:
parent
408f7aef6b
commit
55fa3421f9
30
editor.go
30
editor.go
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
|
@ -126,12 +127,10 @@ func (a *goBlog) editorPostTemplate(blog string) string {
|
|||
return builder.String()
|
||||
}
|
||||
|
||||
func (a *goBlog) editorMoreParams(blog string) string {
|
||||
var builder strings.Builder
|
||||
func (a *goBlog) editorPostDesc(blog string) string {
|
||||
bc := a.cfg.Blogs[blog]
|
||||
builder.WriteString(a.ts.GetTemplateStringVariant(bc.Lang, "emptyparams"))
|
||||
builder.WriteByte(' ')
|
||||
builder.WriteString(a.ts.GetTemplateStringVariant(bc.Lang, "moreparams"))
|
||||
t := a.ts.GetTemplateStringVariant(bc.Lang, "editorpostdesc")
|
||||
var paramBuilder, statusBuilder strings.Builder
|
||||
for i, param := range []string{
|
||||
"summary",
|
||||
"translationkey",
|
||||
|
@ -150,12 +149,21 @@ func (a *goBlog) editorMoreParams(blog string) string {
|
|||
continue
|
||||
}
|
||||
if i > 0 {
|
||||
builder.WriteString(", ")
|
||||
paramBuilder.WriteString(", ")
|
||||
}
|
||||
builder.WriteByte('`')
|
||||
builder.WriteString(param)
|
||||
builder.WriteByte('`')
|
||||
paramBuilder.WriteByte('`')
|
||||
paramBuilder.WriteString(param)
|
||||
paramBuilder.WriteByte('`')
|
||||
}
|
||||
builder.WriteByte('.')
|
||||
return builder.String()
|
||||
for i, status := range []postStatus{
|
||||
statusDraft, statusPublished, statusUnlisted, statusPrivate,
|
||||
} {
|
||||
if i > 0 {
|
||||
statusBuilder.WriteString(", ")
|
||||
}
|
||||
statusBuilder.WriteByte('`')
|
||||
statusBuilder.WriteString(string(status))
|
||||
statusBuilder.WriteByte('`')
|
||||
}
|
||||
return fmt.Sprintf(t, paramBuilder.String(), "status", statusBuilder.String())
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ func (a *goBlog) initRendering() error {
|
|||
"opensearch": openSearchUrl,
|
||||
"mbytes": mBytesString,
|
||||
"editortemplate": a.editorPostTemplate,
|
||||
"editormoreparams": a.editorMoreParams,
|
||||
"editorpostdesc": a.editorPostDesc,
|
||||
}
|
||||
baseTemplate, err := template.New("base").Funcs(templateFunctions).ParseFiles(path.Join(templatesDir, templateBase+templatesExt))
|
||||
if err != nil {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<main>
|
||||
<h1>{{ string .Blog.Lang "editor" }}</h1>
|
||||
<h2>{{ string .Blog.Lang "create" }}</h2>
|
||||
{{ md (editormoreparams .BlogString) }}
|
||||
{{ md (editorpostdesc .BlogString) }}
|
||||
<form class="fw p" method="post">
|
||||
<input type="hidden" name="h" value="entry">
|
||||
<textarea name="content" class="monospace h400p formcache" id="create-input">{{ editortemplate .BlogString }}</textarea>
|
||||
|
|
|
@ -13,8 +13,8 @@ docomment: "Kommentieren"
|
|||
download: "Herunterladen"
|
||||
drafts: "Entwürfe"
|
||||
editor: "Editor"
|
||||
editorpostdesc: "Leere Parameter werden automatisch entfernt. Mehr mögliche Parameter: %s. Mögliche Zustände für `%s`: %s."
|
||||
emailopt: "E-Mail (optional)"
|
||||
emptyparams: "Leere Parameter werden automatisch entfernt."
|
||||
fileuses: "Datei-Verwendungen"
|
||||
interactions: "Interaktionen & Kommentare"
|
||||
interactionslabel: "Hast du eine Antwort hierzu veröffentlicht? Füge hier die URL ein."
|
||||
|
@ -27,7 +27,6 @@ locationnotsupported: "Die Standort-API wird von diesem Browser nicht unterstüt
|
|||
mediafiles: "Medien-Dateien"
|
||||
message: "Nachricht"
|
||||
messagesent: "Nachricht gesendet"
|
||||
moreparams: "Mehr Parameter: "
|
||||
next: "Weiter"
|
||||
nofiles: "Keine Dateien"
|
||||
nolocations: "Keine Posts mit Standorten"
|
||||
|
|
|
@ -18,8 +18,8 @@ docomment: "Comment"
|
|||
download: "Download"
|
||||
drafts: "Drafts"
|
||||
editor: "Editor"
|
||||
editorpostdesc: "Empty parameters are removed automatically. More possible parameters: %s. Possible states for `%s`: %s."
|
||||
emailopt: "Email (optional)"
|
||||
emptyparams: "Empty parameters will be removed automatically."
|
||||
feed: "Feed"
|
||||
fileuses: "file uses"
|
||||
indieauth: "IndieAuth"
|
||||
|
@ -36,7 +36,6 @@ logout: "Logout"
|
|||
mediafiles: "Media files"
|
||||
message: "Message"
|
||||
messagesent: "Message sent"
|
||||
moreparams: "More parameters: "
|
||||
nameopt: "Name (optional)"
|
||||
next: "Next"
|
||||
nofiles: "No files"
|
||||
|
|
Loading…
Reference in New Issue