feat(15-02): add Categories, Tags, and journal settings admin

Register the remaining YAML admin screens and the settings singleton
so a host can boot Posts, Categories, Tags, and Code journal. Posts
update and delete refuse other authors without access_other_posts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Jakub Zych
2026-10-06 18:42:29 +02:00
parent dea0934950
commit afd0a2cafc
17 changed files with 388 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import (
"io/fs"
"git.golem15.com/golem15/sm-journal-plugin/controllers"
"git.golem15.com/golem15/sm-journal-plugin/models"
"git.golem15.com/golem15/summercms/modules/backpack"
"git.golem15.com/golem15/summercms/modules/pact"
)
@@ -13,6 +14,9 @@ import (
// directory also holds Go sources that are not admin assets.
//
//go:embed controllers/posts/config_list.yaml controllers/posts/config_form.yaml controllers/posts/config_filter.yaml models/post/fields.yaml models/post/columns.yaml
//go:embed controllers/categories/config_list.yaml controllers/categories/config_form.yaml models/category/fields.yaml models/category/columns.yaml
//go:embed controllers/tags/config_list.yaml controllers/tags/config_form.yaml models/tag/fields.yaml models/tag/columns.yaml
//go:embed models/settings/fields.yaml
//go:embed assets/images/journal-icon.svg
var adminFS embed.FS
@@ -29,9 +33,23 @@ func (p *Plugin) AdminControllers() []pact.AdminController {
})
}
func (p *Plugin) Settings() []pact.SettingsItem {
return []pact.SettingsItem{{
Code: "journal",
Label: "golem15.journal::lang.journal.menu_label",
Description: "golem15.journal::lang.journal.settings_description",
Category: "golem15.journal::lang.journal.menu_label",
Icon: "icon-pencil",
Permissions: []string{"golem15.journal.manage_settings"},
Form: "models/settings/fields.yaml",
NewModel: func() any { return &models.Settings{} },
}}
}
var (
_ pact.AdminAssets = (*Plugin)(nil)
_ pact.HasAdminControllers = (*Plugin)(nil)
_ pact.HasPermissions = (*Plugin)(nil)
_ pact.HasNavigation = (*Plugin)(nil)
_ pact.HasSettings = (*Plugin)(nil)
)