layout.go 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package example_basics
  2. import (
  3. "github.com/qor5/admin/presets"
  4. "github.com/qor5/admin/richeditor"
  5. "github.com/qor5/web"
  6. )
  7. func layoutPieces() {
  8. var presetsBuilder *presets.Builder
  9. // @snippet_begin(CustomizeVuetifyOptions)
  10. presetsBuilder.VuetifyOptions(`
  11. {
  12. icons: {
  13. iconfont: 'md',
  14. },
  15. theme: {
  16. themes: {
  17. light: {
  18. primary: "#673ab7",
  19. secondary: "#009688",
  20. accent: "#ff5722",
  21. error: "#f44336",
  22. warning: "#ff9800",
  23. info: "#8bc34a",
  24. success: "#4caf50"
  25. },
  26. },
  27. },
  28. }
  29. `)
  30. // @snippet_end
  31. // @snippet_begin(InjectAssetViaExtraAsset)
  32. presetsBuilder.ExtraAsset("/redactor.js", "text/javascript", richeditor.JSComponentsPack())
  33. presetsBuilder.ExtraAsset("/redactor.css", "text/css", richeditor.CSSComponentsPack())
  34. // @snippet_end
  35. // @snippet_begin(InjectAssetViaAssetFunc)
  36. presetsBuilder.AssetFunc(func(ctx *web.EventContext) {
  37. ctx.Injector.Meta(web.MetaKey("charset"), "charset", "utf8")
  38. ctx.Injector.HeadHTML(`<script src="https://cdn.example.com/hello.js"></script>`)
  39. })
  40. // @snippet_end
  41. var modelBuilder *presets.ModelBuilder
  42. // @snippet_begin(ModelBuilderLayoutOptions)
  43. modelBuilder.LayoutConfig(&presets.LayoutConfig{
  44. SearchBoxInvisible: true,
  45. NotificationCenterInvisible: true,
  46. })
  47. // @snippet_end
  48. }