summaryrefslogtreecommitdiff
path: root/management/manager
diff options
context:
space:
mode:
authorSteve Manuel <nilslice@gmail.com>2016-12-14 08:40:35 -0800
committerSteve Manuel <nilslice@gmail.com>2016-12-14 08:40:35 -0800
commit6808d3bf58e19e9230e7966798a70406f6d306e0 (patch)
tree5935a919b7f5f1710895a5f7609e908d491af345 /management/manager
parent8e1269385b2ea6bb8a115030a4a6f4c12fa24868 (diff)
adding __contentIndex to map item slug to semi foreign-key, and implementing add/delete features
Diffstat (limited to 'management/manager')
-rw-r--r--management/manager/manager.go10
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),
}