-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.go
36 lines (26 loc) · 872 Bytes
/
ui.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
package ui
import (
"net/http"
"github.com/dekoch/gouniversal/module/mediadownloader/global"
"github.com/dekoch/gouniversal/module/mediadownloader/typemd"
"github.com/dekoch/gouniversal/module/mediadownloader/ui/pagehome"
"github.com/dekoch/gouniversal/shared/navigation"
"github.com/dekoch/gouniversal/shared/types"
)
func RegisterPage(page *types.Page, nav *navigation.Navigation) {
appPage := new(typemd.Page)
global.Lang.SelectLang(nav.User.Lang, &appPage.Lang)
pagehome.RegisterPage(appPage, nav)
}
func Render(page *types.Page, nav *navigation.Navigation, r *http.Request) {
appPage := new(typemd.Page)
appPage.Content = page.Content
global.Lang.SelectLang(nav.User.Lang, &appPage.Lang)
switch nav.GetNextPage() {
case "Home":
pagehome.Render(appPage, nav, r)
default:
nav.RedirectPath("404", true)
}
page.Content += appPage.Content
}