brand.go 1020 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package e21_presents
  2. import (
  3. "github.com/qor5/admin/presets"
  4. "github.com/qor5/ui/vuetify"
  5. "github.com/qor5/web"
  6. h "github.com/theplant/htmlgo"
  7. )
  8. type brand struct{}
  9. func PresetsBrandTitle(b *presets.Builder) {
  10. // @snippet_begin(BrandTitleSample)
  11. b.URIPrefix(PresetsBrandTitlePath).
  12. BrandTitle("QOR5 Admin")
  13. // @snippet_end
  14. b.Model(&brand{}).Listing().PageFunc(func(ctx *web.EventContext) (r web.PageResponse, err error) {
  15. r.Body = vuetify.VContainer()
  16. return
  17. })
  18. }
  19. func PresetsBrandFunc(b *presets.Builder) {
  20. // @snippet_begin(BrandFuncSample)
  21. b.URIPrefix(PresetsBrandFuncPath).
  22. BrandFunc(func(ctx *web.EventContext) h.HTMLComponent {
  23. return vuetify.VCardText(
  24. h.H1("Admin").Style("color: red;"),
  25. ).Class("pa-0")
  26. })
  27. // @snippet_end
  28. b.Model(&brand{}).Listing().PageFunc(func(ctx *web.EventContext) (r web.PageResponse, err error) {
  29. r.Body = vuetify.VContainer()
  30. return
  31. })
  32. }
  33. const PresetsBrandTitlePath = "/samples/brand_title"
  34. const PresetsBrandFuncPath = "/samples/brand_func"