diff options
author | Steve <nilslice@gmail.com> | 2016-12-14 10:04:42 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-12-14 10:04:42 -0800 |
commit | 372bd05522a7730891778082c0e0875d47445d59 (patch) | |
tree | 8775b01a283c32dce3297dbddad1ddf14a114c33 /management/manager/manager.go | |
parent | 8e1269385b2ea6bb8a115030a4a6f4c12fa24868 (diff) | |
parent | b3aa9440f62db5a530397c525a42b4fca7b27bab (diff) |
Merge pull request #22 from bosssauce/ponzu-dev
[core] Add a index for content slugs allowing quicker lookup via slug
Diffstat (limited to 'management/manager/manager.go')
-rw-r--r-- | management/manager/manager.go | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/management/manager/manager.go b/management/manager/manager.go index 6083f73..989eb98 100644 --- a/management/manager/manager.go +++ b/management/manager/manager.go @@ -16,6 +16,7 @@ const managerHTML = ` <input type="hidden" name="uuid" value="{{.UUID}}"/> <input type="hidden" name="id" value="{{.ID}}"/> <input type="hidden" name="type" value="{{.Kind}}"/> + <input type="hidden" name="slug" value="{{.Slug}}"/> {{ .Editor }} </form> <script> @@ -109,6 +110,7 @@ type manager struct { ID int UUID uuid.UUID Kind string + Slug string Editor template.HTML } @@ -121,13 +123,19 @@ func Manage(e editor.Editable, typeName string) ([]byte, error) { i, ok := e.(content.Identifiable) if !ok { - return nil, fmt.Errorf("Content type %s does not implement content.Sortable.", typeName) + return nil, fmt.Errorf("Content type %s does not implement content.Identifiable.", typeName) + } + + s, ok := e.(content.Sluggable) + if !ok { + return nil, fmt.Errorf("Content type %s does not implement content.Sluggable.", typeName) } m := manager{ ID: i.ItemID(), UUID: i.UniqueID(), Kind: typeName, + Slug: s.ItemSlug(), // TODO: just added this and its implementation -- need to rebuild & test Editor: template.HTML(v), } |