-
Notifications
You must be signed in to change notification settings - Fork 0
/
views.go
77 lines (65 loc) · 1.7 KB
/
views.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main
import (
"embed"
"fmt"
"github.com/gofiber/fiber/v2"
)
//go:embed views
var ViewsFS embed.FS
func (a *App) mainView(c *fiber.Ctx) error {
c.Bind(fiber.Map{
"Header": true,
"Content": IndexPageContent,
})
return c.Render("index", fiber.Map{})
}
func (a *App) programOverviewView(c *fiber.Ctx) error {
c.Bind(fiber.Map{
"Title": "Programme Overview",
})
return c.Render("programm-overview", fiber.Map{})
}
func (a *App) keynoteSpeakersView(c *fiber.Ctx) error {
c.Bind(fiber.Map{
"Title": "Keynote Speakers",
"Content": "Key speakers to be determined later.",
})
return c.Render("basic", fiber.Map{})
}
func (a *App) requirementsView(c *fiber.Ctx) error {
c.Bind(fiber.Map{
"Title": "Requirements",
"Content": "Article template will be posted later.",
})
return c.Render("basic", fiber.Map{})
}
func (a *App) generalInfoView(c *fiber.Ctx) error {
c.Bind(fiber.Map{
"Title": "Genral Information",
})
return c.Render("general-information", fiber.Map{})
}
func (a *App) registrationView(c *fiber.Ctx) error {
c.Bind(fiber.Map{
"Title": "Register",
})
return c.Render("registration", fiber.Map{})
}
func (a *App) adminView(c *fiber.Ctx) error {
var participants []Participant
if err := a.db.Find(&participants).Error; err != nil {
a.log.Error(err)
c.Bind(fiber.Map{"Errors": map[string]string{"getParticipants": "Can't fetch participants"}})
} else {
c.Bind(fiber.Map{"Users": participants})
}
return c.Render("admin", fiber.Map{})
}
func (a *App) notFoundView(c *fiber.Ctx) error {
c.Bind(fiber.Map{
"Title": "Page Not Found",
"Content": fmt.Sprintf("Not found - %s", c.OriginalURL()),
})
c.Status(fiber.StatusNotFound)
return c.Render("basic", fiber.Map{})
}