summaryrefslogtreecommitdiff
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/item.go4
-rw-r--r--content/post.go16
2 files changed, 17 insertions, 3 deletions
diff --git a/content/item.go b/content/item.go
index 8b834e4..08d6359 100644
--- a/content/item.go
+++ b/content/item.go
@@ -1,7 +1,7 @@
package content
// Item should only be embedded into content type structs.
-// Helper for DB-related actions
type Item struct {
- ID int `json:"id"`
+ ID int `json:"id"`
+ Slug string `json:"slug"`
}
diff --git a/content/post.go b/content/post.go
index 4690f41..b12eb1d 100644
--- a/content/post.go
+++ b/content/post.go
@@ -21,18 +21,32 @@ func init() {
Types["Post"] = func() interface{} { return new(Post) }
}
+// SetContentID partially implements editor.Editable
+func (p *Post) SetContentID(id int) { p.ID = id }
+
// ContentID partially implements editor.Editable
func (p *Post) ContentID() int { return p.ID }
// ContentName partially implements editor.Editable
func (p *Post) ContentName() string { return p.Title }
+// SetSlug partially implements editor.Editable
+func (p *Post) SetSlug(slug string) { p.Slug = slug }
+
// Editor partially implements editor.Editable
func (p *Post) Editor() *editor.Editor { return &p.editor }
// MarshalEditor writes a buffer of html to edit a Post and partially implements editor.Editable
func (p *Post) MarshalEditor() ([]byte, error) {
- view, err := editor.New(p,
+ view, err := editor.Form(p,
+ editor.Field{
+ View: editor.Input("Slug", p, map[string]string{
+ "label": "URL Path",
+ "type": "text",
+ "disabled": "true",
+ "placeholder": "Will be set automatically",
+ }),
+ },
editor.Field{
View: editor.Input("Title", p, map[string]string{
"label": "Post Title",