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.
48 lines
1.6 KiB
Go
48 lines
1.6 KiB
Go
// 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 = classSessionsAdmin{}
|
|
_ pact.AdminRecordSource = classSessionsAdmin{}
|
|
_ pact.AdminPermissioned = classSessionsAdmin{}
|
|
)
|
|
|
|
// classSessionsAdmin is the admin controller for class sessions (zajęcia).
|
|
type classSessionsAdmin struct{ temporalHooks }
|
|
|
|
func (classSessionsAdmin) ID() string { return "jz.bm.class_sessions" }
|
|
func (classSessionsAdmin) ModelName() string { return "ClassSession" }
|
|
func (classSessionsAdmin) ConfigDir() string { return "controllers/class_sessions" }
|
|
|
|
// NewRecord returns the model the generic admin handlers query and fill.
|
|
func (classSessionsAdmin) NewRecord() any { return &models.ClassSession{} }
|
|
|
|
// RequiredPermissions is checked before any schema or record is served.
|
|
func (classSessionsAdmin) RequiredPermissions() []string {
|
|
return []string{PermSchedule}
|
|
}
|
|
|
|
// AdminFieldRelations binds the course and meeting pickers.
|
|
func (classSessionsAdmin) AdminFieldRelations() []cabana.FieldRelationContract {
|
|
return []cabana.FieldRelationContract{
|
|
courseRelation("course_id"),
|
|
{
|
|
Field: "meeting",
|
|
Kind: "belongsTo",
|
|
NewRelated: func() any { return &models.Meeting{} },
|
|
ForeignKey: "meeting_id",
|
|
LabelColumn: "number",
|
|
},
|
|
}
|
|
}
|
|
|
|
// ClassSessionsController returns the jz.bm.class_sessions admin controller.
|
|
func ClassSessionsController() pact.AdminController { return classSessionsAdmin{} }
|