diff --git a/web/index.jade.go b/web/index.jade.go index 419a7d6..926bdb8 100644 --- a/web/index.jade.go +++ b/web/index.jade.go @@ -9,7 +9,6 @@ import ( "html" "io" "net/http" - "strconv" ) const ( @@ -27,7 +26,7 @@ const ( index__11 = `` ) -func Index(mainSite, currentPath string, totalFiles, totalFilesSize, totalDirectories int64, items *[]files.DirEntry, r *http.Request, wr io.Writer) { +func Index(mainSite, currentPath string, stats *files.DirStats, items *[]files.DirEntry, r *http.Request, wr io.Writer) { buffer := &WriterAsBuffer{wr} buffer.WriteString(index__0) @@ -35,11 +34,11 @@ func Index(mainSite, currentPath string, totalFiles, totalFilesSize, totalDirect buffer.WriteString(index__1) buffer.WriteString(currentPath) buffer.WriteString(index__2) - buffer.WriteString(html.EscapeString(strconv.FormatInt(totalFiles, 10))) + buffer.WriteString(html.EscapeString(fmt.Sprintf("%v", stats.Files))) buffer.WriteString(index__3) - buffer.WriteString(html.EscapeString(strconv.FormatInt(totalFilesSize, 10))) + buffer.WriteString(html.EscapeString(fmt.Sprintf("%v", stats.FilesSize))) buffer.WriteString(index__4) - buffer.WriteString(html.EscapeString(strconv.FormatInt(totalDirectories, 10))) + buffer.WriteString(html.EscapeString(fmt.Sprintf("%v", stats.Directories))) buffer.WriteString(index__5) for _, item := range *items { diff --git a/web/templates/index.jade b/web/templates/index.jade index 2a5822d..18d7433 100644 --- a/web/templates/index.jade +++ b/web/templates/index.jade @@ -1,4 +1,4 @@ -:go:func Index(mainSite, currentPath string, totalFiles, totalFilesSize, totalDirectories int64, items *[]files.DirEntry, r *http.Request) +:go:func Index(mainSite, currentPath string, stats *files.DirStats, items *[]files.DirEntry, r *http.Request) :go:import "dwelling-files/pkg/files" :go:import "dwelling-files/pkg/utils" @@ -25,7 +25,7 @@ html(lang='en') h1 Files section#files span#current-path!= currentPath - p Files: #{totalFiles} (#{totalFilesSize}); Directories: #{totalDirectories}. + p Files: #{stats.Files} (#{stats.FilesSize}); Directories: #{stats.Directories}. table thead tr