This repository has been archived by the owner on Jun 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move mux and server main inside each examples group
- Loading branch information
Showing
25 changed files
with
253 additions
and
262 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package examples_admin | ||
|
||
import ( | ||
"net/http" | ||
|
||
"github.com/go-chi/chi/v5/middleware" | ||
"github.com/qor5/docs/v3/docsrc/examples" | ||
"github.com/qor5/docs/v3/docsrc/examples/examples_presets" | ||
"github.com/qor5/docs/v3/docsrc/examples/examples_vuetify" | ||
) | ||
|
||
func Mux(mux *http.ServeMux, prefix string) http.Handler { | ||
examples_vuetify.Mux(mux, prefix) | ||
|
||
im := &examples_vuetify.IndexMux{Mux: http.NewServeMux()} | ||
SamplesHandler(im, prefix) | ||
|
||
mux.Handle("/samples/", | ||
middleware.Logger( | ||
middleware.RequestID( | ||
im.Mux, | ||
), | ||
), | ||
) | ||
|
||
return mux | ||
} | ||
|
||
func SamplesHandler(mux examples.Muxer, prefix string) { | ||
examples_vuetify.SamplesHandler(mux, prefix) | ||
examples_presets.SamplesHandler(mux, prefix) | ||
|
||
examples.AddPresetExample(mux, ListingExample) | ||
examples.AddPresetExample(mux, WorkerExample) | ||
examples.AddPresetExample(mux, ActionWorkerExample) | ||
examples.AddPresetExample(mux, InternationalizationExample) | ||
examples.AddPresetExample(mux, LocalizationExample) | ||
examples.AddPresetExample(mux, PublishExample) | ||
examples.AddPresetExample(mux, SEOExampleBasic) | ||
examples.AddPresetExample(mux, ActivityExample) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package examples_presets | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/qor5/admin/v3/presets" | ||
"github.com/qor5/docs/v3/docsrc/examples" | ||
"gorm.io/gorm" | ||
) | ||
|
||
func SamplesHandler(mux examples.Muxer, prefix string) { | ||
db := examples.ExampleDB() | ||
addExample(mux, db, PresetsHelloWorld) | ||
addExample(mux, db, PresetsListingCustomizationFields) | ||
addExample(mux, db, PresetsListingCustomizationFilters) | ||
addExample(mux, db, PresetsListingCustomizationTabs) | ||
addExample(mux, db, PresetsListingCustomizationBulkActions) | ||
addExample(mux, db, PresetsEditingCustomizationDescription) | ||
addExample(mux, db, PresetsEditingCustomizationFileType) | ||
addExample(mux, db, PresetsEditingCustomizationValidation) | ||
addExample(mux, db, PresetsDetailPageTopNotes) | ||
addExample(mux, db, PresetsDetailPageDetails) | ||
addExample(mux, db, PresetsDetailPageCards) | ||
addExample(mux, db, PresetsPermissions) | ||
addExample(mux, db, PresetsModelBuilderExtensions) | ||
addExample(mux, db, PresetsBasicFilter) | ||
addExample(mux, db, PresetsNotificationCenterSample) | ||
addExample(mux, db, PresetsLinkageSelectFilterItem) | ||
addExample(mux, db, PresetsBrandTitle) | ||
addExample(mux, db, PresetsBrandFunc) | ||
addExample(mux, db, PresetsProfile) | ||
addExample(mux, db, PresetsOrderMenu) | ||
addExample(mux, db, PresetsGroupMenu) | ||
addExample(mux, db, PresetsConfirmDialog) | ||
addExample(mux, db, PresetsEditingCustomizationTabs) | ||
addExample(mux, db, PresetsListingCustomizationSearcher) | ||
addExample(mux, db, PresetsDetailInlineEditDetails) | ||
addExample(mux, db, PresetsDetailInlineEditInspectTables) | ||
return | ||
} | ||
|
||
type exampleFunc func(b *presets.Builder, db *gorm.DB) ( | ||
cust *presets.ModelBuilder, | ||
cl *presets.ListingBuilder, | ||
ce *presets.EditingBuilder, | ||
dp *presets.DetailingBuilder, | ||
) | ||
|
||
func addExample(mux examples.Muxer, db *gorm.DB, f exampleFunc) { | ||
path := examples.URLPathByFunc(f) | ||
p := presets.New().AssetFunc(examples.AddGA).URIPrefix(path) | ||
f(p, db) | ||
fmt.Println("Example mounting at: ", path) | ||
mux.Handle( | ||
path, | ||
p, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.