feat: add admin screens, permissions and navigation
Seven admin controllers in a "Studia BM" navigation group, guarded by jz.bm.access_courses, jz.bm.access_schedule and jz.bm.access_materials, with Polish and English labels. Date and time fields are checked by the models before a save and answered as 422 on the field.
This commit is contained in:
38
controllers/readings.go
Normal file
38
controllers/readings.go
Normal file
@@ -0,0 +1,38 @@
|
||||
// Code generated by summer make. DO NOT EDIT.
|
||||
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"git.golem15.com/golem15/summercms/modules/cabana"
|
||||
"git.golem15.com/golem15/summercms/modules/pact"
|
||||
"git.golem15.com/jakub/sm-bm-plugin/models"
|
||||
)
|
||||
|
||||
var (
|
||||
_ pact.AdminController = readingsAdmin{}
|
||||
_ pact.AdminRecordSource = readingsAdmin{}
|
||||
_ pact.AdminPermissioned = readingsAdmin{}
|
||||
)
|
||||
|
||||
// readingsAdmin is the admin controller for readings (lektury).
|
||||
type readingsAdmin struct{}
|
||||
|
||||
func (readingsAdmin) ID() string { return "jz.bm.readings" }
|
||||
func (readingsAdmin) ModelName() string { return "Reading" }
|
||||
func (readingsAdmin) ConfigDir() string { return "controllers/readings" }
|
||||
|
||||
// NewRecord returns the model the generic admin handlers query and fill.
|
||||
func (readingsAdmin) NewRecord() any { return &models.Reading{} }
|
||||
|
||||
// RequiredPermissions is checked before any schema or record is served.
|
||||
func (readingsAdmin) RequiredPermissions() []string {
|
||||
return []string{PermCourses}
|
||||
}
|
||||
|
||||
// AdminFieldRelations binds the course picker.
|
||||
func (readingsAdmin) AdminFieldRelations() []cabana.FieldRelationContract {
|
||||
return []cabana.FieldRelationContract{courseRelation("course_id")}
|
||||
}
|
||||
|
||||
// ReadingsController returns the jz.bm.readings admin controller.
|
||||
func ReadingsController() pact.AdminController { return readingsAdmin{} }
|
||||
Reference in New Issue
Block a user