Commit 060ab92d authored by Matthew Holt's avatar Matthew Holt

Reorder a few things

The docs link to this structure and all its methods related to the browse template; keeping them together makes it possible to link to the whole block of code that is relevant.
parent 0830c728
...@@ -106,6 +106,17 @@ type FileInfo struct { ...@@ -106,6 +106,17 @@ type FileInfo struct {
Mode os.FileMode Mode os.FileMode
} }
// HumanSize returns the size of the file as a human-readable string
// in IEC format (i.e. power of 2 or base 1024).
func (fi FileInfo) HumanSize() string {
return humanize.IBytes(uint64(fi.Size))
}
// HumanModTime returns the modified time of the file as a human-readable string.
func (fi FileInfo) HumanModTime(format string) string {
return fi.ModTime.Format(format)
}
// Implement sorting for Listing // Implement sorting for Listing
type byName Listing type byName Listing
type bySize Listing type bySize Listing
...@@ -161,17 +172,6 @@ func (l Listing) applySort() { ...@@ -161,17 +172,6 @@ func (l Listing) applySort() {
} }
} }
// HumanSize returns the size of the file as a human-readable string
// in IEC format (i.e. power of 2 or base 1024).
func (fi FileInfo) HumanSize() string {
return humanize.IBytes(uint64(fi.Size))
}
// HumanModTime returns the modified time of the file as a human-readable string.
func (fi FileInfo) HumanModTime(format string) string {
return fi.ModTime.Format(format)
}
func directoryListing(files []os.FileInfo, r *http.Request, canGoUp bool, root string, ignoreIndexes bool, vars interface{}) (Listing, error) { func directoryListing(files []os.FileInfo, r *http.Request, canGoUp bool, root string, ignoreIndexes bool, vars interface{}) (Listing, error) {
var fileinfos []FileInfo var fileinfos []FileInfo
var dirCount, fileCount int var dirCount, fileCount int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment