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/deadlines.go
Normal file
38
controllers/deadlines.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 = deadlinesAdmin{}
|
||||
_ pact.AdminRecordSource = deadlinesAdmin{}
|
||||
_ pact.AdminPermissioned = deadlinesAdmin{}
|
||||
)
|
||||
|
||||
// deadlinesAdmin is the admin controller for deadlines (terminarz).
|
||||
type deadlinesAdmin struct{ temporalHooks }
|
||||
|
||||
func (deadlinesAdmin) ID() string { return "jz.bm.deadlines" }
|
||||
func (deadlinesAdmin) ModelName() string { return "Deadline" }
|
||||
func (deadlinesAdmin) ConfigDir() string { return "controllers/deadlines" }
|
||||
|
||||
// NewRecord returns the model the generic admin handlers query and fill.
|
||||
func (deadlinesAdmin) NewRecord() any { return &models.Deadline{} }
|
||||
|
||||
// RequiredPermissions is checked before any schema or record is served.
|
||||
func (deadlinesAdmin) RequiredPermissions() []string {
|
||||
return []string{PermSchedule}
|
||||
}
|
||||
|
||||
// AdminFieldRelations binds the course picker.
|
||||
func (deadlinesAdmin) AdminFieldRelations() []cabana.FieldRelationContract {
|
||||
return []cabana.FieldRelationContract{courseRelation("course_id")}
|
||||
}
|
||||
|
||||
// DeadlinesController returns the jz.bm.deadlines admin controller.
|
||||
func DeadlinesController() pact.AdminController { return deadlinesAdmin{} }
|
||||
Reference in New Issue
Block a user