Files
sm-sitemap-plugin/admin.go
Jakub Zych 3ba70bb69f feat: sitemap settings singleton with content types and additional addresses
- one settings tile opening the golem15.sitemap.settings singleton
- Files tab (site address, file size, S1 files partial), Additional
  addresses repeater, Content types tab built from signpost at boot
- golem15_sitemap_types; a type switched off leaves the files (reason type)
- a save validates (errors.*) and dispatches a rebuild after commit
2026-11-04 11:06:29 +01:00

62 lines
1.9 KiB
Go

package sitemap
import (
"embed"
"io/fs"
"git.golem15.com/golem15/sm-sitemap-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
//go:embed lang
var langFS embed.FS
// AdminFS serves the admin YAML and partials.
func (p *Plugin) AdminFS() fs.FS { return adminFS }
// LangFS is the embedded English and Polish phrasebooks.
func (p *Plugin) LangFS() fs.FS { return langFS }
// AdminControllers hands the controllers a lazy accessor of the booted app,
// so they read the database and the content type registry 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 one sitemap settings tile (UI-SPEC C26): a link to
// the settings singleton controller in the CMS category, behind
// golem15.sitemap.access_definitions. It replaces the Phase 17 definitions
// and settings tiles (D-32).
func (p *Plugin) Settings() []pact.SettingsItem {
return []pact.SettingsItem{{
Code: "sitemap",
Label: "golem15.sitemap::lang.settings.label",
Description: "golem15.sitemap::lang.settings.description",
Category: "golem15.sitemap::lang.settings.category",
Icon: "network",
Keywords: []string{"sitemap", "sitemap.xml", "lastmod", "hreflang"},
Permissions: []string{controllers.PermissionAccessDefinitions},
Controller: controllers.SettingsControllerID,
}}
}
var (
_ pact.AdminAssets = (*Plugin)(nil)
_ pact.HasAdminControllers = (*Plugin)(nil)
_ pact.HasSettings = (*Plugin)(nil)
_ pact.HasLang = (*Plugin)(nil)
)