1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 19:56:16 +00:00
mycorrhiza/views/history.qtpl.go

436 lines
10 KiB
Go
Raw Normal View History

2021-02-20 16:50:25 +00:00
// Code generated by qtc from "history.qtpl". DO NOT EDIT.
// See https://github.com/valyala/quicktemplate for details.
//line views/history.qtpl:1
package views
//line views/history.qtpl:1
2021-07-01 09:37:41 +00:00
import "fmt"
//line views/history.qtpl:2
2021-02-20 16:50:25 +00:00
import "net/http"
//line views/history.qtpl:3
2021-07-01 09:37:41 +00:00
import "time"
//line views/history.qtpl:5
import "github.com/bouncepaw/mycorrhiza/cfg"
2021-02-20 16:50:25 +00:00
2021-07-01 09:37:41 +00:00
//line views/history.qtpl:6
import "github.com/bouncepaw/mycorrhiza/util"
2021-07-01 09:37:41 +00:00
//line views/history.qtpl:7
import "github.com/bouncepaw/mycorrhiza/user"
2021-02-20 16:50:25 +00:00
2021-07-01 09:37:41 +00:00
//line views/history.qtpl:8
import "github.com/bouncepaw/mycorrhiza/hyphae"
2021-07-01 09:37:41 +00:00
//line views/history.qtpl:9
import "github.com/bouncepaw/mycorrhiza/history"
2021-07-01 09:37:41 +00:00
//line views/history.qtpl:12
2021-02-20 16:50:25 +00:00
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
2021-07-01 09:37:41 +00:00
//line views/history.qtpl:12
2021-02-20 16:50:25 +00:00
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
2021-07-01 09:37:41 +00:00
//line views/history.qtpl:12
func StreamPrimitiveDiffHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, u *user.User, hash string) {
2021-07-01 09:37:41 +00:00
//line views/history.qtpl:12
qw422016.N().S(`
`)
2021-07-01 09:37:41 +00:00
//line views/history.qtpl:14
2021-07-30 14:20:21 +00:00
text, err := history.PrimitiveDiffAtRevision(h.TextPartPath(), hash)
if err != nil {
text = err.Error()
}
2021-07-01 09:37:41 +00:00
//line views/history.qtpl:18
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<article>
<h1>Diff `)
//line views/history.qtpl:22
qw422016.E().S(util.BeautifulName(h.Name))
//line views/history.qtpl:22
qw422016.N().S(` at `)
//line views/history.qtpl:22
qw422016.E().S(hash)
//line views/history.qtpl:22
qw422016.N().S(`</h1>
<pre class="codeblock"><code>`)
//line views/history.qtpl:23
qw422016.E().S(text)
//line views/history.qtpl:23
qw422016.N().S(`</code></pre>
</article>
</main>
</div>
`)
//line views/history.qtpl:27
}
//line views/history.qtpl:27
func WritePrimitiveDiffHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, u *user.User, hash string) {
//line views/history.qtpl:27
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/history.qtpl:27
StreamPrimitiveDiffHTML(qw422016, rq, h, u, hash)
//line views/history.qtpl:27
qt422016.ReleaseWriter(qw422016)
//line views/history.qtpl:27
}
//line views/history.qtpl:27
func PrimitiveDiffHTML(rq *http.Request, h *hyphae.Hypha, u *user.User, hash string) string {
//line views/history.qtpl:27
qb422016 := qt422016.AcquireByteBuffer()
//line views/history.qtpl:27
WritePrimitiveDiffHTML(qb422016, rq, h, u, hash)
//line views/history.qtpl:27
qs422016 := string(qb422016.B)
//line views/history.qtpl:27
qt422016.ReleaseByteBuffer(qb422016)
//line views/history.qtpl:27
return qs422016
//line views/history.qtpl:27
}
//line views/history.qtpl:29
2021-02-20 16:50:25 +00:00
func StreamRecentChangesHTML(qw422016 *qt422016.Writer, n int) {
//line views/history.qtpl:29
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
<div class="layout">
<main class="main-width recent-changes">
<h1>Recent Changes</h1>
<nav class="recent-changes__count">
See
`)
//line views/history.qtpl:36
2021-07-01 09:37:41 +00:00
for i, m := range []int{20, 50, 100} {
//line views/history.qtpl:36
2021-07-01 09:37:41 +00:00
qw422016.N().S(`
`)
//line views/history.qtpl:37
2021-07-01 09:37:41 +00:00
if i > 0 {
//line views/history.qtpl:37
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
<span aria-hidden="true">|</span>
2021-07-01 09:37:41 +00:00
`)
//line views/history.qtpl:39
2021-07-01 09:37:41 +00:00
}
//line views/history.qtpl:39
2021-07-01 09:37:41 +00:00
qw422016.N().S(`
`)
//line views/history.qtpl:40
2021-07-01 09:37:41 +00:00
if m == n {
//line views/history.qtpl:40
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
2021-07-01 09:37:41 +00:00
<b>`)
//line views/history.qtpl:41
2021-02-20 16:50:25 +00:00
qw422016.N().D(m)
//line views/history.qtpl:41
2021-07-01 09:37:41 +00:00
qw422016.N().S(`</b>
`)
//line views/history.qtpl:42
2021-07-01 09:37:41 +00:00
} else {
//line views/history.qtpl:42
2021-07-01 09:37:41 +00:00
qw422016.N().S(`
<a href="/recent-changes/`)
//line views/history.qtpl:43
2021-07-01 09:37:41 +00:00
qw422016.N().D(m)
//line views/history.qtpl:43
2021-02-20 16:50:25 +00:00
qw422016.N().S(`">`)
//line views/history.qtpl:43
2021-02-20 16:50:25 +00:00
qw422016.N().D(m)
//line views/history.qtpl:43
2021-02-20 16:50:25 +00:00
qw422016.N().S(`</a>
`)
//line views/history.qtpl:44
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:44
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
`)
//line views/history.qtpl:45
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:45
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
recent changes
</nav>
<p><img class="icon" width="20" height="20" src="/static/icon/feed.svg">Subscribe via <a href="/recent-changes-rss">RSS</a>, <a href="/recent-changes-atom">Atom</a> or <a href="/recent-changes-json">JSON feed</a>.</p>
2021-02-20 16:50:25 +00:00
`)
//line views/history.qtpl:56
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
`)
//line views/history.qtpl:59
2021-02-20 16:50:25 +00:00
changes := history.RecentChanges(n)
2021-07-01 09:37:41 +00:00
var year, day int
var month time.Month
2021-02-20 16:50:25 +00:00
//line views/history.qtpl:62
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
<section class="recent-changes__list" role="feed">
`)
//line views/history.qtpl:64
2021-02-20 16:50:25 +00:00
if len(changes) == 0 {
//line views/history.qtpl:64
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
<p>Could not find any recent changes.</p>
`)
//line views/history.qtpl:66
2021-02-20 16:50:25 +00:00
} else {
//line views/history.qtpl:66
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
`)
//line views/history.qtpl:67
2021-02-20 16:50:25 +00:00
for i, entry := range changes {
//line views/history.qtpl:67
2021-07-01 09:37:41 +00:00
qw422016.N().S(`
`)
//line views/history.qtpl:69
2021-07-01 09:37:41 +00:00
y, m, d := entry.Time.UTC().Date()
//line views/history.qtpl:69
2021-07-01 09:37:41 +00:00
qw422016.N().S(`
`)
//line views/history.qtpl:70
2021-07-01 09:37:41 +00:00
if d != day || m != month || y != year {
//line views/history.qtpl:70
2021-07-01 09:37:41 +00:00
qw422016.N().S(`
<h2 class="recent-changes__heading">
`)
//line views/history.qtpl:72
2021-07-01 09:37:41 +00:00
qw422016.E().S(fmt.Sprintf("%04d-%02d-%02d", y, m, d))
//line views/history.qtpl:72
qw422016.N().S(`
</h2>
`)
//line views/history.qtpl:74
2021-07-01 09:37:41 +00:00
year, month, day = y, m, d
//line views/history.qtpl:74
2021-07-01 09:37:41 +00:00
qw422016.N().S(`
`)
//line views/history.qtpl:75
2021-07-01 09:37:41 +00:00
}
//line views/history.qtpl:75
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
2021-07-01 09:37:41 +00:00
<div class="recent-changes__entry" role="article"
2021-02-20 16:50:25 +00:00
aria-setsize="`)
//line views/history.qtpl:78
2021-02-20 16:50:25 +00:00
qw422016.N().D(n)
//line views/history.qtpl:78
2021-02-20 16:50:25 +00:00
qw422016.N().S(`" aria-posinset="`)
//line views/history.qtpl:78
2021-02-20 16:50:25 +00:00
qw422016.N().D(i)
//line views/history.qtpl:78
2021-02-20 16:50:25 +00:00
qw422016.N().S(`">
`)
//line views/history.qtpl:79
2021-02-20 16:50:25 +00:00
qw422016.N().S(recentChangesEntry(entry))
//line views/history.qtpl:79
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
</div>
2021-07-01 09:37:41 +00:00
2021-02-20 16:50:25 +00:00
`)
//line views/history.qtpl:82
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:82
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
`)
//line views/history.qtpl:83
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:83
qw422016.N().S(`
`)
//line views/history.qtpl:84
qw422016.N().S(helpTopicBadgeHTML("en", "recent_changes"))
//line views/history.qtpl:84
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
</section>
</main>
</div>
`)
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
func WriteRecentChangesHTML(qq422016 qtio422016.Writer, n int) {
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
StreamRecentChangesHTML(qw422016, n)
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
qt422016.ReleaseWriter(qw422016)
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
func RecentChangesHTML(n int) string {
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
qb422016 := qt422016.AcquireByteBuffer()
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
WriteRecentChangesHTML(qb422016, n)
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
qs422016 := string(qb422016.B)
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
qt422016.ReleaseByteBuffer(qb422016)
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
return qs422016
//line views/history.qtpl:88
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:90
2021-02-20 16:50:25 +00:00
func streamrecentChangesEntry(qw422016 *qt422016.Writer, rev history.Revision) {
//line views/history.qtpl:90
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
<div>
<time class="recent-changes__entry__time">
`)
//line views/history.qtpl:93
2021-07-01 09:37:41 +00:00
qw422016.E().S(rev.Time.UTC().Format("15:04 UTC"))
//line views/history.qtpl:93
qw422016.N().S(`
</time>
<span class="recent-changes__entry__message">`)
//line views/history.qtpl:95
2021-02-20 16:50:25 +00:00
qw422016.E().S(rev.Hash)
//line views/history.qtpl:95
qw422016.N().S(`</span>
`)
//line views/history.qtpl:97
2021-02-20 16:50:25 +00:00
if rev.Username != "anon" {
//line views/history.qtpl:97
qw422016.N().S(`
<span class="recent-changes__entry__author">
&mdash; <a href="/hypha/`)
//line views/history.qtpl:99
qw422016.E().S(cfg.UserHypha)
//line views/history.qtpl:99
2021-02-20 16:50:25 +00:00
qw422016.N().S(`/`)
//line views/history.qtpl:99
2021-02-20 16:50:25 +00:00
qw422016.E().S(rev.Username)
//line views/history.qtpl:99
2021-02-20 16:50:25 +00:00
qw422016.N().S(`" rel="author">`)
//line views/history.qtpl:99
2021-02-20 16:50:25 +00:00
qw422016.E().S(rev.Username)
//line views/history.qtpl:99
qw422016.N().S(`</a>
</span>
`)
//line views/history.qtpl:101
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:101
qw422016.N().S(`
</div>
<div>
<span class="recent-changes__entry__links">
`)
//line views/history.qtpl:105
qw422016.N().S(rev.HyphaeLinksHTML())
//line views/history.qtpl:105
qw422016.N().S(`
</span>
<span class="recent-changes__entry__message">
`)
//line views/history.qtpl:108
qw422016.E().S(rev.Message)
//line views/history.qtpl:108
qw422016.N().S(`
</span>
</div>
2021-02-20 16:50:25 +00:00
`)
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
func writerecentChangesEntry(qq422016 qtio422016.Writer, rev history.Revision) {
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
streamrecentChangesEntry(qw422016, rev)
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
qt422016.ReleaseWriter(qw422016)
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
func recentChangesEntry(rev history.Revision) string {
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
qb422016 := qt422016.AcquireByteBuffer()
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
writerecentChangesEntry(qb422016, rev)
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
qs422016 := string(qb422016.B)
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
qt422016.ReleaseByteBuffer(qb422016)
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
return qs422016
//line views/history.qtpl:111
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:113
2021-02-20 16:50:25 +00:00
func StreamHistoryHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, list string) {
//line views/history.qtpl:113
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<article class="history">
<h1>History of `)
//line views/history.qtpl:117
2021-02-20 16:50:25 +00:00
qw422016.E().S(util.BeautifulName(hyphaName))
//line views/history.qtpl:117
2021-02-20 16:50:25 +00:00
qw422016.N().S(`</h1>
`)
//line views/history.qtpl:118
2021-02-20 16:50:25 +00:00
qw422016.N().S(list)
//line views/history.qtpl:118
2021-02-20 16:50:25 +00:00
qw422016.N().S(`
</article>
</main>
</div>
`)
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
func WriteHistoryHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, list string) {
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
StreamHistoryHTML(qw422016, rq, hyphaName, list)
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
qt422016.ReleaseWriter(qw422016)
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
}
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
func HistoryHTML(rq *http.Request, hyphaName, list string) string {
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
qb422016 := qt422016.AcquireByteBuffer()
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
WriteHistoryHTML(qb422016, rq, hyphaName, list)
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
qs422016 := string(qb422016.B)
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
qt422016.ReleaseByteBuffer(qb422016)
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
return qs422016
//line views/history.qtpl:122
2021-02-20 16:50:25 +00:00
}