summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-10-29 20:15:06 -0700
committerSteve Manuel <nilslice@gmail.com>2016-10-29 20:15:06 -0700
commit17bf0b7f04e599e1da010b7312141650a5d21bc7 (patch)
treec508f6bfa8b41e824e932bd81a162d3984c5c793
parent5737f4f300dfd624bdef292bd6e467ec2cbb6037 (diff)
testing fix for _pending content retrieval
-rw-r--r--system/admin/handlers.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/system/admin/handlers.go b/system/admin/handlers.go
index 94ce74b..314ecba 100644
--- a/system/admin/handlers.go
+++ b/system/admin/handlers.go
@@ -677,7 +677,7 @@ func postsHandler(res http.ResponseWriter, req *http.Request) {
continue
}
- post := adminPostListItem(p, t)
+ post := adminPostListItem(p, t, "_pending")
b.Write(post)
}
} else {
@@ -692,7 +692,7 @@ func postsHandler(res http.ResponseWriter, req *http.Request) {
continue
}
- post := adminPostListItem(p, t)
+ post := adminPostListItem(p, t, "")
b.Write(post)
}
}
@@ -710,7 +710,7 @@ func postsHandler(res http.ResponseWriter, req *http.Request) {
continue
}
- post := adminPostListItem(p, t)
+ post := adminPostListItem(p, t, "_pending")
b.Write(post)
}
} else {
@@ -725,7 +725,7 @@ func postsHandler(res http.ResponseWriter, req *http.Request) {
continue
}
- post := adminPostListItem(p, t)
+ post := adminPostListItem(p, t, "")
b.Write(post)
}
}
@@ -762,7 +762,8 @@ func postsHandler(res http.ResponseWriter, req *http.Request) {
// adminPostListItem is a helper to create the li containing a post.
// p is the asserted post as an Editable, t is the Type of the post.
-func adminPostListItem(p editor.Editable, t string) []byte {
+// specifier is passed to append a name to a namespace like _pending
+func adminPostListItem(p editor.Editable, t, specifier string) []byte {
s, ok := p.(editor.Sortable)
if !ok {
log.Println("Content type", t, "doesn't implement editor.Sortable")
@@ -780,14 +781,14 @@ func adminPostListItem(p editor.Editable, t string) []byte {
post := `
<li class="col s12">
- <a href="/admin/edit?type=` + t + `&id=` + cid + `">` + p.ContentName() + `</a>
+ <a href="/admin/edit?type=` + t + specifier + `&id=` + cid + `">` + p.ContentName() + `</a>
<span class="post-detail">Updated: ` + updatedTime + `</span>
<span class="publish-date right">` + publishTime + `</span>
<form enctype="multipart/form-data" class="quick-delete-post __ponzu right" action="/admin/edit/delete" method="post">
<span>Delete</span>
<input type="hidden" name="id" value="` + cid + `" />
- <input type="hidden" name="type" value="` + t + `" />
+ <input type="hidden" name="type" value="` + t + specifier + `" />
</form>
</li>`
@@ -817,7 +818,7 @@ func editHandler(res http.ResponseWriter, req *http.Request) {
if status == "pending" {
t = t + "_pending"
}
- fmt.Println(t, i, status)
+
data, err := db.Content(t + ":" + i)
if err != nil {
log.Println(err)