Hide caldav/carrdav in nav unless present
This commit is contained in:
parent
793f261b62
commit
8de661b3bb
2 changed files with 15 additions and 0 deletions
11
renderer.go
11
renderer.go
|
@ -26,6 +26,8 @@ type GlobalRenderData struct {
|
||||||
|
|
||||||
Title string
|
Title string
|
||||||
|
|
||||||
|
HavePlugin func(name string) bool
|
||||||
|
|
||||||
// additional plugin-specific data
|
// additional plugin-specific data
|
||||||
Extra map[string]interface{}
|
Extra map[string]interface{}
|
||||||
}
|
}
|
||||||
|
@ -74,6 +76,15 @@ func NewBaseRenderData(ctx *Context) *BaseRenderData {
|
||||||
Path: strings.Split(ctx.Request().URL.Path, "/")[1:],
|
Path: strings.Split(ctx.Request().URL.Path, "/")[1:],
|
||||||
Title: "Webmail",
|
Title: "Webmail",
|
||||||
URL: ctx.Request().URL,
|
URL: ctx.Request().URL,
|
||||||
|
|
||||||
|
HavePlugin: func(name string) bool {
|
||||||
|
for _, plugin := range ctx.Server.plugins {
|
||||||
|
if plugin.Name() == name {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Session != nil {
|
if ctx.Session != nil {
|
||||||
|
|
|
@ -6,18 +6,22 @@
|
||||||
class="active"
|
class="active"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
>Email</a>
|
>Email</a>
|
||||||
|
{{ if call .GlobalData.HavePlugin "caldav" }}
|
||||||
<a
|
<a
|
||||||
href="/calendar"
|
href="/calendar"
|
||||||
{{ if eq $page "calendar" }}
|
{{ if eq $page "calendar" }}
|
||||||
class="active"
|
class="active"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
>Calendar</a>
|
>Calendar</a>
|
||||||
|
{{ end }}
|
||||||
|
{{ if call .GlobalData.HavePlugin "carddav" }}
|
||||||
<a
|
<a
|
||||||
href="/contacts"
|
href="/contacts"
|
||||||
{{ if eq $page "contacts" }}
|
{{ if eq $page "contacts" }}
|
||||||
class="active"
|
class="active"
|
||||||
{{ end }}
|
{{ end }}
|
||||||
>Contacts</a>
|
>Contacts</a>
|
||||||
|
{{ end }}
|
||||||
<div>
|
<div>
|
||||||
<span>{{ .GlobalData.Username }}</span>
|
<span>{{ .GlobalData.Username }}</span>
|
||||||
<a href="/settings">Settings</a>
|
<a href="/settings">Settings</a>
|
||||||
|
|
Loading…
Reference in a new issue