forked from uadmin/uadmin
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhome_handler.go
More file actions
41 lines (34 loc) · 842 Bytes
/
home_handler.go
File metadata and controls
41 lines (34 loc) · 842 Bytes
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
package uadmin
import (
"net/http"
)
// homeHandler !
func homeHandler(w http.ResponseWriter, r *http.Request, session *Session) {
type Context struct {
User string
Demo bool
Menu []DashboardMenu
SiteName string
Language Language
RootURL string
Logo string
FavIcon string
}
c := Context{}
c.RootURL = RootURL
c.Language = getLanguage(r)
c.SiteName = SiteName
c.User = session.User.Username
c.Logo = Logo
c.FavIcon = FavIcon
if DefaultModelLoad != nil {
modelName := getModelName(DefaultModelLoad)
http.Redirect(w, r, c.RootURL+"/"+modelName, http.StatusSeeOther)
return
}
c.Menu = session.User.GetDashboardMenu()
for i := range c.Menu {
c.Menu[i].MenuName = Translate(c.Menu[i].MenuName, c.Language.Code, true)
}
RenderHTML(w, r, "./templates/uadmin/"+Theme+"/home.html", c)
}