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

qor5/ui to qor5/x/ui #89

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/qor5/admin-template/admin/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/qor5/admin/v3/presets"
"github.com/qor5/admin/v3/presets/gorm2op"
"github.com/qor5/docs/v3/cmd/qor5/admin-template/models"
. "github.com/qor5/ui/v3/vuetify"
"github.com/qor5/web/v3"
. "github.com/qor5/x/v3/ui/vuetify"
. "github.com/theplant/htmlgo"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/qor5/website-template/admin/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ import (
"github.com/qor5/admin/v3/publish"
"github.com/qor5/admin/v3/seo"
"github.com/qor5/admin/v3/utils"
"github.com/qor5/ui/v3/vuetify"
"github.com/qor5/web/v3"
"github.com/qor5/x/v3/login"
"github.com/qor5/x/v3/perm"
"github.com/qor5/x/v3/ui/vuetify"
h "github.com/theplant/htmlgo"
"golang.org/x/text/language"
)
Expand Down
2 changes: 1 addition & 1 deletion docs/activity-log.html
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ <h2 id="initialize-the-activity-package">Initialize the activity package</h2>
<h2 id="register-the-models-that-require-activity-tracking">Register the models that require activity tracking</h2>
<p>This example demonstrates how to register <code>Product</code> into the activity. The activities on the product model will be automatically recorded when it is created, updated, or deleted.</p>

<highlightjs :language='"go"' :code='"type WithActivityProduct struct {\n\tgorm.Model\n\tTitle string\n\tCode string\n\tPrice float64\n}\nerr := db.AutoMigrate(\u0026WithActivityProduct{})\nif err != nil {\n\tpanic(err)\n}\nproductModel := b.Model(\u0026WithActivityProduct{}).Use(activityBuilder)\n\nbt := productModel.Detailing(\"Content\", activity.Timeline).Drawer(true)\nbt.Field(\"Content\").SetSwitchable(true).ShowComponentFunc(func(obj interface{}, field *presets.FieldContext, ctx *web.EventContext) HTMLComponent {\n\treturn Div().Text(\"text\")\n}).Editing(\"Title\", \"Code\", \"Price\")\n\nactivityBuilder.RegisterModel(productModel).EnableActivityInfoTab().AddKeys(\"Title\").AddIgnoredFields(\"Code\").SkipDelete()"'></highlightjs>
<highlightjs :language='"go"' :code='"type WithActivityProduct struct {\n\tgorm.Model\n\tTitle string\n\tCode string\n\tPrice float64\n}\nerr := db.AutoMigrate(\u0026WithActivityProduct{})\nif err != nil {\n\tpanic(err)\n}\nproductModel := b.Model(\u0026WithActivityProduct{}).Use(activityBuilder)\n\nbt := productModel.Detailing(\"Content\", activity.Timeline).Drawer(true)\nbt.Section(\"Content\").\n\tViewComponentFunc(func(obj interface{}, field *presets.FieldContext, ctx *web.EventContext) HTMLComponent {\n\t\treturn Div().Text(\"text\")\n\t}).Editing(\"Title\", \"Code\", \"Price\")\n\nactivityBuilder.RegisterModel(productModel).EnableActivityInfoTab().AddKeys(\"Title\").AddIgnoredFields(\"Code\").SkipDelete()"'></highlightjs>
<p>By default, the activity package will use the primary key as the key to indentify the current model data. You can use <code>SetKeys</code> and <code>AddKeys</code> methods to customize it.</p>
<p>When diffing the modified data, the activity package will ignore the <code>ID</code>, <code>CreatedAt</code>, <code>UpdatedAt</code>, <code>DeletedAt</code> fields. You can either use <code>AddIgnoredFields</code> to append your own fields to the default ignored fields. Or <code>SetIgnoredFields</code> method to replace the default ignored fields.</p>
<p>For special fields like <code>time.Time</code> or media files handled by QOR5 media_library, activity package already handled them. You can use <code>AddTypeHanders</code> method to handle your own field types.</p>
Expand Down
2 changes: 1 addition & 1 deletion docs/advanced-functions/the-go-html-builder.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ <h1 class='mb-8'>The Go HTML builder</h1>
<div class='demo'>
<a href='/samples/type-safe-builder-example' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/type-safe-builder-sample.go#L3-L47' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/type-safe-builder-sample.go#L3-L47' target='_blank'>Source on GitHub</a>
</div>
</div>
</div>
Expand Down
126 changes: 63 additions & 63 deletions docs/appendix/all-demo-examples.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions docs/basics/brand.html
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ <h2 id="simple-customization">Simple customization</h2>
<div class='demo'>
<a href='/samples/presets-brand-title/brands' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_presets/brand.go#L19-L21' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_presets/brand.go#L19-L21' target='_blank'>Source on GitHub</a>
</div>
</div>
<h2 id="full-customization">Full customization</h2>
Expand All @@ -240,7 +240,7 @@ <h2 id="full-customization">Full customization</h2>
<div class='demo'>
<a href='/samples/presets-brand-func/brands' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_presets/brand.go#L35-L41' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_presets/brand.go#L35-L41' target='_blank'>Source on GitHub</a>
</div>
</div>
<h2 id="profile">Profile</h2>
Expand All @@ -252,7 +252,7 @@ <h2 id="profile">Profile</h2>
<div class='demo'>
<a href='/samples/presets-profile/brands' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_presets/profile.go#L11-L76' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_presets/profile.go#L11-L76' target='_blank'>Source on GitHub</a>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/basics/confirm-dialog.html
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ <h2 id="example">Example</h2>
<div class='demo'>
<a href='/samples/presets-confirm-dialog/confirm-dialog' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_presets/confirm-dialog.go#L43-L53' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_presets/confirm-dialog.go#L43-L53' target='_blank'>Source on GitHub</a>
</div>
</div>
</div>
Expand Down
28 changes: 14 additions & 14 deletions docs/basics/event-handling.html
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ <h2 id='url'>URL
<div class='demo'>
<a href='/samples/event-handling-page?api=url' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L17-L28' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L17-L28' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -248,7 +248,7 @@ <h2 id='pushstate'>PushState
<div class='demo'>
<a href='/samples/event-handling-page?api=pushstate' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L30-L41' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L30-L41' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -263,7 +263,7 @@ <h2 id='reload'>Reload
<div class='demo'>
<a href='/samples/event-handling-page?api=reload' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L43-L55' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L43-L55' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -278,7 +278,7 @@ <h2 id='query'>Query
<div class='demo'>
<a href='/samples/event-handling-page?api=query' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L57-L68' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L57-L68' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -293,7 +293,7 @@ <h2 id='mergequery'>MergeQuery
<div class='demo'>
<a href='/samples/event-handling-page?api=merge_query' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L70-L81' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L70-L81' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -308,7 +308,7 @@ <h2 id='clearmergequery'>ClearMergeQuery
<div class='demo'>
<a href='/samples/event-handling-page?api=clear_merge_query' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L83-L94' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L83-L94' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -323,7 +323,7 @@ <h2 id='stringquery'>StringQuery
<div class='demo'>
<a href='/samples/event-handling-page?api=string_query' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L96-L107' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L96-L107' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -338,7 +338,7 @@ <h2 id='queries'>Queries
<div class='demo'>
<a href='/samples/event-handling-page?api=queries' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L109-L120' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L109-L120' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -353,7 +353,7 @@ <h2 id='pushstateurl'>PushStateURL
<div class='demo'>
<a href='/samples/event-handling-page?api=pushstateurl' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L109-L120' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L109-L120' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -368,7 +368,7 @@ <h2 id='location'>Location
<div class='demo'>
<a href='/samples/event-handling-page?api=location' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L135-L146' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L135-L146' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -383,7 +383,7 @@ <h2 id='fieldvalue'>FieldValue
<div class='demo'>
<a href='/samples/event-handling-page?api=fieldvalue' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L148-L159' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L148-L159' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -398,7 +398,7 @@ <h2 id='eventfunc'>EventFunc
<div class='demo'>
<a href='/samples/event-handling-page?api=eventfunc' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L161-L169' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L161-L169' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -413,7 +413,7 @@ <h2 id='script'>Script
<div class='demo'>
<a href='/samples/event-handling-page?api=script' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L171-L193' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L171-L193' target='_blank'>Source on GitHub</a>
</div>
</div>

Expand All @@ -428,7 +428,7 @@ <h2 id='raw'>Raw
<div class='demo'>
<a href='/samples/event-handling-page?api=raw' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/event-handling.go#L195-L206' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/event-handling.go#L195-L206' target='_blank'>Source on GitHub</a>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/basics/filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ <h1 class='mb-8'>Filters</h1>

<div class='border-t'><p>Assume we have a <code>status</code> filed in Post. It has 2 possible values, &quot;draft&quot; and &quot;online&quot;. If we want to filter posts by its status. We can add a filter like this:</p>

<highlightjs :language='"go"' :code='"import (\n\t\"time\"\n\n\t\"github.com/qor5/admin/v3/presets\"\n\t\"github.com/qor5/admin/v3/presets/gorm2op\"\n\t\"github.com/qor5/ui/v3/vuetifyx\"\n\t\"github.com/qor5/web/v3\"\n\t\"gorm.io/gorm\"\n)\n\ntype Post struct {\n\tID uint\n\tTitle string\n\tBody string\n\tUpdatedAt time.Time\n\tCreatedAt time.Time\n\tDisabled bool\n\n\tStatus string\n\n\tCategoryID uint\n}\n\nfunc PresetsBasicFilter(b *presets.Builder, db *gorm.DB) (\n\tmb *presets.ModelBuilder,\n\tcl *presets.ListingBuilder,\n\tce *presets.EditingBuilder,\n\tdp *presets.DetailingBuilder,\n) {\n\tb.DataOperator(gorm2op.DataOperator(db))\n\terr := db.AutoMigrate(\u0026Post{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// create a ModelBuilder\n\tpostBuilder := b.Model(\u0026Post{})\n\n\t// get its ListingBuilder\n\tlisting := postBuilder.Listing()\n\n\t// Call FilterDataFunc\n\tlisting.FilterDataFunc(func(ctx *web.EventContext) vuetifyx.FilterData {\n\t\t// Prepare filter options, it is a two dimension array: [][]string{\"text\", \"value\"}\n\t\toptions := []*vuetifyx.SelectItem{\n\t\t\t{Text: \"Draft\", Value: \"draft\"},\n\t\t\t{Text: \"Online\", Value: \"online\"},\n\t\t}\n\n\t\treturn []*vuetifyx.FilterItem{\n\t\t\t{\n\t\t\t\tKey: \"status\",\n\t\t\t\tLabel: \"Status\",\n\t\t\t\tItemType: vuetifyx.ItemTypeSelect,\n\t\t\t\t// %s is the condition. e.g. \u003e, \u003e=, =, \u003c, \u003c=, like,\n\t\t\t\t// ? is the value of selected option\n\t\t\t\tSQLCondition: `status %s ?`,\n\t\t\t\tOptions: options,\n\t\t\t},\n\t\t}\n\t})\n\treturn\n}\n"'></highlightjs>
<highlightjs :language='"go"' :code='"import (\n\t\"time\"\n\n\t\"github.com/qor5/admin/v3/presets\"\n\t\"github.com/qor5/admin/v3/presets/gorm2op\"\n\t\"github.com/qor5/web/v3\"\n\t\"github.com/qor5/x/v3/ui/vuetifyx\"\n\t\"gorm.io/gorm\"\n)\n\ntype Post struct {\n\tID uint\n\tTitle string\n\tBody string\n\tUpdatedAt time.Time\n\tCreatedAt time.Time\n\tDisabled bool\n\n\tStatus string\n\n\tCategoryID uint\n}\n\nfunc PresetsBasicFilter(b *presets.Builder, db *gorm.DB) (\n\tmb *presets.ModelBuilder,\n\tcl *presets.ListingBuilder,\n\tce *presets.EditingBuilder,\n\tdp *presets.DetailingBuilder,\n) {\n\tb.DataOperator(gorm2op.DataOperator(db))\n\terr := db.AutoMigrate(\u0026Post{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t// create a ModelBuilder\n\tpostBuilder := b.Model(\u0026Post{})\n\n\t// get its ListingBuilder\n\tlisting := postBuilder.Listing()\n\n\t// Call FilterDataFunc\n\tlisting.FilterDataFunc(func(ctx *web.EventContext) vuetifyx.FilterData {\n\t\t// Prepare filter options, it is a two dimension array: [][]string{\"text\", \"value\"}\n\t\toptions := []*vuetifyx.SelectItem{\n\t\t\t{Text: \"Draft\", Value: \"draft\"},\n\t\t\t{Text: \"Online\", Value: \"online\"},\n\t\t}\n\n\t\treturn []*vuetifyx.FilterItem{\n\t\t\t{\n\t\t\t\tKey: \"status\",\n\t\t\t\tLabel: \"Status\",\n\t\t\t\tItemType: vuetifyx.ItemTypeSelect,\n\t\t\t\t// %s is the condition. e.g. \u003e, \u003e=, =, \u003c, \u003c=, like,\n\t\t\t\t// ? is the value of selected option\n\t\t\t\tSQLCondition: `status %s ?`,\n\t\t\t\tOptions: options,\n\t\t\t},\n\t\t}\n\t})\n\treturn\n}\n"'></highlightjs>

<div>
<div class='demo'>
<a href='/samples/presets-basic-filter/posts' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_presets/filter.go#L3-L67' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_presets/filter.go#L3-L67' target='_blank'>Source on GitHub</a>
</div>
</div>
<h3 id="qor5-now-supports-7-types-of-filter-option">QOR5 now supports 7 types of filter option.</h3>
Expand Down
2 changes: 1 addition & 1 deletion docs/basics/form-handling.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ <h1 class='mb-8'>Form Handling</h1>
<div class='demo'>
<a href='/samples/form-handling-page' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_web/form-handling.go#L3-L210' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_web/form-handling.go#L3-L210' target='_blank'>Source on GitHub</a>
</div>
</div>
<p>Use <code>.Attr(web.VField(&quot;Abc&quot;)...)</code> to set the field name, make the name matches your data struct field name.<br />
Expand Down
2 changes: 1 addition & 1 deletion docs/basics/i18n.html
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ <h1 class='mb-8'>Internationalization</h1>
<div class='demo'>
<a href='/samples/internationalization-example/home' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/docs/tree/vue3/docsrc/examples/examples_admin/internationalization.go' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/docs/tree/main/docsrc/examples/examples_admin/internationalization.go' target='_blank'>Source on GitHub</a>
</div>
</div>
<h2 id="getting-started">Getting Started</h2>
Expand Down
Loading
Loading