diff --git a/pkg/core/helper.go b/pkg/core/helper.go index 37c61ae..3976757 100644 --- a/pkg/core/helper.go +++ b/pkg/core/helper.go @@ -8,8 +8,9 @@ import ( ) const ( - fileFmt = "20060102_150405" - logFmt = "2006/01/02 15:04:05: " + fileFmt = "20060102_150405" + logFmt = "2006/01/02 15:04:05: " + createdFmt = "02.01.2006 15:04:05" ) var m sync.Mutex @@ -26,3 +27,7 @@ func FileName() string { func LogTime() string { return time.Now().Format(logFmt) } + +func CreatedTime(t time.Time) string { + return t.Format(createdFmt) +} diff --git a/pkg/server/context.go b/pkg/server/context.go index 12221c2..7841b25 100644 --- a/pkg/server/context.go +++ b/pkg/server/context.go @@ -74,10 +74,11 @@ type webData struct { Msg string Query string - Path string - Paths core.Paths - Tags []string - Data interface{} + Path string + Paths core.Paths + Tags []string + Created string + Data interface{} } type loginData struct { diff --git a/pkg/server/handler.go b/pkg/server/handler.go index 9d5b81e..13090bf 100644 --- a/pkg/server/handler.go +++ b/pkg/server/handler.go @@ -457,7 +457,15 @@ func dirHandler(ctx *Context) { Title: "Document Viewer | " + path, } ctx.Template("fileHandler") - f := ctx.Srv.DB.IsIndexed(path) + //f := ctx.Srv.DB.IsIndexed(path) + id, err := ctx.Srv.DB.GetID(path) + f := err == nil + if id != "" { + d, err := ctx.Srv.DB.Index.Get(id) + if err == nil { + ctx.Data.Created = core.CreatedTime(d.Created) + } + } ctx.Data.Data = core.Path{ Name: path, Abs: core.RawPrefix + path, diff --git a/pkg/server/templates.go b/pkg/server/templates.go index 99032dd..6025dfe 100644 --- a/pkg/server/templates.go +++ b/pkg/server/templates.go @@ -151,16 +151,17 @@ const ( -{{if .Tags}}
+ {{if .Tags}} Tags {{range $t := .Tags}} {{$t}} {{end}} + {{end}} + {{.Created}}
-{{end}}
diff --git a/templates/file.html b/templates/file.html index d19c91f..618f1e5 100644 --- a/templates/file.html +++ b/templates/file.html @@ -24,16 +24,17 @@ -{{if .Tags}}
+ {{if .Tags}} Tags {{range $t := .Tags}} {{$t}} {{end}} + {{end}} + {{.Created}}
-{{end}}