You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
376 B
24 lines
376 B
package master_ui
|
|
|
|
import (
|
|
"path/filepath"
|
|
"strings"
|
|
)
|
|
|
|
type Breadcrumb struct {
|
|
Name string
|
|
Link string
|
|
}
|
|
|
|
func ToBreadcrumb(fullpath string) (crumbs []Breadcrumb) {
|
|
parts := strings.Split(fullpath, "/")
|
|
|
|
for i := 0; i < len(parts); i++ {
|
|
crumbs = append(crumbs, Breadcrumb{
|
|
Name: parts[i] + "/",
|
|
Link: "/" + filepath.Join(parts[0:i+1]...),
|
|
})
|
|
}
|
|
|
|
return
|
|
}
|