Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
Add most simple detailing
Browse files Browse the repository at this point in the history
  • Loading branch information
sunfmin committed Jun 4, 2024
1 parent 149cd36 commit 9878b92
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docsrc/examples/examples_presets/detailing_inline_edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,25 @@ import (
"gorm.io/gorm"
)

func PresetsDetailSimple(b *presets.Builder, db *gorm.DB) (
cust *presets.ModelBuilder,
cl *presets.ListingBuilder,
ce *presets.EditingBuilder,
dp *presets.DetailingBuilder,
) {
err := db.AutoMigrate(&Customer{}, &CreditCard{}, &Note{})
if err != nil {
panic(err)
}
mediaBuilder := media.New(db)
b.DataOperator(gorm2op.DataOperator(db)).Use(mediaBuilder)

cust = b.Model(&Customer{})
dp = cust.Detailing("Name", "Email", "Description", "Avatar").Drawer(true)

return
}

func PresetsDetailInlineEditDetails(b *presets.Builder, db *gorm.DB) (
cust *presets.ModelBuilder,
cl *presets.ListingBuilder,
Expand Down
1 change: 1 addition & 0 deletions docsrc/examples/examples_presets/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func SamplesHandler(mux examples.Muxer, prefix string) {
addExample(mux, db, PresetsDetailInlineEditDetails)
addExample(mux, db, PresetsDetailInlineEditInspectTables)
addExample(mux, db, PresetsDetailInlineEditFieldSections)
addExample(mux, db, PresetsDetailSimple)
return
}

Expand Down

0 comments on commit 9878b92

Please sign in to comment.