detail-page-for-complex-object.go 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package advanced_functions
  2. import (
  3. "github.com/qor5/docs/docsrc/examples/e21_presents"
  4. "github.com/qor5/docs/docsrc/generated"
  5. "github.com/qor5/docs/docsrc/utils"
  6. . "github.com/theplant/docgo"
  7. "github.com/theplant/docgo/ch"
  8. . "github.com/theplant/htmlgo"
  9. )
  10. var DetailPageForComplexObject = Doc(
  11. Markdown(`
  12. By default, presets will only generate the listing page, editing page for a model,
  13. It's for simple objects. But for a complicated object with a lots of relationships and connections,
  14. and as the main data model of your system, It's better to have detail page for them. In there
  15. You can add all kinds of operations conveniently.
  16. `),
  17. ch.Code(generated.PresetsDetailPageTopNotesSample).Language("go"),
  18. utils.Demo("Presets Detail Page Top Notes", e21_presents.PresetsDetailPageTopNotesPath+"/customers", "e21_presents/detailing.go"),
  19. Markdown(`
  20. - The name of detailing fields are just a place holder for decide ordering
  21. - ~CellComponentFunc~ customize how the cell display
  22. - ~vx.DataTable~ create a data table, Which the Listing page uses the same component
  23. - ~LoadMoreAt~ will only show for example 2 rows of data, and you can click load more to display all
  24. - ~vx.Card~ display a card with toolbar you can setup action buttons
  25. - We reference the new form drawer that ~b.Model(&Note{})~ creates, but hide notes in the menu
  26. `),
  27. utils.Anchor(H2(""), "Details Info components and actions"),
  28. Markdown(`
  29. A ~vx.DetailInfo~ component is used for display main detail field of the model.
  30. And you can add any actions to the detail page with ease:
  31. `),
  32. ch.Code(generated.PresetsDetailPageDetailsSample).Language("go"),
  33. utils.Demo("Presets Detail Page Details", e21_presents.PresetsDetailPageDetailsPath+"/customers", "e21_presents/detailing.go"),
  34. Markdown(`
  35. - The ~stripui.Card~ Actions links to two event functions: Agree Terms, and Update Details
  36. - Agree Terms show a drawer popup that edit the ~term_agreed_at~ field
  37. - Update Details reuse the edit customer form
  38. `),
  39. utils.Anchor(H2(""), "More Usage for Data Table"),
  40. Markdown(`
  41. A ~vx.DataTable~ component is very featured rich, Here check out the row expandable example:
  42. `),
  43. ch.Code(generated.PresetsDetailPageCardsSample).Language("go"),
  44. utils.Demo("Presets Detail Page Credit Cards", e21_presents.PresetsDetailPageCardsPath+"/customers", "e21_presents/detailing.go"),
  45. Markdown(`
  46. - ~RowExpandFunc~ config the content when data table row expand
  47. - ~cc.Editing~ setup the fields when edit
  48. - ~cc.Creating~ setup the fields when create
  49. `),
  50. ).Title("Detailing").
  51. Slug("presets-guide/detail-page-for-complex-object")