summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-12-06 14:19:56 -0800
committerSteve Manuel <nilslice@gmail.com>2016-12-06 14:19:56 -0800
commit4d46c0631703483c62c90f084aa559f85705ad61 (patch)
tree2bfaff2a0333fba79146369a735d5a9641d0b028
parent9bcd849014d8986e72220dc9d8d02888c3dd7103 (diff)
/*post?s*/ => /*content?s*/ substitution
-rw-r--r--system/admin/admin.go2
-rw-r--r--system/admin/handlers.go10
-rw-r--r--system/admin/server.go6
-rw-r--r--system/api/external.go2
-rw-r--r--system/api/handlers.go4
-rw-r--r--system/api/server.go6
-rw-r--r--system/db/content.go8
7 files changed, 19 insertions, 19 deletions
diff --git a/system/admin/admin.go b/system/admin/admin.go
index fdd3e6c..9ddff84 100644
--- a/system/admin/admin.go
+++ b/system/admin/admin.go
@@ -57,7 +57,7 @@ var mainAdminHTML = `
{{ range $t, $f := .Types }}
<div class="row collection-item">
- <li><a class="col s12" href="/admin/posts?type={{ $t }}"><i class="tiny left material-icons">playlist_add</i>{{ $t }}</a></li>
+ <li><a class="col s12" href="/admin/contents?type={{ $t }}"><i class="tiny left material-icons">playlist_add</i>{{ $t }}</a></li>
</div>
{{ end }}
diff --git a/system/admin/handlers.go b/system/admin/handlers.go
index 06e43d5..87e5fda 100644
--- a/system/admin/handlers.go
+++ b/system/admin/handlers.go
@@ -733,7 +733,7 @@ func recoveryEditHandler(res http.ResponseWriter, req *http.Request) {
}
-func postsHandler(res http.ResponseWriter, req *http.Request) {
+func contentsHandler(res http.ResponseWriter, req *http.Request) {
q := req.URL.Query()
t := q.Get("type")
if t == "" {
@@ -860,7 +860,7 @@ func postsHandler(res http.ResponseWriter, req *http.Request) {
</script>
</div>
</div>
- <form class="col s4" action="/admin/posts/search" method="get">
+ <form class="col s4" action="/admin/contents/search" method="get">
<div class="input-field post-search inline">
<label class="active">Search:</label>
<i class="right material-icons search-icon">search</i>
@@ -1086,7 +1086,7 @@ func adminPostListItem(e editor.Editable, typeName, status string) []byte {
return []byte(post)
}
-func approvePostHandler(res http.ResponseWriter, req *http.Request) {
+func approveContentHandler(res http.ResponseWriter, req *http.Request) {
if req.Method != http.MethodPost {
res.WriteHeader(http.StatusMethodNotAllowed)
errView, err := Error405()
@@ -1603,7 +1603,7 @@ func deleteHandler(res http.ResponseWriter, req *http.Request) {
}
redir := strings.TrimSuffix(req.URL.Scheme+req.URL.Host+req.URL.Path, "/edit/delete")
- redir = redir + "/posts?type=" + ct
+ redir = redir + "/contents?type=" + ct
http.Redirect(res, req, redir, http.StatusFound)
}
@@ -1648,7 +1648,7 @@ func searchHandler(res http.ResponseWriter, req *http.Request) {
<div class="card-content">
<div class="row">
<div class="card-title col s7">` + t + ` Results</div>
- <form class="col s4" action="/admin/posts/search" method="get">
+ <form class="col s4" action="/admin/contents/search" method="get">
<div class="input-field post-search inline">
<label class="active">Search:</label>
<i class="right material-icons search-icon">search</i>
diff --git a/system/admin/server.go b/system/admin/server.go
index 75b48f6..f80a750 100644
--- a/system/admin/server.go
+++ b/system/admin/server.go
@@ -27,12 +27,12 @@ func Run() {
http.HandleFunc("/admin/configure/users/edit", user.Auth(configUsersEditHandler))
http.HandleFunc("/admin/configure/users/delete", user.Auth(configUsersDeleteHandler))
- http.HandleFunc("/admin/posts", user.Auth(postsHandler))
- http.HandleFunc("/admin/posts/search", user.Auth(searchHandler))
+ http.HandleFunc("/admin/contents", user.Auth(contentsHandler))
+ http.HandleFunc("/admin/contents/search", user.Auth(searchHandler))
http.HandleFunc("/admin/edit", user.Auth(editHandler))
http.HandleFunc("/admin/edit/delete", user.Auth(deleteHandler))
- http.HandleFunc("/admin/edit/approve", user.Auth(approvePostHandler))
+ http.HandleFunc("/admin/edit/approve", user.Auth(approveContentHandler))
http.HandleFunc("/admin/edit/upload", user.Auth(editUploadHandler))
pwd, err := os.Getwd()
diff --git a/system/api/external.go b/system/api/external.go
index 52510c0..2e9597e 100644
--- a/system/api/external.go
+++ b/system/api/external.go
@@ -25,7 +25,7 @@ type Trustable interface {
AutoApprove(req *http.Request) error
}
-func externalPostHandler(res http.ResponseWriter, req *http.Request) {
+func externalContentHandler(res http.ResponseWriter, req *http.Request) {
if req.Method != http.MethodPost {
res.WriteHeader(http.StatusMethodNotAllowed)
return
diff --git a/system/api/handlers.go b/system/api/handlers.go
index 1d7dc8f..f31a1eb 100644
--- a/system/api/handlers.go
+++ b/system/api/handlers.go
@@ -28,7 +28,7 @@ func typesHandler(res http.ResponseWriter, req *http.Request) {
sendData(res, j, http.StatusOK)
}
-func postsHandler(res http.ResponseWriter, req *http.Request) {
+func contentsHandler(res http.ResponseWriter, req *http.Request) {
q := req.URL.Query()
t := q.Get("type")
if t == "" {
@@ -87,7 +87,7 @@ func postsHandler(res http.ResponseWriter, req *http.Request) {
sendData(res, j, http.StatusOK)
}
-func postHandler(res http.ResponseWriter, req *http.Request) {
+func contentHandler(res http.ResponseWriter, req *http.Request) {
q := req.URL.Query()
id := q.Get("id")
t := q.Get("type")
diff --git a/system/api/server.go b/system/api/server.go
index 70add10..823ec16 100644
--- a/system/api/server.go
+++ b/system/api/server.go
@@ -8,9 +8,9 @@ import (
func Run() {
http.HandleFunc("/api/types", CORS(Record(typesHandler)))
- http.HandleFunc("/api/contents", CORS(Record(postsHandler)))
+ http.HandleFunc("/api/contents", CORS(Record(contentsHandler)))
- http.HandleFunc("/api/content", CORS(Record(postHandler)))
+ http.HandleFunc("/api/content", CORS(Record(contentHandler)))
- http.HandleFunc("/api/content/external", CORS(Record(externalPostHandler)))
+ http.HandleFunc("/api/content/external", CORS(Record(externalContentHandler)))
}
diff --git a/system/db/content.go b/system/db/content.go
index 94d2bad..f313543 100644
--- a/system/db/content.go
+++ b/system/db/content.go
@@ -387,17 +387,17 @@ func SortContent(namespace string) {
}
-type sortablePosts []editor.Sortable
+type sortableContents []editor.Sortable
-func (s sortablePosts) Len() int {
+func (s sortableContents) Len() int {
return len(s)
}
-func (s sortablePosts) Less(i, j int) bool {
+func (s sortableContents) Less(i, j int) bool {
return s[i].Time() > s[j].Time()
}
-func (s sortablePosts) Swap(i, j int) {
+func (s sortableContents) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}