component.DummyMenuItem: Force early replacement

This commit is contained in:
Tom Wiesing 2023-02-03 15:12:52 +01:00
parent 2466238388
commit a7309d5268
No known key found for this signature in database
7 changed files with 75 additions and 27 deletions

View file

@ -34,7 +34,12 @@ type GrantWithURL struct {
URL template.URL
}
var (
totpActionItem = component.DummyMenuItem()
)
func (panel *UserPanel) routeUser(ctx context.Context) http.Handler {
tpl := userTemplate.Prepare(
panel.Dependencies.Templating,
templating.Crumbs(
@ -42,7 +47,7 @@ func (panel *UserPanel) routeUser(ctx context.Context) http.Handler {
),
templating.Actions(
component.MenuItem{Title: "Change Password", Path: "/user/password/"},
component.DummyMenuItem,
totpActionItem,
component.MenuItem{Title: "SSH Keys", Path: "/user/ssh/"},
),
)
@ -68,7 +73,7 @@ func (panel *UserPanel) routeUser(ctx context.Context) http.Handler {
}
}
funcs = []templating.FlagFunc{
templating.ReplaceAction(1, totpAction),
templating.ReplaceAction(totpActionItem, totpAction),
templating.Title(uc.AuthUser.User.User),
}