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"`
|
|
|
|
Content string `owl:"inputType=text widget=textarea"`
|
|
|
|
}
|
|
|
|
|
2023-07-09 17:51:49 +00:00
|
|
|
func (e *Image) Title() string {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
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)
|
|
|
|
}
|