Skip to content

Commit

Permalink
Merge pull request #275 from qor5/fix/campaign-publish
Browse files Browse the repository at this point in the history
Fix/campaign publish
  • Loading branch information
zhangshanwen authored Jun 21, 2024
2 parents 935b495 + a771947 commit 96be6a9
Show file tree
Hide file tree
Showing 17 changed files with 697 additions and 751 deletions.
16 changes: 8 additions & 8 deletions docs/docs/appendix/all-demo-examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ <h1 class='mb-8'>All Demo Examples</h1>
<li>
<a href='/samples/presets-basic-filter/posts' target='_blank'>Basic filter</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/filter.go#L3-L67' target='_blank'>Source</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/filter.go#L3-L86' target='_blank'>Source</a>
</li>

<li>
Expand All @@ -492,7 +492,7 @@ <h1 class='mb-8'>All Demo Examples</h1>
<li>
<a href='/samples/presets-hello-world/customers' target='_blank'>Presets Hello World</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L1-L66' target='_blank'>Source</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L1-L67' target='_blank'>Source</a>
</li>

<li>
Expand All @@ -510,31 +510,31 @@ <h1 class='mb-8'>All Demo Examples</h1>
<li>
<a href='/samples/presets-listing-customization-fields/customers' target='_blank'>Presets Listing Customization Fields</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L68-L173' target='_blank'>Source</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L80-L185' target='_blank'>Source</a>
</li>

<li>
<a href='/samples/presets-listing-customization-filters/customers' target='_blank'>Presets Listing Filters</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L175-L226' target='_blank'>Source</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L187-L238' target='_blank'>Source</a>
</li>

<li>
<a href='/samples/presets-listing-customization-tabs/customers' target='_blank'>Presets Listing Filter Tabs</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L228-L263' target='_blank'>Source</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L240-L275' target='_blank'>Source</a>
</li>

<li>
<a href='/samples/presets-listing-customization-bulk-actions/customers' target='_blank'>Presets Listing Bulk Actions</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L265-L315' target='_blank'>Source</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L277-L327' target='_blank'>Source</a>
</li>

<li>
<a href='/samples/presets-listing-customization-searcher/customers' target='_blank'>Search Func</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L317-L335' target='_blank'>Source</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L329-L347' target='_blank'>Source</a>
</li>

<li>
Expand Down Expand Up @@ -570,7 +570,7 @@ <h1 class='mb-8'>All Demo Examples</h1>
<li>
<a href='/samples/publish-example/with-publish-products' target='_blank'>Publish</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_admin/publish.go#L57-L73' target='_blank'>Source</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_admin/publish.go#L58-L74' target='_blank'>Source</a>
</li>

<li>
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/basics/filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,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, &#34;draft&#34; and &#34;online&#34;. 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/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>
<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\t{\n\t\t\t\tKey: \"title\",\n\t\t\t\tLabel: \"titleNoChoose\",\n\t\t\t\tItemType: vuetifyx.ItemTypeString,\n\t\t\t\tModifier: vuetifyx.ModifierEquals, // default modifier is contains\n\t\t\t\tSQLCondition: `title = ?`,\n\t\t\t\tDisableChooseModifier: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tKey: \"warpBody\",\n\t\t\t\tLabel: \"warpBody\",\n\t\t\t\tItemType: vuetifyx.ItemTypeString,\n\t\t\t\tModifier: vuetifyx.ModifierEquals,\n\t\t\t\tSQLCondition: `body = ?`,\n\t\t\t\tOptions: options,\n\t\t\t\tWarpInput: func(val string) string {\n\t\t\t\t\treturn val + \"wrap\"\n\t\t\t\t},\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/admin/tree/main/docs/docsrc/examples/examples_presets/filter.go#L3-L67' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/filter.go#L3-L86' target='_blank'>Source on GitHub</a>
</div>
</div>
<h3><a name="qor5-now-supports-7-types-of-filter-option" class="anchor" href="#qor5-now-supports-7-types-of-filter-option" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>QOR5 now supports 7 types of filter option.</h3>
Expand Down
10 changes: 5 additions & 5 deletions docs/docs/basics/listing-customizations.html
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ <h2 id='change-list-columns-and-component-of-field'>Change List Columns and Comp
<div class='demo'>
<a href='/samples/presets-listing-customization-fields/customers' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L68-L173' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L80-L185' target='_blank'>Source on GitHub</a>
</div>
</div>
<p>What we did with above code:</p>
Expand All @@ -257,7 +257,7 @@ <h2 id='filters-panel'>Filters Panel
<div class='demo'>
<a href='/samples/presets-listing-customization-filters/customers' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L175-L226' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L187-L238' target='_blank'>Source on GitHub</a>
</div>
</div>
<p><code>FilterDataFunc</code> of <code>presets.ListingBuilder</code> setup to have the filter menu or not.
Expand Down Expand Up @@ -286,7 +286,7 @@ <h2 id='filter-tabs'>Filter Tabs
<div class='demo'>
<a href='/samples/presets-listing-customization-tabs/customers' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L228-L263' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L240-L275' target='_blank'>Source on GitHub</a>
</div>
</div>
<p><code>Query</code> string name must be from the Filter&#39;s item configuration key field.</p>
Expand All @@ -305,7 +305,7 @@ <h2 id='bulk-actions'>Bulk Actions
<div class='demo'>
<a href='/samples/presets-listing-customization-bulk-actions/customers' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L265-L315' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L277-L327' target='_blank'>Source on GitHub</a>
</div>
</div>
<ul>
Expand All @@ -329,7 +329,7 @@ <h2 id='search-func'>Search Func
<div class='demo'>
<a href='/samples/presets-listing-customization-searcher/customers' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L317-L335' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L329-L347' target='_blank'>Source on GitHub</a>
</div>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/basics/presets-instant-crud.html
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,13 @@ <h1 class='mb-8'>presets, Instant CRUD</h1>
It&#39;s not a scaffolding to generate source code. But provide more abstract and
flexible API to enrich features along the way.</p>

<highlightjs :language='"go"' :code='"package examples_presets\n\nimport (\n\t\"fmt\"\n\t\"net/url\"\n\t\"time\"\n\n\t\"github.com/qor5/admin/v3/media/media_library\"\n\t\"github.com/qor5/admin/v3/presets\"\n\t\"github.com/qor5/admin/v3/presets/actions\"\n\t\"github.com/qor5/admin/v3/presets/gorm2op\"\n\t\"github.com/qor5/web/v3\"\n\t\"github.com/qor5/x/v3/i18n\"\n\tv \"github.com/qor5/x/v3/ui/vuetify\"\n\t\"github.com/qor5/x/v3/ui/vuetifyx\"\n\th \"github.com/theplant/htmlgo\"\n\t\"golang.org/x/text/language\"\n\t\"gorm.io/gorm\"\n)\n\ntype Customer struct {\n\tID int\n\tName string\n\tEmail string\n\tDescription string\n\tCompanyID int\n\tCreatedAt time.Time\n\tUpdatedAt time.Time\n\tApprovedAt *time.Time\n\tTermAgreedAt *time.Time\n\tApprovalComment string\n\tAvatar media_library.MediaBox\n\tCreditCards []*CreditCard `gorm:\"-\"`\n\tNotes []*Note `gorm:\"-\"`\n}\n\ntype Address struct {\n\tID int\n\tProvince string\n\tCity string\n\tDistrict string\n}\n\nfunc PresetsHelloWorld(b *presets.Builder, db *gorm.DB) (\n\tmb *presets.ModelBuilder,\n\tcl *presets.ListingBuilder,\n\tce *presets.EditingBuilder,\n\tdp *presets.DetailingBuilder,\n) {\n\terr := db.AutoMigrate(\n\t\t\u0026Customer{},\n\t\t\u0026Company{},\n\t\t\u0026Address{},\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tb.DataOperator(gorm2op.DataOperator(db))\n\tmb = b.Model(\u0026Customer{})\n\n\treturn\n}\n"'></highlightjs>
<highlightjs :language='"go"' :code='"package examples_presets\n\nimport (\n\t\"fmt\"\n\t\"net/url\"\n\t\"time\"\n\n\t\"github.com/qor5/admin/v3/media/media_library\"\n\t\"github.com/qor5/admin/v3/presets\"\n\t\"github.com/qor5/admin/v3/presets/actions\"\n\t\"github.com/qor5/admin/v3/presets/gorm2op\"\n\t\"github.com/qor5/web/v3\"\n\t\"github.com/qor5/x/v3/i18n\"\n\tv \"github.com/qor5/x/v3/ui/vuetify\"\n\t\"github.com/qor5/x/v3/ui/vuetifyx\"\n\th \"github.com/theplant/htmlgo\"\n\t\"golang.org/x/text/language\"\n\t\"gorm.io/gorm\"\n)\n\ntype Customer struct {\n\tID int\n\tName string\n\tEmail string\n\tDescription string\n\tCompanyID int\n\tCreatedAt time.Time\n\tUpdatedAt time.Time\n\tApprovedAt *time.Time\n\tTermAgreedAt *time.Time\n\tApprovalComment string\n\tAvatar media_library.MediaBox\n\tCreditCards []*CreditCard `gorm:\"-\"`\n\tNotes []*Note `gorm:\"-\"`\n}\n\ntype Address struct {\n\tID int\n\tProvince string\n\tCity string\n\tDistrict string\n}\n\nfunc PresetsHelloWorld(b *presets.Builder, db *gorm.DB) (\n\tmb *presets.ModelBuilder,\n\tcl *presets.ListingBuilder,\n\tce *presets.EditingBuilder,\n\tdp *presets.DetailingBuilder,\n) {\n\terr := db.AutoMigrate(\n\t\t\u0026Customer{},\n\t\t\u0026Company{},\n\t\t\u0026Address{},\n\t)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tb.DataOperator(gorm2op.DataOperator(db))\n\tmb = b.Model(\u0026Customer{})\n\tcl = mb.Listing()\n\tce = mb.Editing()\n\treturn\n}\n"'></highlightjs>

<div>
<div class='demo'>
<a href='/samples/presets-hello-world/customers' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L1-L66' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_presets/listing.go#L1-L67' target='_blank'>Source on GitHub</a>
</div>
</div>
<p>And this <code>*presets.Builder</code> instance is actually also a <code>http.Handler</code>, So that we can mount it
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/basics/publish.html
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ <h2><a name="usage" class="anchor" href="#usage" rel="nofollow" aria-hidden="tru
<div class='demo'>
<a href='/samples/publish-example/with-publish-products' target='_blank'>Check the demo</a>
|
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_admin/publish.go#L57-L73' target='_blank'>Source on GitHub</a>
<a href='https://github.com/qor5/admin/tree/main/docs/docsrc/examples/examples_admin/publish.go#L58-L74' target='_blank'>Source on GitHub</a>
</div>
</div>
<h2><a name="modules" class="anchor" href="#modules" rel="nofollow" aria-hidden="true"><span class="octicon octicon-link"></span></a>Modules</h2>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/search_indexes.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion docs/docsrc/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ then
echo "snippetgo command not found. Installing..."

# Install snippetgo using 'go install'
go install github.com/sunfmin/[email protected].2
go install github.com/sunfmin/[email protected].3

# Check if installation was successful
if command -v snippetgo &> /dev/null
Expand All @@ -28,6 +28,7 @@ snippetDirs=(
)
echo "${snippetDirs[@]}"
rm -rf ./generated/*
mkdir -p ./generated
gi=1
for d in "${snippetDirs[@]}"
do
Expand Down
33 changes: 31 additions & 2 deletions docs/docsrc/examples/examples_admin/page_builder_with_campaign.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package examples_admin

import (
"context"
"fmt"
"net/http"
"strings"

"github.com/qor/oss"
"github.com/qor/oss/filesystem"
"github.com/qor5/admin/v3/pagebuilder"
"github.com/qor5/admin/v3/presets"
"github.com/qor5/admin/v3/presets/gorm2op"
Expand Down Expand Up @@ -57,6 +60,26 @@ func (b *Campaign) GetTitle() string {
return b.Title
}

func (b *Campaign) PublishUrl(db *gorm.DB, ctx context.Context, storage oss.StorageInterface) (s string) {
b.OnlineUrl = fmt.Sprintf("campaigns/%v/index.html", b.ID)
return b.OnlineUrl
}

func (b *Campaign) WrapPublishActions(in publish.PublishActionsFunc) publish.PublishActionsFunc {
return func(db *gorm.DB, ctx context.Context, storage oss.StorageInterface, obj any) (actions []*publish.PublishAction, err error) {
// default actions
if actions, err = in(db, ctx, storage, obj); err != nil {
return
}
actions = append(actions, &publish.PublishAction{
Url: "campaigns/index.html",
Content: "Campaign List",
})

return
}
}

func (p *Campaign) PrimarySlug() string {
return fmt.Sprintf("%v_%v", p.ID, p.Version.Version)
}
Expand All @@ -73,6 +96,11 @@ func (p *Campaign) PrimaryColumnValuesBySlug(slug string) map[string]string {
}
}

func (b *CampaignProduct) PublishUrl(db *gorm.DB, ctx context.Context, storage oss.StorageInterface) (s string) {
b.OnlineUrl = fmt.Sprintf("campaign-products/%v/index.html", b.ID)
return b.OnlineUrl
}

func (b *CampaignProduct) GetTitle() string {
return b.Name
}
Expand Down Expand Up @@ -115,7 +143,8 @@ func PageBuilderExample(b *presets.Builder, db *gorm.DB) http.Handler {
if err != nil {
panic(err)
}
puBuilder := publish.New(db, nil)
storage := filesystem.New("/tmp/publish")
puBuilder := publish.New(db, storage)
if b.GetPermission() == nil {
b.Permission(
perm.New().Policies(
Expand All @@ -132,7 +161,7 @@ func PageBuilderExample(b *presets.Builder, db *gorm.DB) http.Handler {
RenderFunc(func(obj interface{}, input *pagebuilder.RenderInput, ctx *web.EventContext) HTMLComponent {
c := obj.(*MyContent)
return Div().Text(c.Text).Style("height:200px")
})
}).Cover("https://qor5.com/img/qor-logo.png")

ed := header.Model(&MyContent{}).Editing("Text", "Color")
ed.Field("Color").ComponentFunc(func(obj interface{}, field *presets.FieldContext, ctx *web.EventContext) HTMLComponent {
Expand Down
Loading

0 comments on commit 96be6a9

Please sign in to comment.