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.
39 lines
1.4 KiB
Go
39 lines
1.4 KiB
Go
// Code generated by summer make. DO NOT EDIT.
|
|
|
|
package controllers
|
|
|
|
import (
|
|
"git.golem15.com/golem15/summercms/modules/pact"
|
|
"git.golem15.com/jakub/sm-bm-plugin/models"
|
|
)
|
|
|
|
var (
|
|
_ pact.AdminController = coursesAdmin{}
|
|
_ pact.AdminRecordSource = coursesAdmin{}
|
|
_ pact.AdminPermissioned = coursesAdmin{}
|
|
)
|
|
|
|
// coursesAdmin is the admin controller for courses (przedmioty).
|
|
type coursesAdmin struct{}
|
|
|
|
func (coursesAdmin) ID() string { return "jz.bm.courses" }
|
|
func (coursesAdmin) ModelName() string { return "Course" }
|
|
func (coursesAdmin) ConfigDir() string { return "controllers/courses" }
|
|
|
|
// NewRecord returns the model the generic admin handlers query and fill.
|
|
func (coursesAdmin) NewRecord() any { return &models.Course{} }
|
|
|
|
// RequiredPermissions is checked before any schema or record is served.
|
|
func (coursesAdmin) RequiredPermissions() []string {
|
|
return []string{PermCourses}
|
|
}
|
|
|
|
// TODO: requires SummerCMS change. The course form should embed relation
|
|
// managers for its readings and class sessions, but cabana relation managers
|
|
// only link and unlink belongsToMany rows through a pivot; hasMany children
|
|
// cannot be listed or edited from the parent form. Readings and class
|
|
// sessions have their own screens, filtered by course.
|
|
|
|
// CoursesController returns the jz.bm.courses admin controller.
|
|
func CoursesController() pact.AdminController { return coursesAdmin{} }
|