summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-11-09 17:57:32 -0800
committerSteve Manuel <nilslice@gmail.com>2016-11-09 17:57:32 -0800
commitf63f7c4a847b37290121f823ae870e8fda74442f (patch)
treed3689c7cb43c516e1250d9fe4cd26bcf9f1b5ff1
parentf0eeb90641a85f30ea364a506fa548ac3b24fd09 (diff)
moving Mergeable interface to editor package. Fighting with cyclical imports for too long will make you do things. Editable and Sortable interfaces are here already, so clerically its ok.
-rw-r--r--content/types.go10
-rw-r--r--management/editor/editor.go13
2 files changed, 10 insertions, 13 deletions
diff --git a/content/types.go b/content/types.go
index f3b8bb3..ede2b58 100644
--- a/content/types.go
+++ b/content/types.go
@@ -1,7 +1,5 @@
package content
-import "net/http"
-
const (
// ErrTypeNotRegistered means content type isn't registered (not found in Types map)
ErrTypeNotRegistered = `Error:
@@ -18,14 +16,6 @@ func init() {
`
)
-// Mergeable allows external post content to be approved and published through
-// the public-facing API
-type Mergeable interface {
- // Approve copies an external post to the internal collection and triggers
- // a re-sort of its content type posts
- Approve(req *http.Request) error
-}
-
// Types is a map used to reference a type name to its actual Editable type
// mainly for lookups in /admin route based utilities
var Types = make(map[string]func() interface{})
diff --git a/management/editor/editor.go b/management/editor/editor.go
index a591804..3d8e9c6 100644
--- a/management/editor/editor.go
+++ b/management/editor/editor.go
@@ -4,8 +4,7 @@ package editor
import (
"bytes"
-
- "github.com/bosssauce/ponzu/content"
+ "net/http"
)
// Editable ensures data is editable
@@ -22,6 +21,14 @@ type Sortable interface {
ItemID() int
}
+// Mergeable allows external post content to be approved and published through
+// the public-facing API
+type Mergeable interface {
+ // Approve copies an external post to the internal collection and triggers
+ // a re-sort of its content type posts
+ Approve(req *http.Request) error
+}
+
// Editor is a view containing fields to manage content
type Editor struct {
ViewBuf *bytes.Buffer
@@ -109,7 +116,7 @@ func Form(post Editable, fields ...Field) ([]byte, error) {
<button class="right waves-effect waves-light btn red delete-post" type="submit">Delete</button>
</div>
`
- m, ok := post.(content.Mergeable)
+ m, ok := post.(Mergeable)
if ok {
submit +=
`