package containers import ( "fmt" "github.com/iancoleman/strcase" "github.com/jinzhu/inflection" "github.com/qor5/admin/pagebuilder" "github.com/qor5/web" . "github.com/theplant/htmlgo" ) type WebFooter struct { ID uint EnglishUrl string JapaneseUrl string } func (*WebFooter) TableName() string { return "container_footers" } func RegisterFooter(pb *pagebuilder.Builder) { footer := pb.RegisterContainer("Footer"). RenderFunc(func(obj interface{}, input *pagebuilder.RenderInput, ctx *web.EventContext) HTMLComponent { footer := obj.(*WebFooter) return FooterTemplate(footer, input) }) footer.Model(&WebFooter{}).URIName(inflection.Plural(strcase.ToKebab("Footer"))).Editing("EnglishUrl", "JapaneseUrl") } func FooterTemplate(data *WebFooter, input *pagebuilder.RenderInput) (body HTMLComponent) { body = ContainerWrapper( fmt.Sprintf(inflection.Plural(strcase.ToKebab("Footer"))+"_%v", data.ID), "", "container-footer", "", "", "", "", false, false, input.IsEditor, input.IsReadonly, "", Div(RawHTML(fmt.Sprintf(` `, data.EnglishUrl, data.JapaneseUrl))).Class("container-wrapper")) return }