mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-12 05:20:26 +00:00
Make a better recent changes page
This commit is contained in:
parent
7a0e9ebcc9
commit
1fbbf81794
@ -68,7 +68,7 @@ func (rev Revision) HyphaeLinks() (html string) {
|
||||
if len(set) > 1 {
|
||||
html += `<span aria-hidden="true">, </span>`
|
||||
}
|
||||
html += fmt.Sprintf(`<a href="/rev/%[1]s/%[2]s">%[2]s</a>`, rev.Hash, hyphaName)
|
||||
html += fmt.Sprintf(`<a href="/page/%[1]s">%[1]s</a>`, hyphaName)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,10 +77,10 @@ func (rev Revision) HyphaeLinks() (html string) {
|
||||
|
||||
func (rev Revision) RecentChangesEntry() (html string) {
|
||||
return fmt.Sprintf(`
|
||||
<li><time>%s</time></li>
|
||||
<li>%s</li>
|
||||
<li>%s</li>
|
||||
<li>%s</li>
|
||||
<li class="rc-entry__time"><time>%s</time></li>
|
||||
<li class="rc-entry__hash">%s</li>
|
||||
<li class="rc-entry__links">%s</li>
|
||||
<li class="rc-entry__msg">%s</li>
|
||||
`, rev.TimeString(), rev.Hash, rev.HyphaeLinks(), rev.Message)
|
||||
}
|
||||
|
||||
|
2
main.go
2
main.go
@ -92,7 +92,7 @@ func handlerRecentChanges(w http.ResponseWriter, rq *http.Request) {
|
||||
noPrefix = strings.TrimPrefix(rq.URL.String(), "/recent-changes/")
|
||||
n, err = strconv.Atoi(noPrefix)
|
||||
)
|
||||
if err == nil {
|
||||
if err == nil && n < 101 {
|
||||
util.HTTP200Page(w, base(strconv.Itoa(n)+" recent changes", history.RecentChanges(n)))
|
||||
} else {
|
||||
http.Redirect(w, rq, "/recent-changes/20", http.StatusSeeOther)
|
||||
|
@ -67,7 +67,7 @@ func wikilink(src string, state *GemLexerState) (href, text, class string) {
|
||||
case strings.ContainsRune(href, ':'):
|
||||
class = "wikilink_external"
|
||||
default:
|
||||
if !HyphaExists(href) {
|
||||
if !HyphaExists(canonicalName(href)) {
|
||||
class += " wikilink_new"
|
||||
}
|
||||
href = path.Join("/page", href)
|
||||
|
@ -40,4 +40,9 @@ nav ul {display:flex; padding-left:0; flex-wrap:wrap; margin-top:0;}
|
||||
nav ul li {list-style-type:none;margin-right:1rem;}
|
||||
|
||||
#new-name {width:100%;}
|
||||
|
||||
.rc-entry { display: grid; list-style-type: none; padding: .25rem; background-color: #eee; grid-template-columns: 1fr 1fr; }
|
||||
.rc-entry__time { font-style: italic; }
|
||||
.rc-entry__hash { font-style: italic; text-align: right; }
|
||||
.rc-entry__links { grid-column: 1 / span 2; }
|
||||
{% endfunc %}
|
||||
|
@ -62,32 +62,37 @@ nav ul {display:flex; padding-left:0; flex-wrap:wrap; margin-top:0;}
|
||||
nav ul li {list-style-type:none;margin-right:1rem;}
|
||||
|
||||
#new-name {width:100%;}
|
||||
|
||||
.rc-entry { display: grid; list-style-type: none; padding: .25rem; background-color: #eee; grid-template-columns: 1fr 1fr; }
|
||||
.rc-entry__time { font-style: italic; }
|
||||
.rc-entry__hash { font-style: italic; text-align: right; }
|
||||
.rc-entry__links { grid-column: 1 / span 2; }
|
||||
`)
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
}
|
||||
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
func WriteDefaultCSS(qq422016 qtio422016.Writer) {
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
StreamDefaultCSS(qw422016)
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
}
|
||||
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
func DefaultCSS() string {
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
WriteDefaultCSS(qb422016)
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
return qs422016
|
||||
//line templates/css.qtpl:43
|
||||
//line templates/css.qtpl:48
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
{% func RecentChangesHTML(changes []string, n int) %}
|
||||
<main class="recent-changes">
|
||||
<h1>Recent Changes</h1>
|
||||
<p><a href="/">← Back</a></p>
|
||||
|
||||
<nav class="recent-changes__count">
|
||||
See
|
||||
@ -29,7 +30,7 @@
|
||||
<p>Could not find any recent changes.</p>
|
||||
{% else %}
|
||||
{% for i, entry := range changes %}
|
||||
<ul class="recent-changes__entry" role="article"
|
||||
<ul class="recent-changes__entry rc-entry" role="article"
|
||||
aria-setsize="{%d n %}" aria-posinset="{%d i %}">
|
||||
{%s= entry %}
|
||||
</ul>
|
||||
|
@ -23,134 +23,135 @@ func StreamRecentChangesHTML(qw422016 *qt422016.Writer, changes []string, n int)
|
||||
qw422016.N().S(`
|
||||
<main class="recent-changes">
|
||||
<h1>Recent Changes</h1>
|
||||
<p><a href="/">← Back</a></p>
|
||||
|
||||
<nav class="recent-changes__count">
|
||||
See
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:7
|
||||
//line templates/recent_changes.qtpl:8
|
||||
for _, m := range []int{20, 0, 50, 0, 100} {
|
||||
//line templates/recent_changes.qtpl:7
|
||||
//line templates/recent_changes.qtpl:8
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:8
|
||||
//line templates/recent_changes.qtpl:9
|
||||
switch m {
|
||||
//line templates/recent_changes.qtpl:9
|
||||
//line templates/recent_changes.qtpl:10
|
||||
case 0:
|
||||
//line templates/recent_changes.qtpl:9
|
||||
//line templates/recent_changes.qtpl:10
|
||||
qw422016.N().S(`
|
||||
<span aria-hidden="true">|</span>
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:11
|
||||
//line templates/recent_changes.qtpl:12
|
||||
case n:
|
||||
//line templates/recent_changes.qtpl:11
|
||||
//line templates/recent_changes.qtpl:12
|
||||
qw422016.N().S(`
|
||||
<b>`)
|
||||
//line templates/recent_changes.qtpl:12
|
||||
//line templates/recent_changes.qtpl:13
|
||||
qw422016.N().D(n)
|
||||
//line templates/recent_changes.qtpl:12
|
||||
//line templates/recent_changes.qtpl:13
|
||||
qw422016.N().S(`</b>
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:13
|
||||
//line templates/recent_changes.qtpl:14
|
||||
default:
|
||||
//line templates/recent_changes.qtpl:13
|
||||
//line templates/recent_changes.qtpl:14
|
||||
qw422016.N().S(`
|
||||
<a href="/recent-changes/`)
|
||||
//line templates/recent_changes.qtpl:14
|
||||
//line templates/recent_changes.qtpl:15
|
||||
qw422016.N().D(m)
|
||||
//line templates/recent_changes.qtpl:14
|
||||
//line templates/recent_changes.qtpl:15
|
||||
qw422016.N().S(`">`)
|
||||
//line templates/recent_changes.qtpl:14
|
||||
//line templates/recent_changes.qtpl:15
|
||||
qw422016.N().D(m)
|
||||
//line templates/recent_changes.qtpl:14
|
||||
//line templates/recent_changes.qtpl:15
|
||||
qw422016.N().S(`</a>
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:15
|
||||
//line templates/recent_changes.qtpl:16
|
||||
}
|
||||
//line templates/recent_changes.qtpl:15
|
||||
//line templates/recent_changes.qtpl:16
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:16
|
||||
//line templates/recent_changes.qtpl:17
|
||||
}
|
||||
//line templates/recent_changes.qtpl:16
|
||||
//line templates/recent_changes.qtpl:17
|
||||
qw422016.N().S(`
|
||||
recent changes
|
||||
</nav>
|
||||
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:25
|
||||
//line templates/recent_changes.qtpl:26
|
||||
qw422016.N().S(`
|
||||
|
||||
<section class="recent-changes__list" role="feed">
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:28
|
||||
//line templates/recent_changes.qtpl:29
|
||||
if len(changes) == 0 {
|
||||
//line templates/recent_changes.qtpl:28
|
||||
//line templates/recent_changes.qtpl:29
|
||||
qw422016.N().S(`
|
||||
<p>Could not find any recent changes.</p>
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:30
|
||||
//line templates/recent_changes.qtpl:31
|
||||
} else {
|
||||
//line templates/recent_changes.qtpl:30
|
||||
//line templates/recent_changes.qtpl:31
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:31
|
||||
//line templates/recent_changes.qtpl:32
|
||||
for i, entry := range changes {
|
||||
//line templates/recent_changes.qtpl:31
|
||||
//line templates/recent_changes.qtpl:32
|
||||
qw422016.N().S(`
|
||||
<ul class="recent-changes__entry" role="article"
|
||||
<ul class="recent-changes__entry rc-entry" role="article"
|
||||
aria-setsize="`)
|
||||
//line templates/recent_changes.qtpl:33
|
||||
//line templates/recent_changes.qtpl:34
|
||||
qw422016.N().D(n)
|
||||
//line templates/recent_changes.qtpl:33
|
||||
//line templates/recent_changes.qtpl:34
|
||||
qw422016.N().S(`" aria-posinset="`)
|
||||
//line templates/recent_changes.qtpl:33
|
||||
//line templates/recent_changes.qtpl:34
|
||||
qw422016.N().D(i)
|
||||
//line templates/recent_changes.qtpl:33
|
||||
//line templates/recent_changes.qtpl:34
|
||||
qw422016.N().S(`">
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:34
|
||||
//line templates/recent_changes.qtpl:35
|
||||
qw422016.N().S(entry)
|
||||
//line templates/recent_changes.qtpl:34
|
||||
//line templates/recent_changes.qtpl:35
|
||||
qw422016.N().S(`
|
||||
</ul>
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:36
|
||||
//line templates/recent_changes.qtpl:37
|
||||
}
|
||||
//line templates/recent_changes.qtpl:36
|
||||
//line templates/recent_changes.qtpl:37
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:37
|
||||
//line templates/recent_changes.qtpl:38
|
||||
}
|
||||
//line templates/recent_changes.qtpl:37
|
||||
//line templates/recent_changes.qtpl:38
|
||||
qw422016.N().S(`
|
||||
</section>
|
||||
</main>
|
||||
`)
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
}
|
||||
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
func WriteRecentChangesHTML(qq422016 qtio422016.Writer, changes []string, n int) {
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
StreamRecentChangesHTML(qw422016, changes, n)
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
}
|
||||
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
func RecentChangesHTML(changes []string, n int) string {
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
WriteRecentChangesHTML(qb422016, changes, n)
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
return qs422016
|
||||
//line templates/recent_changes.qtpl:40
|
||||
//line templates/recent_changes.qtpl:41
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user