diff options
author | Steve Manuel <nilslice@gmail.com> | 2016-11-03 00:54:13 -0700 |
---|---|---|
committer | Steve Manuel <nilslice@gmail.com> | 2016-11-03 00:54:13 -0700 |
commit | 9db0046fadcd703d9903c7abd4159ded0730bf3a (patch) | |
tree | 0ac3592b120e175372e3d78276d2cbf8bbf2bccd /management/manager | |
parent | 607f29fd3e61df0b921178995eb12fdee5049f16 (diff) |
simplifying Editable interface by adding Sluggable and Identifiable interfaces, moving relevant interface methods to be implemented by other types and updating caller code to assert the new interface types as needed
Diffstat (limited to 'management/manager')
-rw-r--r-- | management/manager/manager.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/management/manager/manager.go b/management/manager/manager.go index c0c5519..2830ba4 100644 --- a/management/manager/manager.go +++ b/management/manager/manager.go @@ -112,11 +112,16 @@ type manager struct { func Manage(e editor.Editable, typeName string) ([]byte, error) { v, err := e.MarshalEditor() if err != nil { - return nil, fmt.Errorf("Couldn't marshal editor for content %T. %s", e, err.Error()) + return nil, fmt.Errorf("Couldn't marshal editor for content %s. %s", typeName, err.Error()) + } + + s, ok := e.(editor.Sortable) + if !ok { + return nil, fmt.Errorf("Content type %s does not implement content.Identifiable.", typeName) } m := manager{ - ID: e.ContentID(), + ID: s.ItemID(), Kind: typeName, Editor: template.HTML(v), } |