/
home.go
39 lines (30 loc) · 1.01 KB
/
home.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
package home
import (
"github.com/qor/application"
// "github.com/dfang/qor-demo/config/bindatafas"
"github.com/dfang/qor-demo/utils/funcmapmaker"
"github.com/qor/render"
)
// New new home app
func New(config *Config) *App {
return &App{Config: config}
}
func NewWithDefault() *App {
return &App{Config: &Config{}}
}
// App home app
type App struct {
Config *Config
}
// Config home config struct
type Config struct {
}
// ConfigureApplication configure application
func (App) ConfigureApplication(application *application.Application) {
controller := &Controller{View: render.New(&render.Config{AssetFileSystem: application.AssetFS.NameSpace("home")}, "app/home/views")}
// controller := &Controller{ View: render.New( &render.Config{ AssetFileSystem: bindatafs.AssetFS.NameSpace("home"), }),
funcmapmaker.AddFuncMapMaker(controller.View)
application.Router.Get("/", controller.RedirectToAdmin)
// application.Router.Get("/", controller.Index)
application.Router.Get("/switch_locale", controller.SwitchLocale)
}