|
@@ -1,6 +1,7 @@
|
|
package modules
|
|
package modules
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
+ "html"
|
|
"html/template"
|
|
"html/template"
|
|
"net/http"
|
|
"net/http"
|
|
"reflect"
|
|
"reflect"
|
|
@@ -148,6 +149,8 @@ func (this *Modules) getSidebarModuleSubMenu(wrap *wrapper.Wrapper, mod *MInfo)
|
|
href := "/cp/" + mod.Mount + "/" + item.Mount + "/"
|
|
href := "/cp/" + mod.Mount + "/" + item.Mount + "/"
|
|
if mod.Mount == "index" && item.Mount == "default" {
|
|
if mod.Mount == "index" && item.Mount == "default" {
|
|
href = "/cp/"
|
|
href = "/cp/"
|
|
|
|
+ } else if item.Mount == "default" {
|
|
|
|
+ href = "/cp/" + mod.Mount + "/"
|
|
}
|
|
}
|
|
html += `<li class="nav-item` + class + `"><a class="nav-link" href="` + href + `">` + icon + item.Name + `</a></li>`
|
|
html += `<li class="nav-item` + class + `"><a class="nav-link" href="` + href + `">` + icon + item.Name + `</a></li>`
|
|
}
|
|
}
|
|
@@ -208,6 +211,22 @@ func (this *Modules) getSidebarModules(wrap *wrapper.Wrapper) string {
|
|
return html_def + html_sys
|
|
return html_def + html_sys
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func (this *Modules) getBreadCrumbs(wrap *wrapper.Wrapper, data *[]consts.BreadCrumb) string {
|
|
|
|
+ res := `<nav aria-label="breadcrumb">`
|
|
|
|
+ res += `<ol class="breadcrumb">`
|
|
|
|
+ res += `<li class="breadcrumb-item"><a href="/cp/` + this.mods[wrap.CurrModule].Info.Mount + `/">` + html.EscapeString(this.mods[wrap.CurrModule].Info.Name) + `</a></li>`
|
|
|
|
+ for _, item := range *data {
|
|
|
|
+ if item.Link == "" {
|
|
|
|
+ res += `<li class="breadcrumb-item active" aria-current="page">` + html.EscapeString(item.Name) + `</li>`
|
|
|
|
+ } else {
|
|
|
|
+ res += `<li class="breadcrumb-item"><a href="` + item.Link + `">` + html.EscapeString(item.Name) + `</a></li>`
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ res += `</ol>`
|
|
|
|
+ res += `</nav>`
|
|
|
|
+ return res
|
|
|
|
+}
|
|
|
|
+
|
|
func New() *Modules {
|
|
func New() *Modules {
|
|
m := Modules{
|
|
m := Modules{
|
|
mods: map[string]*Module{},
|
|
mods: map[string]*Module{},
|
|
@@ -276,6 +295,9 @@ func (this *Modules) XXXBackEnd(wrap *wrapper.Wrapper) bool {
|
|
mod, cm := this.getCurrentModule(wrap, true)
|
|
mod, cm := this.getCurrentModule(wrap, true)
|
|
if mod != nil {
|
|
if mod != nil {
|
|
wrap.CurrModule = cm
|
|
wrap.CurrModule = cm
|
|
|
|
+ if len(wrap.UrlArgs) >= 2 && wrap.UrlArgs[1] != "" {
|
|
|
|
+ wrap.CurrSubModule = wrap.UrlArgs[1]
|
|
|
|
+ }
|
|
if mod.Back != nil {
|
|
if mod.Back != nil {
|
|
sidebar_left, content, sidebar_right := mod.Back(wrap)
|
|
sidebar_left, content, sidebar_right := mod.Back(wrap)
|
|
|
|
|