- golem15.faq plugin (Requires golem15.translate), table golem15_faq_faqs with the PHP columns - FAQ model with jsonable content and the translate Locale relation - admin controller golem15.faq.faqs: name, slug, locale, active switch, richeditor description, question repeater - navigation FAQ (order 500), permission golem15.faq.faqs, en and pl phrasebooks - TestFaqAdminSmoke: answers stored sanitized with a notice under content.1.answer
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package faq
|
|
|
|
import (
|
|
"embed"
|
|
"io/fs"
|
|
|
|
"git.golem15.com/golem15/sm-faq-plugin/controllers"
|
|
"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.
|
|
//
|
|
//go:embed controllers/faqs/config_form.yaml controllers/faqs/config_list.yaml models/faq/fields.yaml models/faq/columns.yaml
|
|
var adminFS embed.FS
|
|
|
|
//go:embed lang
|
|
var langFS embed.FS
|
|
|
|
// AdminFS serves the admin YAML.
|
|
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 at request time.
|
|
func (p *Plugin) AdminControllers() []pact.AdminController {
|
|
return controllers.AdminControllers(func() *backpack.App {
|
|
if p == nil {
|
|
return nil
|
|
}
|
|
return p.app
|
|
})
|
|
}
|
|
|
|
var (
|
|
_ pact.AdminAssets = (*Plugin)(nil)
|
|
_ pact.HasAdminControllers = (*Plugin)(nil)
|
|
_ pact.HasLang = (*Plugin)(nil)
|
|
)
|