소스 검색

Update config.go (#1)

Make qor5 command usable with template website
Tua Nguyen 1 년 전
부모
커밋
8c5373a9c3
1개의 변경된 파일9개의 추가작업 그리고 8개의 파일을 삭제
  1. 9 8
      cmd/qor5/website-template/admin/config.go

+ 9 - 8
cmd/qor5/website-template/admin/config.go

@@ -87,24 +87,25 @@ func newPB() Config {
 
 	utils.Configure(b)
 	media_view.Configure(b, db)
+	ab := activity.New(b, db).SetCreatorContextKey(login.UserKey)
+	l10nBuilder := l10n.New()
+	
 	pageBuilder := example.ConfigPageBuilder(db, "/admin/page_builder", ``, b.I18n())
-	pm := pageBuilder.Configure(b, db)
+	pm := pageBuilder.Configure(b, db, l10nBuilder, ab)
 	tm := pageBuilder.ConfigTemplate(b, db)
 	cm := pageBuilder.ConfigCategory(b, db)
-
-	ab := activity.New(b, db).SetCreatorContextKey(login.UserKey)
+	
 	ab.RegisterModels(pm, tm, cm)
 
 	storage := filesystem.New(PublishDir)
 	publisher := publish.New(db, storage).WithPageBuilder(pageBuilder)
 	publish_view.Configure(b, db, ab, publisher, pm)
 
-	l10nBuilder := l10n.New()
 	l10nBuilder.
-		RegisterLocales(countries.International, "International", "International").
-		RegisterLocales(countries.China, "China", "China").
-		GetSupportLocalesFromRequestFunc(func(R *http.Request) []countries.CountryCode {
-			return l10nBuilder.GetSupportLocales()[:]
+		RegisterLocales(countries.International.String(), "International", "International").
+		RegisterLocales(countries.China.String(), "China", "China").
+		GetSupportLocaleCodesFromRequestFunc(func(R *http.Request) []string {
+			return l10nBuilder.GetSupportLocaleCodes()[:]
 		})
 	l10n_view.Configure(b, db, l10nBuilder, ab, pm)