formulars.go 562 B

12345678910111213141516171819202122232425262728293031
  1. package controllers
  2. import (
  3. renderModels "devel.mephi.ru/dyokunev/cps-models/for_render"
  4. asuModels "devel.mephi.ru/dyokunev/go-asu-models"
  5. "github.com/revel/revel"
  6. )
  7. type Formulars struct {
  8. Controller
  9. }
  10. func (c Formulars) Index(formular asuModels.Formular, ppsOnly bool) revel.Result {
  11. if r := c.Init(); r != nil {
  12. return r
  13. }
  14. scope := c.FormularSQL
  15. if ppsOnly {
  16. scope = scope.PPSOnly()
  17. }
  18. formulars, err := scope.Select(formular)
  19. if r := c.ConsiderErr(err); r != nil {
  20. return r
  21. }
  22. return c.Render(renderModels.NewFormulars(formulars))
  23. }