feat(17-04): FAQ plugin tracer, admin FAQ with sanitized question repeater
- 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
This commit is contained in:
47
plugin.go
Normal file
47
plugin.go
Normal file
@@ -0,0 +1,47 @@
|
||||
// Package faq is the golem15.faq plugin: FAQs (a question and answer list per
|
||||
// slug and locale) edited in the admin, a port of the WinterCMS Golem15.FAQ
|
||||
// plugin.
|
||||
package faq
|
||||
|
||||
import (
|
||||
"git.golem15.com/golem15/sm-faq-plugin/models"
|
||||
"git.golem15.com/golem15/sm-faq-plugin/updates"
|
||||
"git.golem15.com/golem15/summercms/modules/backpack"
|
||||
"git.golem15.com/golem15/summercms/modules/pact"
|
||||
"git.golem15.com/golem15/summercms/modules/party"
|
||||
"github.com/go-gormigrate/gormigrate/v2"
|
||||
)
|
||||
|
||||
var (
|
||||
_ party.Plugin = (*Plugin)(nil)
|
||||
_ pact.HasMigrations = (*Plugin)(nil)
|
||||
_ pact.HasModels = (*Plugin)(nil)
|
||||
)
|
||||
|
||||
// Plugin is the golem15.faq plugin.
|
||||
type Plugin struct {
|
||||
app *backpack.App
|
||||
}
|
||||
|
||||
func (p *Plugin) ID() string { return "golem15.faq" }
|
||||
|
||||
// Requires golem15.translate: every FAQ belongs to a translate Locale.
|
||||
func (p *Plugin) Requires() []string { return []string{"golem15.translate"} }
|
||||
|
||||
func (p *Plugin) Register(app *backpack.App) error {
|
||||
p.app = app
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Plugin) Boot(app *backpack.App) error {
|
||||
p.app = app
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Plugin) Migrations() []*gormigrate.Migration { return updates.All() }
|
||||
|
||||
func (p *Plugin) Models() []any { return models.All() }
|
||||
|
||||
func init() {
|
||||
party.Register(&Plugin{})
|
||||
}
|
||||
Reference in New Issue
Block a user