-
Notifications
You must be signed in to change notification settings - Fork 9
/
workshops.go
37 lines (31 loc) · 941 Bytes
/
workshops.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package actions
import (
"github.com/gobuffalo/buffalo"
"github.com/gopheracademy/gcon/models"
)
type WorkshopsResource struct {
buffalo.Resource
}
// List default implementation.
func (v *WorkshopsResource) List(c buffalo.Context) error {
workshops := models.GetWorkshops()
c.Set("workshops", workshops)
publicR.HTMLLayout = "main.html"
return c.Render(200, publicR.HTML("workshoplist.html"))
}
// Show default implementation. note that we're listening
// at /speakers but actually getting presentations. This is important if your
// don't want to be confused at some future point.
func (v *WorkshopsResource) Show(c buffalo.Context) error {
id, err := c.ParamInt("workshop_id")
if err != nil {
return c.Error(400, err)
}
s, err := models.GetFullWorkshop(id)
if err != nil {
return c.Error(404, err)
}
c.Set("w", s)
publicR.HTMLLayout = "main.html"
return c.Render(200, publicR.HTML("partials/_workshop.html"))
}