diff options
-rw-r--r-- | management/editor/editor.go | 1 | ||||
-rw-r--r-- | management/manager/process.go | 6 | ||||
-rw-r--r-- | system/admin/config/config.go | 4 | ||||
-rw-r--r-- | system/admin/handlers.go | 2 | ||||
-rw-r--r-- | system/db/content.go | 2 |
5 files changed, 7 insertions, 8 deletions
diff --git a/management/editor/editor.go b/management/editor/editor.go index 2a9183b..6b55a38 100644 --- a/management/editor/editor.go +++ b/management/editor/editor.go @@ -9,7 +9,6 @@ import ( // Editable ensures data is editable type Editable interface { - ContentName() string Editor() *Editor MarshalEditor() ([]byte, error) } diff --git a/management/manager/process.go b/management/manager/process.go index ec09e45..ad6da94 100644 --- a/management/manager/process.go +++ b/management/manager/process.go @@ -5,16 +5,16 @@ import ( "strings" "unicode" - "github.com/bosssauce/ponzu/management/editor" + "github.com/bosssauce/ponzu/content" "golang.org/x/text/transform" "golang.org/x/text/unicode/norm" ) // Slug returns a URL friendly string from the title of a post item -func Slug(e editor.Editable) (string, error) { +func Slug(i content.Identifiable) (string, error) { // get the name of the post item - name := strings.TrimSpace(e.ContentName()) + name := strings.TrimSpace(i.String()) // filter out non-alphanumeric character or non-whitespace slug, err := stringToSlug(name) diff --git a/system/admin/config/config.go b/system/admin/config/config.go index 0a7103e..b898b49 100644 --- a/system/admin/config/config.go +++ b/system/admin/config/config.go @@ -18,8 +18,8 @@ type Config struct { CacheInvalidate []string `json:"cache"` } -// ContentName partially implements editor.Editable -func (c *Config) ContentName() string { return c.Name } +// String partially implements content.Identifiable and overrides Item's String() +func (c *Config) String() string { return c.Name } // Editor partially implements editor.Editable func (c *Config) Editor() *editor.Editor { return &c.editor } diff --git a/system/admin/handlers.go b/system/admin/handlers.go index 247cca7..7ea018c 100644 --- a/system/admin/handlers.go +++ b/system/admin/handlers.go @@ -1071,7 +1071,7 @@ func adminPostListItem(e editor.Editable, typeName, status string) []byte { post := ` <li class="col s12"> - <a href="/admin/edit?type=` + typeName + `&status=` + strings.TrimPrefix(status, "_") + `&id=` + cid + `">` + e.ContentName() + `</a> + <a href="/admin/edit?type=` + typeName + `&status=` + strings.TrimPrefix(status, "_") + `&id=` + cid + `">` + i.String() + `</a> <span class="post-detail">Updated: ` + updatedTime + `</span> <span class="publish-date right">` + publishTime + `</span> diff --git a/system/db/content.go b/system/db/content.go index 76d95c5..b2ba87a 100644 --- a/system/db/content.go +++ b/system/db/content.go @@ -418,7 +418,7 @@ func postToJSON(ns string, data url.Values) ([]byte, error) { return nil, err } - slug, err := manager.Slug(post.(editor.Editable)) + slug, err := manager.Slug(post.(content.Identifiable)) if err != nil { return nil, err } |