From b080a6f01768cbfa40c83572d9fec45f9685156b Mon Sep 17 00:00:00 2001 From: mappu Date: Mon, 2 Apr 2018 17:54:24 +1200 Subject: [PATCH] add link to raw source page when viewing a specific revision --- pageTemplate.go | 9 +++++++++ rArchive.go | 3 +++ 2 files changed, 12 insertions(+) diff --git a/pageTemplate.go b/pageTemplate.go index 5898582..0cecbc3 100644 --- a/pageTemplate.go +++ b/pageTemplate.go @@ -11,6 +11,8 @@ var subresourceNonce = time.Now().Unix() type pageTemplateOptions struct { CurrentPageIsArticle bool CurrentPageName string + CurrentPageIsRev bool + CurrentPageRev int64 WikiTitle string Content template.HTML BaseURL string @@ -114,6 +116,13 @@ function els(e,s){ // no js exec in innerHTML + {{if .CurrentPageIsRev }} +
+ + + +
+ {{end}} {{end}} diff --git a/rArchive.go b/rArchive.go index c64c8df..768e7e4 100644 --- a/rArchive.go +++ b/rArchive.go @@ -25,6 +25,9 @@ func (this *WikiServer) routeArchive(w http.ResponseWriter, r *http.Request, rev pto.CurrentPageName = a.Title pto.CurrentPageIsArticle = true + pto.CurrentPageRev = int64(revId) + pto.CurrentPageIsRev = true + infoMessageHtml := `You are viewing a specific revision of this page, last modified ` + time.Unix(a.Modified, 0).In(this.loc).Format(this.opts.DateFormat) + `. ` if !a.IsDeleted {