summaryrefslogtreecommitdiff
path: root/management/manager/manager.go
diff options
context:
space:
mode:
authorSteve <nilslice@gmail.com>2016-11-29 12:03:26 -0800
committerGitHub <noreply@github.com>2016-11-29 12:03:26 -0800
commitd11d86d73aebc2fc95eedebb166c58962762db2d (patch)
tree56e99f446ac5343297e9ff72f667930ec89948e9 /management/manager/manager.go
parentf252472047f86d1bdf956dc59b89541ea0260d68 (diff)
parentc50ae920c84b00eea7e7a896bff5546d1e013c16 (diff)
Merge pull request #18 from bosssauce/ponzu-dev
[tooling] Add Rails-like content generator for Content Types
Diffstat (limited to 'management/manager/manager.go')
-rw-r--r--management/manager/manager.go11
1 files changed, 8 insertions, 3 deletions
diff --git a/management/manager/manager.go b/management/manager/manager.go
index 2830ba4..6083f73 100644
--- a/management/manager/manager.go
+++ b/management/manager/manager.go
@@ -5,12 +5,15 @@ import (
"fmt"
"html/template"
+ "github.com/bosssauce/ponzu/content"
"github.com/bosssauce/ponzu/management/editor"
+ uuid "github.com/satori/go.uuid"
)
const managerHTML = `
<div class="card editor">
<form method="post" action="/admin/edit" enctype="multipart/form-data">
+ <input type="hidden" name="uuid" value="{{.UUID}}"/>
<input type="hidden" name="id" value="{{.ID}}"/>
<input type="hidden" name="type" value="{{.Kind}}"/>
{{ .Editor }}
@@ -104,6 +107,7 @@ const managerHTML = `
type manager struct {
ID int
+ UUID uuid.UUID
Kind string
Editor template.HTML
}
@@ -115,13 +119,14 @@ func Manage(e editor.Editable, typeName string) ([]byte, error) {
return nil, fmt.Errorf("Couldn't marshal editor for content %s. %s", typeName, err.Error())
}
- s, ok := e.(editor.Sortable)
+ i, ok := e.(content.Identifiable)
if !ok {
- return nil, fmt.Errorf("Content type %s does not implement content.Identifiable.", typeName)
+ return nil, fmt.Errorf("Content type %s does not implement content.Sortable.", typeName)
}
m := manager{
- ID: s.ItemID(),
+ ID: i.ItemID(),
+ UUID: i.UniqueID(),
Kind: typeName,
Editor: template.HTML(v),
}