feat: URL rules and the settings singleton
This commit is contained in:
53
admin.go
Normal file
53
admin.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package seo
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"io/fs"
|
||||
|
||||
"git.golem15.com/golem15/sm-seo-plugin/controllers"
|
||||
"git.golem15.com/golem15/summercms/modules/backpack"
|
||||
"git.golem15.com/golem15/summercms/modules/pact"
|
||||
)
|
||||
|
||||
// adminFS holds the admin YAML and partial templates by pattern (the
|
||||
// controllers directory also holds Go sources), so a new screen or partial
|
||||
// needs no edit here.
|
||||
//
|
||||
//go:embed controllers/*/*.yaml controllers/*/_*.htm models/*/*.yaml
|
||||
var adminFS embed.FS
|
||||
|
||||
// AdminFS serves the admin YAML and partials.
|
||||
func (p *Plugin) AdminFS() fs.FS { return adminFS }
|
||||
|
||||
// AdminControllers hands the controllers a lazy accessor of the booted
|
||||
// app, so they read the database at request time.
|
||||
func (p *Plugin) AdminControllers() []pact.AdminController {
|
||||
return controllers.AdminControllers(func() *backpack.App {
|
||||
if p == nil {
|
||||
return nil
|
||||
}
|
||||
return p.app
|
||||
})
|
||||
}
|
||||
|
||||
// Settings registers the SEO settings tile (D-104): a link to the
|
||||
// settings singleton controller, behind golem15.seo.manage.
|
||||
func (p *Plugin) Settings() []pact.SettingsItem {
|
||||
return []pact.SettingsItem{{
|
||||
Code: "seo_settings",
|
||||
Label: "golem15.seo::lang.settings.label",
|
||||
Description: "golem15.seo::lang.settings.description",
|
||||
Category: "golem15.seo::lang.settings.category",
|
||||
Icon: "search",
|
||||
Order: 100,
|
||||
Keywords: []string{"seo", "meta", "canonical", "robots", "verification"},
|
||||
Permissions: []string{controllers.PermissionManage},
|
||||
Controller: controllers.SettingsControllerID,
|
||||
}}
|
||||
}
|
||||
|
||||
var (
|
||||
_ pact.AdminAssets = (*Plugin)(nil)
|
||||
_ pact.HasAdminControllers = (*Plugin)(nil)
|
||||
_ pact.HasSettings = (*Plugin)(nil)
|
||||
)
|
||||
Reference in New Issue
Block a user