Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
ac80f6ed
Commit
ac80f6ed
authored
Apr 12, 2016
by
Matt Holt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #744 from tboerger/feature/breadcrumb
browse: Dropped LinkedPath and updated browse template
parents
36a3e204
ef951738
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
33 deletions
+4
-33
caddy/setup/browse.go
caddy/setup/browse.go
+4
-5
middleware/browse/browse.go
middleware/browse/browse.go
+0
-28
No files found.
caddy/setup/browse.go
View file @
ac80f6ed
...
...
@@ -264,7 +264,6 @@ footer {
</g>
</g>
<!-- File -->
<linearGradient id="a">
<stop stop-color="#cbcbcb" offset="0"/>
...
...
@@ -300,14 +299,14 @@ footer {
</defs>
</svg>
<header>
<h1>{{.LinkedPath}}</h1>
<h1>
{{range $url, $name := .BreadcrumbMap}}<a href="{{$url}}">{{$name}}</a>{{if ne $url "/"}}/{{end}}{{end}}
</h1>
</header>
<main>
<div class="meta">
<div class="content">
<div class="content">
<span class="meta-item"><b>{{.NumDirs}}</b> director{{if eq 1 .NumDirs}}y{{else}}ies{{end}}</span>
<span class="meta-item"><b>{{.NumFiles}}</b> file{{if ne 1 .NumFiles}}s{{end}}</span>
</div>
...
...
middleware/browse/browse.go
View file @
ac80f6ed
...
...
@@ -6,7 +6,6 @@ import (
"bytes"
"encoding/json"
"errors"
"fmt"
"net/http"
"net/url"
"os"
...
...
@@ -69,33 +68,6 @@ type Listing struct {
middleware
.
Context
}
// LinkedPath returns l.Path where every element is a clickable
// link to the path up to that point so far.
func
(
l
Listing
)
LinkedPath
()
string
{
if
len
(
l
.
Path
)
==
0
{
return
""
}
// skip trailing slash
lpath
:=
l
.
Path
if
lpath
[
len
(
lpath
)
-
1
]
==
'/'
{
lpath
=
lpath
[
:
len
(
lpath
)
-
1
]
}
parts
:=
strings
.
Split
(
lpath
,
"/"
)
var
result
string
for
i
,
part
:=
range
parts
{
if
i
==
0
&&
part
==
""
{
// Leading slash (root)
result
+=
`<a href="/">/</a>`
continue
}
result
+=
fmt
.
Sprintf
(
`<a href="%s/">%s</a>/`
,
strings
.
Join
(
parts
[
:
i
+
1
],
"/"
),
part
)
}
return
result
}
// BreadcrumbMap returns l.Path where every element is a map
// of URLs and path segment names.
func
(
l
Listing
)
BreadcrumbMap
()
map
[
string
]
string
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment