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
This commit is contained in:
51
admin.go
51
admin.go
@@ -5,29 +5,28 @@ import (
|
||||
"io/fs"
|
||||
|
||||
"git.golem15.com/golem15/sm-sitemap-plugin/controllers"
|
||||
"git.golem15.com/golem15/sm-sitemap-plugin/models"
|
||||
"git.golem15.com/golem15/summercms/modules/backpack"
|
||||
"git.golem15.com/golem15/summercms/modules/pact"
|
||||
)
|
||||
|
||||
// adminFS holds the admin YAML file by file: the controllers directory also
|
||||
// holds Go sources.
|
||||
// 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/definitions/config_form.yaml models/definition/fields.yaml models/settings/fields.yaml
|
||||
//go:embed controllers/*/*.yaml controllers/*/_*.htm models/*/*.yaml
|
||||
var adminFS embed.FS
|
||||
|
||||
//go:embed lang
|
||||
var langFS embed.FS
|
||||
|
||||
// AdminFS serves the admin YAML.
|
||||
// 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 menu item type registry at request
|
||||
// time.
|
||||
// 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 {
|
||||
@@ -37,31 +36,21 @@ func (p *Plugin) AdminControllers() []pact.AdminController {
|
||||
})
|
||||
}
|
||||
|
||||
// Settings registers the two PHP settings entries in the CMS category: the
|
||||
// sitemap definition (a link to the singleton definitions controller) and
|
||||
// the sitemap settings form. Both require golem15.sitemap.access_definitions.
|
||||
// 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.plugin.name",
|
||||
Description: "golem15.sitemap::lang.plugin.description",
|
||||
Category: "golem15.sitemap::lang.settings.category",
|
||||
Icon: "network",
|
||||
Permissions: []string{controllers.PermissionAccessDefinitions},
|
||||
Controller: controllers.DefinitionsControllerID,
|
||||
},
|
||||
{
|
||||
Code: "sitemap_settings",
|
||||
Label: "golem15.sitemap::lang.settings.label",
|
||||
Description: "golem15.sitemap::lang.settings.description",
|
||||
Category: "golem15.sitemap::lang.settings.category",
|
||||
Icon: "settings",
|
||||
Permissions: []string{controllers.PermissionAccessDefinitions},
|
||||
Form: "models/settings/fields.yaml",
|
||||
NewModel: func() any { return &models.Settings{} },
|
||||
},
|
||||
}
|
||||
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 (
|
||||
|
||||
Reference in New Issue
Block a user