2023-07-08 13:59:26 +00:00
|
|
|
package model
|
|
|
|
|
2023-07-09 17:51:49 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"owl-blogs/render"
|
|
|
|
)
|
|
|
|
|
2023-07-08 13:59:26 +00:00
|
|
|
type Image struct {
|
|
|
|
EntryBase
|
|
|
|
meta ImageMetaData
|
|
|
|
}
|
|
|
|
|
|
|
|
type ImageMetaData struct {
|
|
|
|
ImageId string `owl:"inputType=file"`
|
2023-07-13 18:39:24 +00:00
|
|
|
Title string `owl:"inputType=text"`
|
2023-07-08 13:59:26 +00:00
|
|
|
Content string `owl:"inputType=text widget=textarea"`
|
|
|
|
}
|
|
|
|
|
2023-07-09 17:51:49 +00:00
|
|
|
func (e *Image) Title() string {
|
2023-07-13 18:39:24 +00:00
|
|
|
return e.meta.Title
|
2023-07-09 17:51:49 +00:00
|
|
|
}
|
|
|
|
|
2023-07-08 13:59:26 +00:00
|
|
|
func (e *Image) Content() EntryContent {
|
2023-07-09 17:51:49 +00:00
|
|
|
str, err := render.RenderTemplateToString("entry/Image", e)
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
}
|
|
|
|
return EntryContent(str)
|
2023-07-08 13:59:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (e *Image) MetaData() interface{} {
|
|
|
|
return &e.meta
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *Image) SetMetaData(metaData interface{}) {
|
|
|
|
e.meta = *metaData.(*ImageMetaData)
|
|
|
|
}
|