Initial commit (code only without large binaries)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
// Copyright 2021 Liuxiangchao iwind.liu@gmail.com. All rights reserved.
|
||||
|
||||
package settingutils
|
||||
|
||||
import (
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/langs/codes"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type Helper struct {
|
||||
helpers.LangHelper
|
||||
}
|
||||
|
||||
func (this *Helper) BeforeAction(actionPtr actions.ActionWrapper) (goNext bool) {
|
||||
var action = actionPtr.Object()
|
||||
secondMenuItem := action.Data.GetString("secondMenuItem")
|
||||
action.Data["leftMenuItems"] = this.createSettingMenu(secondMenuItem, actionPtr)
|
||||
return true
|
||||
}
|
||||
|
||||
func (this *Helper) createSettingMenu(selectedItem string, actionPtr actions.ActionWrapper) (items []maps.Map) {
|
||||
return []maps.Map{
|
||||
{
|
||||
"name": this.Lang(actionPtr, codes.NS_SettingUser),
|
||||
"url": "/ns/settings/user",
|
||||
"isActive": selectedItem == "user",
|
||||
},
|
||||
{
|
||||
"name": this.Lang(actionPtr, codes.NS_SettingAccessLogs),
|
||||
"url": "/ns/settings/accesslogs",
|
||||
"isActive": selectedItem == "accessLog",
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user