summaryrefslogtreecommitdiff
path: root/system
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-12-17 00:42:46 -0800
committerSteve Manuel <nilslice@gmail.com>2016-12-17 00:42:46 -0800
commitb564e0ce57730af0afa9fa43b26aaf4d49539c86 (patch)
tree7066c3f2df77d1b3eaa40489afb4587725cee36c /system
parentab793d204399ea0b46ec1938cc23a4d84ea045b4 (diff)
moving interfaces around which complicated import cycles
Diffstat (limited to 'system')
-rw-r--r--system/admin/handlers.go12
-rw-r--r--system/db/content.go10
2 files changed, 10 insertions, 12 deletions
diff --git a/system/admin/handlers.go b/system/admin/handlers.go
index 1e6a26c..fed77f7 100644
--- a/system/admin/handlers.go
+++ b/system/admin/handlers.go
@@ -1048,10 +1048,10 @@ func contentsHandler(res http.ResponseWriter, req *http.Request) {
// p is the asserted post as an Editable, t is the Type of the post.
// specifier is passed to append a name to a namespace like __pending
func adminPostListItem(e editor.Editable, typeName, status string) []byte {
- s, ok := e.(editor.Sortable)
+ s, ok := e.(content.Sortable)
if !ok {
- log.Println("Content type", typeName, "doesn't implement editor.Sortable")
- post := `<li class="col s12">Error retreiving data. Your data type doesn't implement necessary interfaces. (editor.Sortable)</li>`
+ log.Println("Content type", typeName, "doesn't implement content.Sortable")
+ post := `<li class="col s12">Error retreiving data. Your data type doesn't implement necessary interfaces. (content.Sortable)</li>`
return []byte(post)
}
@@ -1312,12 +1312,12 @@ func editHandler(res http.ResponseWriter, req *http.Request) {
return
}
} else {
- s, ok := post.(content.Identifiable)
+ item, ok := post.(content.Identifiable)
if !ok {
- log.Println("Content type", t, "doesn't implement editor.Identifiable")
+ log.Println("Content type", t, "doesn't implement content.Identifiable")
return
}
- s.SetItemID(-1)
+ item.SetItemID(-1)
}
m, err := manager.Manage(post.(editor.Editable), t)
diff --git a/system/db/content.go b/system/db/content.go
index 87b3e69..3293ff4 100644
--- a/system/db/content.go
+++ b/system/db/content.go
@@ -11,8 +11,6 @@ import (
"strings"
"github.com/bosssauce/ponzu/content"
- "github.com/bosssauce/ponzu/management/editor"
- "github.com/bosssauce/ponzu/management/manager"
"github.com/boltdb/bolt"
"github.com/gorilla/schema"
@@ -305,7 +303,7 @@ func Query(namespace string, opts QueryOptions) (int, [][]byte) {
// correct bad input rather than return nil or error
// similar to default case for opts.Order switch below
if opts.Count < 0 {
- opts.Count = 0
+ opts.Count = -1
}
if opts.Offset < 0 {
@@ -428,7 +426,7 @@ func SortContent(namespace string) {
return
}
- posts = append(posts, post.(editor.Sortable))
+ posts = append(posts, post.(content.Sortable))
}
// sort posts
@@ -469,7 +467,7 @@ func SortContent(namespace string) {
}
-type sortableContent []editor.Sortable
+type sortableContent []content.Sortable
func (s sortableContent) Len() int {
return len(s)
@@ -502,7 +500,7 @@ func postToJSON(ns string, data url.Values) ([]byte, error) {
// if the content has no slug, and has no specifier, create a slug, check it
// for duplicates, and add it to our values
if data.Get("slug") == "" && data.Get("__specifier") == "" {
- slug, err := manager.Slug(post.(content.Identifiable))
+ slug, err := content.Slug(post.(content.Identifiable))
if err != nil {
return nil, err
}