mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-12 05:20:26 +00:00
Change navigation links depending on who the user is
This commit is contained in:
parent
cfdc7b82ae
commit
57751d03f4
@ -31,7 +31,7 @@ func handlerRenameAsk(w http.ResponseWriter, rq *http.Request) {
|
||||
log.Println("Rejected", rq.URL)
|
||||
return
|
||||
}
|
||||
util.HTTP200Page(w, base("Rename "+hyphaName+"?", templates.RenameAskHTML(hyphaName, isOld)))
|
||||
util.HTTP200Page(w, base("Rename "+hyphaName+"?", templates.RenameAskHTML(rq, hyphaName, isOld)))
|
||||
}
|
||||
|
||||
func handlerRenameConfirm(w http.ResponseWriter, rq *http.Request) {
|
||||
@ -87,7 +87,7 @@ func handlerDeleteAsk(w http.ResponseWriter, rq *http.Request) {
|
||||
log.Println("Rejected", rq.URL)
|
||||
return
|
||||
}
|
||||
util.HTTP200Page(w, base("Delete "+hyphaName+"?", templates.DeleteAskHTML(hyphaName, isOld)))
|
||||
util.HTTP200Page(w, base("Delete "+hyphaName+"?", templates.DeleteAskHTML(rq, hyphaName, isOld)))
|
||||
}
|
||||
|
||||
// handlerDeleteConfirm deletes a hypha for sure
|
||||
@ -144,7 +144,7 @@ func handlerEdit(w http.ResponseWriter, rq *http.Request) {
|
||||
} else {
|
||||
warning = `<p>You are creating a new hypha.</p>`
|
||||
}
|
||||
util.HTTP200Page(w, base("Edit "+hyphaName, templates.EditHTML(hyphaName, textAreaFill, warning)))
|
||||
util.HTTP200Page(w, base("Edit "+hyphaName, templates.EditHTML(rq, hyphaName, textAreaFill, warning)))
|
||||
}
|
||||
|
||||
// handlerUploadText uploads a new text part for the hypha.
|
||||
|
@ -40,6 +40,7 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
|
||||
contents = markup.ToHtml(hyphaName, textContents)
|
||||
}
|
||||
page := templates.RevisionHTML(
|
||||
rq,
|
||||
hyphaName,
|
||||
naviTitle(hyphaName),
|
||||
contents,
|
||||
@ -67,7 +68,7 @@ func handlerHistory(w http.ResponseWriter, rq *http.Request) {
|
||||
log.Println("Found", len(revs), "revisions for", hyphaName)
|
||||
|
||||
util.HTTP200Page(w,
|
||||
base(hyphaName, templates.HistoryHTML(hyphaName, tbody)))
|
||||
base(hyphaName, templates.HistoryHTML(rq, hyphaName, tbody)))
|
||||
}
|
||||
|
||||
// handlerText serves raw source text of the hypha.
|
||||
@ -110,7 +111,7 @@ func handlerPage(w http.ResponseWriter, rq *http.Request) {
|
||||
contents = binaryHtmlBlock(hyphaName, data) + contents
|
||||
}
|
||||
}
|
||||
util.HTTP200Page(w, base(hyphaName, templates.PageHTML(hyphaName,
|
||||
util.HTTP200Page(w, base(hyphaName, templates.PageHTML(rq, hyphaName,
|
||||
naviTitle(hyphaName),
|
||||
contents,
|
||||
tree.TreeAsHtml(hyphaName, IterateHyphaNamesWith))))
|
||||
|
@ -1,3 +1,7 @@
|
||||
{% import "net/http" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
||||
|
||||
This is the <nav> seen on top of many pages.
|
||||
{% code
|
||||
type navEntry struct {
|
||||
@ -10,23 +14,38 @@ var navEntries = []navEntry{
|
||||
{"text", "Raw text"},
|
||||
{"history", "History"},
|
||||
{"revision", "NOT REACHED"},
|
||||
{"delete-ask", "Delete"},
|
||||
{"rename-ask", "Rename"},
|
||||
{"delete-ask", "Delete"},
|
||||
}
|
||||
%}
|
||||
|
||||
{% func navHTML(hyphaName, navType string, revisionHash ...string) %}
|
||||
<nav>
|
||||
{% func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) %}
|
||||
{% code
|
||||
u := user.FromRequest(rq).OrAnon()
|
||||
%}
|
||||
<nav class="navlinks">
|
||||
<ul>
|
||||
{%- for _, entry := range navEntries -%}
|
||||
{%- if navType == "revision" && entry.path == "revision" -%}
|
||||
<li><b>{%s revisionHash[0] %}</b></li>
|
||||
{%- elseif navType == entry.path -%}
|
||||
<li><b>{%s entry.title %}</b></li>
|
||||
{%- elseif entry.path != "revision"-%}
|
||||
{%- elseif entry.path != "revision" && u.Group.CanAccessRoute(entry.path) -%}
|
||||
<li><a href="/{%s entry.path %}/{%s hyphaName %}">{%s entry.title %}</a></li>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
{%s= userMenuHTML(u) %}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endfunc %}
|
||||
|
||||
{% func userMenuHTML(u *user.User) %}
|
||||
<li class="navlinks__user">
|
||||
{% if u.Group == user.UserAnon %}
|
||||
<a href="/login">Login</a>
|
||||
{% else %}
|
||||
<a href="/page/{%s util.UserTree %}/{%s u.Name %}">{%s u.Name %}</a>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfunc %}
|
||||
|
||||
|
@ -1,25 +1,34 @@
|
||||
// Code generated by qtc from "common.qtpl". DO NOT EDIT.
|
||||
// See https://github.com/valyala/quicktemplate for details.
|
||||
|
||||
// This is the <nav> seen on top of many pages.
|
||||
|
||||
//line templates/common.qtpl:2
|
||||
//line templates/common.qtpl:1
|
||||
package templates
|
||||
|
||||
//line templates/common.qtpl:1
|
||||
import "net/http"
|
||||
|
||||
//line templates/common.qtpl:2
|
||||
import "github.com/bouncepaw/mycorrhiza/user"
|
||||
|
||||
//line templates/common.qtpl:3
|
||||
import "github.com/bouncepaw/mycorrhiza/util"
|
||||
|
||||
// This is the <nav> seen on top of many pages.
|
||||
|
||||
//line templates/common.qtpl:6
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/common.qtpl:2
|
||||
//line templates/common.qtpl:6
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line templates/common.qtpl:3
|
||||
//line templates/common.qtpl:7
|
||||
type navEntry struct {
|
||||
path string
|
||||
title string
|
||||
@ -31,87 +40,163 @@ var navEntries = []navEntry{
|
||||
{"text", "Raw text"},
|
||||
{"history", "History"},
|
||||
{"revision", "NOT REACHED"},
|
||||
{"delete-ask", "Delete"},
|
||||
{"rename-ask", "Rename"},
|
||||
{"delete-ask", "Delete"},
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:18
|
||||
func streamnavHTML(qw422016 *qt422016.Writer, hyphaName, navType string, revisionHash ...string) {
|
||||
//line templates/common.qtpl:18
|
||||
//line templates/common.qtpl:22
|
||||
func streamnavHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
||||
//line templates/common.qtpl:22
|
||||
qw422016.N().S(`
|
||||
<nav>
|
||||
`)
|
||||
//line templates/common.qtpl:24
|
||||
u := user.FromRequest(rq).OrAnon()
|
||||
|
||||
//line templates/common.qtpl:25
|
||||
qw422016.N().S(`
|
||||
<nav class="navlinks">
|
||||
<ul>
|
||||
`)
|
||||
//line templates/common.qtpl:21
|
||||
//line templates/common.qtpl:28
|
||||
for _, entry := range navEntries {
|
||||
//line templates/common.qtpl:22
|
||||
//line templates/common.qtpl:29
|
||||
if navType == "revision" && entry.path == "revision" {
|
||||
//line templates/common.qtpl:22
|
||||
//line templates/common.qtpl:29
|
||||
qw422016.N().S(` <li><b>`)
|
||||
//line templates/common.qtpl:23
|
||||
//line templates/common.qtpl:30
|
||||
qw422016.E().S(revisionHash[0])
|
||||
//line templates/common.qtpl:23
|
||||
//line templates/common.qtpl:30
|
||||
qw422016.N().S(`</b></li>
|
||||
`)
|
||||
//line templates/common.qtpl:24
|
||||
//line templates/common.qtpl:31
|
||||
} else if navType == entry.path {
|
||||
//line templates/common.qtpl:24
|
||||
//line templates/common.qtpl:31
|
||||
qw422016.N().S(` <li><b>`)
|
||||
//line templates/common.qtpl:25
|
||||
//line templates/common.qtpl:32
|
||||
qw422016.E().S(entry.title)
|
||||
//line templates/common.qtpl:25
|
||||
//line templates/common.qtpl:32
|
||||
qw422016.N().S(`</b></li>
|
||||
`)
|
||||
//line templates/common.qtpl:26
|
||||
} else if entry.path != "revision" {
|
||||
//line templates/common.qtpl:26
|
||||
//line templates/common.qtpl:33
|
||||
} else if entry.path != "revision" && u.Group.CanAccessRoute(entry.path) {
|
||||
//line templates/common.qtpl:33
|
||||
qw422016.N().S(` <li><a href="/`)
|
||||
//line templates/common.qtpl:27
|
||||
//line templates/common.qtpl:34
|
||||
qw422016.E().S(entry.path)
|
||||
//line templates/common.qtpl:27
|
||||
//line templates/common.qtpl:34
|
||||
qw422016.N().S(`/`)
|
||||
//line templates/common.qtpl:27
|
||||
//line templates/common.qtpl:34
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/common.qtpl:27
|
||||
//line templates/common.qtpl:34
|
||||
qw422016.N().S(`">`)
|
||||
//line templates/common.qtpl:27
|
||||
//line templates/common.qtpl:34
|
||||
qw422016.E().S(entry.title)
|
||||
//line templates/common.qtpl:27
|
||||
//line templates/common.qtpl:34
|
||||
qw422016.N().S(`</a></li>
|
||||
`)
|
||||
//line templates/common.qtpl:28
|
||||
//line templates/common.qtpl:35
|
||||
}
|
||||
//line templates/common.qtpl:29
|
||||
//line templates/common.qtpl:36
|
||||
}
|
||||
//line templates/common.qtpl:29
|
||||
qw422016.N().S(` </ul>
|
||||
//line templates/common.qtpl:36
|
||||
qw422016.N().S(` `)
|
||||
//line templates/common.qtpl:37
|
||||
qw422016.N().S(userMenuHTML(u))
|
||||
//line templates/common.qtpl:37
|
||||
qw422016.N().S(`
|
||||
</ul>
|
||||
</nav>
|
||||
`)
|
||||
//line templates/common.qtpl:32
|
||||
//line templates/common.qtpl:40
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:32
|
||||
func writenavHTML(qq422016 qtio422016.Writer, hyphaName, navType string, revisionHash ...string) {
|
||||
//line templates/common.qtpl:32
|
||||
//line templates/common.qtpl:40
|
||||
func writenavHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
||||
//line templates/common.qtpl:40
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/common.qtpl:32
|
||||
streamnavHTML(qw422016, hyphaName, navType, revisionHash...)
|
||||
//line templates/common.qtpl:32
|
||||
//line templates/common.qtpl:40
|
||||
streamnavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
|
||||
//line templates/common.qtpl:40
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/common.qtpl:32
|
||||
//line templates/common.qtpl:40
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:32
|
||||
func navHTML(hyphaName, navType string, revisionHash ...string) string {
|
||||
//line templates/common.qtpl:32
|
||||
//line templates/common.qtpl:40
|
||||
func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
|
||||
//line templates/common.qtpl:40
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/common.qtpl:32
|
||||
writenavHTML(qb422016, hyphaName, navType, revisionHash...)
|
||||
//line templates/common.qtpl:32
|
||||
//line templates/common.qtpl:40
|
||||
writenavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
|
||||
//line templates/common.qtpl:40
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/common.qtpl:32
|
||||
//line templates/common.qtpl:40
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/common.qtpl:32
|
||||
//line templates/common.qtpl:40
|
||||
return qs422016
|
||||
//line templates/common.qtpl:32
|
||||
//line templates/common.qtpl:40
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:42
|
||||
func streamuserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
|
||||
//line templates/common.qtpl:42
|
||||
qw422016.N().S(`
|
||||
<li class="navlinks__user">
|
||||
`)
|
||||
//line templates/common.qtpl:44
|
||||
if u.Group == user.UserAnon {
|
||||
//line templates/common.qtpl:44
|
||||
qw422016.N().S(`
|
||||
<a href="/login">Login</a>
|
||||
`)
|
||||
//line templates/common.qtpl:46
|
||||
} else {
|
||||
//line templates/common.qtpl:46
|
||||
qw422016.N().S(`
|
||||
<a href="/page/`)
|
||||
//line templates/common.qtpl:47
|
||||
qw422016.E().S(util.UserTree)
|
||||
//line templates/common.qtpl:47
|
||||
qw422016.N().S(`/`)
|
||||
//line templates/common.qtpl:47
|
||||
qw422016.E().S(u.Name)
|
||||
//line templates/common.qtpl:47
|
||||
qw422016.N().S(`">`)
|
||||
//line templates/common.qtpl:47
|
||||
qw422016.E().S(u.Name)
|
||||
//line templates/common.qtpl:47
|
||||
qw422016.N().S(`</a>
|
||||
`)
|
||||
//line templates/common.qtpl:48
|
||||
}
|
||||
//line templates/common.qtpl:48
|
||||
qw422016.N().S(`
|
||||
</li>
|
||||
`)
|
||||
//line templates/common.qtpl:50
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:50
|
||||
func writeuserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
|
||||
//line templates/common.qtpl:50
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/common.qtpl:50
|
||||
streamuserMenuHTML(qw422016, u)
|
||||
//line templates/common.qtpl:50
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/common.qtpl:50
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:50
|
||||
func userMenuHTML(u *user.User) string {
|
||||
//line templates/common.qtpl:50
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/common.qtpl:50
|
||||
writeuserMenuHTML(qb422016, u)
|
||||
//line templates/common.qtpl:50
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/common.qtpl:50
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/common.qtpl:50
|
||||
return qs422016
|
||||
//line templates/common.qtpl:50
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ 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%;}
|
||||
.navlinks__user {font-style:italic;}
|
||||
|
||||
.rc-entry { display: grid; list-style-type: none; padding: .25rem; background-color: #eee; grid-template-columns: 1fr 1fr; }
|
||||
.rc-entry__time { font-style: italic; }
|
||||
|
@ -62,37 +62,38 @@ 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%;}
|
||||
.navlinks__user {font-style:italic;}
|
||||
|
||||
.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:48
|
||||
//line templates/css.qtpl:49
|
||||
}
|
||||
|
||||
//line templates/css.qtpl:48
|
||||
//line templates/css.qtpl:49
|
||||
func WriteDefaultCSS(qq422016 qtio422016.Writer) {
|
||||
//line templates/css.qtpl:48
|
||||
//line templates/css.qtpl:49
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/css.qtpl:48
|
||||
//line templates/css.qtpl:49
|
||||
StreamDefaultCSS(qw422016)
|
||||
//line templates/css.qtpl:48
|
||||
//line templates/css.qtpl:49
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/css.qtpl:48
|
||||
//line templates/css.qtpl:49
|
||||
}
|
||||
|
||||
//line templates/css.qtpl:48
|
||||
//line templates/css.qtpl:49
|
||||
func DefaultCSS() string {
|
||||
//line templates/css.qtpl:48
|
||||
//line templates/css.qtpl:49
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/css.qtpl:48
|
||||
//line templates/css.qtpl:49
|
||||
WriteDefaultCSS(qb422016)
|
||||
//line templates/css.qtpl:48
|
||||
//line templates/css.qtpl:49
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/css.qtpl:48
|
||||
//line templates/css.qtpl:49
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/css.qtpl:48
|
||||
//line templates/css.qtpl:49
|
||||
return qs422016
|
||||
//line templates/css.qtpl:48
|
||||
//line templates/css.qtpl:49
|
||||
}
|
||||
|
@ -1,7 +1,9 @@
|
||||
{% import "net/http" %}
|
||||
|
||||
This dialog is to be shown to a user when they try to delete a hypha.
|
||||
{% func DeleteAskHTML(hyphaName string, isOld bool) %}
|
||||
{% func DeleteAskHTML(rq *http.Request, hyphaName string, isOld bool) %}
|
||||
<main>
|
||||
{%= navHTML(hyphaName, "delete-ask") %}
|
||||
{%= navHTML(rq, hyphaName, "delete-ask") %}
|
||||
{% if isOld %}
|
||||
<section>
|
||||
<h1>Delete {%s hyphaName %}?</h1>
|
||||
|
@ -1,151 +1,154 @@
|
||||
// Code generated by qtc from "delete.qtpl". DO NOT EDIT.
|
||||
// See https://github.com/valyala/quicktemplate for details.
|
||||
|
||||
// This dialog is to be shown to a user when they try to delete a hypha.
|
||||
|
||||
//line templates/delete.qtpl:2
|
||||
//line templates/delete.qtpl:1
|
||||
package templates
|
||||
|
||||
//line templates/delete.qtpl:2
|
||||
//line templates/delete.qtpl:1
|
||||
import "net/http"
|
||||
|
||||
// This dialog is to be shown to a user when they try to delete a hypha.
|
||||
|
||||
//line templates/delete.qtpl:4
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/delete.qtpl:2
|
||||
//line templates/delete.qtpl:4
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line templates/delete.qtpl:2
|
||||
func StreamDeleteAskHTML(qw422016 *qt422016.Writer, hyphaName string, isOld bool) {
|
||||
//line templates/delete.qtpl:2
|
||||
//line templates/delete.qtpl:4
|
||||
func StreamDeleteAskHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName string, isOld bool) {
|
||||
//line templates/delete.qtpl:4
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
`)
|
||||
//line templates/delete.qtpl:4
|
||||
streamnavHTML(qw422016, hyphaName, "delete-ask")
|
||||
//line templates/delete.qtpl:4
|
||||
//line templates/delete.qtpl:6
|
||||
streamnavHTML(qw422016, rq, hyphaName, "delete-ask")
|
||||
//line templates/delete.qtpl:6
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/delete.qtpl:5
|
||||
//line templates/delete.qtpl:7
|
||||
if isOld {
|
||||
//line templates/delete.qtpl:5
|
||||
//line templates/delete.qtpl:7
|
||||
qw422016.N().S(`
|
||||
<section>
|
||||
<h1>Delete `)
|
||||
//line templates/delete.qtpl:7
|
||||
//line templates/delete.qtpl:9
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/delete.qtpl:7
|
||||
//line templates/delete.qtpl:9
|
||||
qw422016.N().S(`?</h1>
|
||||
<p>Do you really want to delete hypha <em>`)
|
||||
//line templates/delete.qtpl:8
|
||||
//line templates/delete.qtpl:10
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/delete.qtpl:8
|
||||
//line templates/delete.qtpl:10
|
||||
qw422016.N().S(`</em>?</p>
|
||||
<p>In this version of MycorrhizaWiki you cannot undelete a deleted hypha but the history can still be accessed.</p>
|
||||
<p><a href="/delete-confirm/`)
|
||||
//line templates/delete.qtpl:10
|
||||
//line templates/delete.qtpl:12
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/delete.qtpl:10
|
||||
//line templates/delete.qtpl:12
|
||||
qw422016.N().S(`"><strong>Confirm</strong></a></p>
|
||||
<p><a href="/page/`)
|
||||
//line templates/delete.qtpl:11
|
||||
//line templates/delete.qtpl:13
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/delete.qtpl:11
|
||||
//line templates/delete.qtpl:13
|
||||
qw422016.N().S(`">Cancel</a></p>
|
||||
</section>
|
||||
`)
|
||||
//line templates/delete.qtpl:13
|
||||
//line templates/delete.qtpl:15
|
||||
} else {
|
||||
//line templates/delete.qtpl:13
|
||||
//line templates/delete.qtpl:15
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/delete.qtpl:14
|
||||
//line templates/delete.qtpl:16
|
||||
streamcannotDeleteDueToNonExistence(qw422016, hyphaName)
|
||||
//line templates/delete.qtpl:14
|
||||
//line templates/delete.qtpl:16
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/delete.qtpl:15
|
||||
//line templates/delete.qtpl:17
|
||||
}
|
||||
//line templates/delete.qtpl:15
|
||||
//line templates/delete.qtpl:17
|
||||
qw422016.N().S(`
|
||||
</main>
|
||||
`)
|
||||
//line templates/delete.qtpl:17
|
||||
//line templates/delete.qtpl:19
|
||||
}
|
||||
|
||||
//line templates/delete.qtpl:17
|
||||
func WriteDeleteAskHTML(qq422016 qtio422016.Writer, hyphaName string, isOld bool) {
|
||||
//line templates/delete.qtpl:17
|
||||
//line templates/delete.qtpl:19
|
||||
func WriteDeleteAskHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName string, isOld bool) {
|
||||
//line templates/delete.qtpl:19
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/delete.qtpl:17
|
||||
StreamDeleteAskHTML(qw422016, hyphaName, isOld)
|
||||
//line templates/delete.qtpl:17
|
||||
//line templates/delete.qtpl:19
|
||||
StreamDeleteAskHTML(qw422016, rq, hyphaName, isOld)
|
||||
//line templates/delete.qtpl:19
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/delete.qtpl:17
|
||||
//line templates/delete.qtpl:19
|
||||
}
|
||||
|
||||
//line templates/delete.qtpl:17
|
||||
func DeleteAskHTML(hyphaName string, isOld bool) string {
|
||||
//line templates/delete.qtpl:17
|
||||
//line templates/delete.qtpl:19
|
||||
func DeleteAskHTML(rq *http.Request, hyphaName string, isOld bool) string {
|
||||
//line templates/delete.qtpl:19
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/delete.qtpl:17
|
||||
WriteDeleteAskHTML(qb422016, hyphaName, isOld)
|
||||
//line templates/delete.qtpl:17
|
||||
//line templates/delete.qtpl:19
|
||||
WriteDeleteAskHTML(qb422016, rq, hyphaName, isOld)
|
||||
//line templates/delete.qtpl:19
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/delete.qtpl:17
|
||||
//line templates/delete.qtpl:19
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/delete.qtpl:17
|
||||
//line templates/delete.qtpl:19
|
||||
return qs422016
|
||||
//line templates/delete.qtpl:17
|
||||
//line templates/delete.qtpl:19
|
||||
}
|
||||
|
||||
//line templates/delete.qtpl:19
|
||||
//line templates/delete.qtpl:21
|
||||
func streamcannotDeleteDueToNonExistence(qw422016 *qt422016.Writer, hyphaName string) {
|
||||
//line templates/delete.qtpl:19
|
||||
//line templates/delete.qtpl:21
|
||||
qw422016.N().S(`
|
||||
<section>
|
||||
<h1>Cannot delete `)
|
||||
//line templates/delete.qtpl:21
|
||||
//line templates/delete.qtpl:23
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/delete.qtpl:21
|
||||
//line templates/delete.qtpl:23
|
||||
qw422016.N().S(`</h1>
|
||||
<p>This hypha does not exist.</p>
|
||||
<p><a href="/page/`)
|
||||
//line templates/delete.qtpl:23
|
||||
//line templates/delete.qtpl:25
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/delete.qtpl:23
|
||||
//line templates/delete.qtpl:25
|
||||
qw422016.N().S(`">Go back</a></p>
|
||||
</section>
|
||||
`)
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
}
|
||||
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
func writecannotDeleteDueToNonExistence(qq422016 qtio422016.Writer, hyphaName string) {
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
streamcannotDeleteDueToNonExistence(qw422016, hyphaName)
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
}
|
||||
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
func cannotDeleteDueToNonExistence(hyphaName string) string {
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
writecannotDeleteDueToNonExistence(qb422016, hyphaName)
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
return qs422016
|
||||
//line templates/delete.qtpl:25
|
||||
//line templates/delete.qtpl:27
|
||||
}
|
||||
|
@ -1,13 +1,16 @@
|
||||
{% func EditHTML(hyphaName, textAreaFill, warning string) %}
|
||||
<main class="edit">
|
||||
<h1>Edit {%s hyphaName %}</h1>
|
||||
{%s= warning %}
|
||||
<form method="post" class="edit-form"
|
||||
action="/upload-text/{%s hyphaName %}">
|
||||
<textarea name="text">{%s textAreaFill %}</textarea>
|
||||
<br/>
|
||||
<input type="submit"/>
|
||||
<a href="/page/{%s hyphaName %}">Cancel</a>
|
||||
</form>
|
||||
</main>
|
||||
{% import "net/http" %}
|
||||
|
||||
{% func EditHTML(rq *http.Request, hyphaName, textAreaFill, warning string) %}
|
||||
<main class="edit">
|
||||
{%s= navHTML(rq, hyphaName, "edit") %}
|
||||
<h1>Edit {%s hyphaName %}</h1>
|
||||
{%s= warning %}
|
||||
<form method="post" class="edit-form"
|
||||
action="/upload-text/{%s hyphaName %}">
|
||||
<textarea name="text">{%s textAreaFill %}</textarea>
|
||||
<br/>
|
||||
<input type="submit"/>
|
||||
<a href="/page/{%s hyphaName %}">Cancel</a>
|
||||
</form>
|
||||
</main>
|
||||
{% endfunc %}
|
||||
|
@ -5,79 +5,87 @@
|
||||
package templates
|
||||
|
||||
//line templates/http_mutators.qtpl:1
|
||||
import "net/http"
|
||||
|
||||
//line templates/http_mutators.qtpl:3
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/http_mutators.qtpl:1
|
||||
//line templates/http_mutators.qtpl:3
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line templates/http_mutators.qtpl:1
|
||||
func StreamEditHTML(qw422016 *qt422016.Writer, hyphaName, textAreaFill, warning string) {
|
||||
//line templates/http_mutators.qtpl:1
|
||||
qw422016.N().S(`
|
||||
<main class="edit">
|
||||
<h1>Edit `)
|
||||
//line templates/http_mutators.qtpl:3
|
||||
qw422016.E().S(hyphaName)
|
||||
func StreamEditHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, textAreaFill, warning string) {
|
||||
//line templates/http_mutators.qtpl:3
|
||||
qw422016.N().S(`</h1>
|
||||
`)
|
||||
//line templates/http_mutators.qtpl:4
|
||||
qw422016.N().S(warning)
|
||||
//line templates/http_mutators.qtpl:4
|
||||
qw422016.N().S(`
|
||||
<form method="post" class="edit-form"
|
||||
action="/upload-text/`)
|
||||
//line templates/http_mutators.qtpl:6
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_mutators.qtpl:6
|
||||
qw422016.N().S(`">
|
||||
<textarea name="text">`)
|
||||
//line templates/http_mutators.qtpl:7
|
||||
qw422016.E().S(textAreaFill)
|
||||
//line templates/http_mutators.qtpl:7
|
||||
qw422016.N().S(`</textarea>
|
||||
<br/>
|
||||
<input type="submit"/>
|
||||
<a href="/page/`)
|
||||
//line templates/http_mutators.qtpl:10
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_mutators.qtpl:10
|
||||
qw422016.N().S(`">Cancel</a>
|
||||
</form>
|
||||
</main>
|
||||
<main class="edit">
|
||||
`)
|
||||
//line templates/http_mutators.qtpl:5
|
||||
qw422016.N().S(navHTML(rq, hyphaName, "edit"))
|
||||
//line templates/http_mutators.qtpl:5
|
||||
qw422016.N().S(`
|
||||
<h1>Edit `)
|
||||
//line templates/http_mutators.qtpl:6
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_mutators.qtpl:6
|
||||
qw422016.N().S(`</h1>
|
||||
`)
|
||||
//line templates/http_mutators.qtpl:7
|
||||
qw422016.N().S(warning)
|
||||
//line templates/http_mutators.qtpl:7
|
||||
qw422016.N().S(`
|
||||
<form method="post" class="edit-form"
|
||||
action="/upload-text/`)
|
||||
//line templates/http_mutators.qtpl:9
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_mutators.qtpl:9
|
||||
qw422016.N().S(`">
|
||||
<textarea name="text">`)
|
||||
//line templates/http_mutators.qtpl:10
|
||||
qw422016.E().S(textAreaFill)
|
||||
//line templates/http_mutators.qtpl:10
|
||||
qw422016.N().S(`</textarea>
|
||||
<br/>
|
||||
<input type="submit"/>
|
||||
<a href="/page/`)
|
||||
//line templates/http_mutators.qtpl:13
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_mutators.qtpl:13
|
||||
qw422016.N().S(`">Cancel</a>
|
||||
</form>
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_mutators.qtpl:16
|
||||
}
|
||||
|
||||
//line templates/http_mutators.qtpl:13
|
||||
func WriteEditHTML(qq422016 qtio422016.Writer, hyphaName, textAreaFill, warning string) {
|
||||
//line templates/http_mutators.qtpl:13
|
||||
//line templates/http_mutators.qtpl:16
|
||||
func WriteEditHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, textAreaFill, warning string) {
|
||||
//line templates/http_mutators.qtpl:16
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_mutators.qtpl:13
|
||||
StreamEditHTML(qw422016, hyphaName, textAreaFill, warning)
|
||||
//line templates/http_mutators.qtpl:13
|
||||
//line templates/http_mutators.qtpl:16
|
||||
StreamEditHTML(qw422016, rq, hyphaName, textAreaFill, warning)
|
||||
//line templates/http_mutators.qtpl:16
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_mutators.qtpl:13
|
||||
//line templates/http_mutators.qtpl:16
|
||||
}
|
||||
|
||||
//line templates/http_mutators.qtpl:13
|
||||
func EditHTML(hyphaName, textAreaFill, warning string) string {
|
||||
//line templates/http_mutators.qtpl:13
|
||||
//line templates/http_mutators.qtpl:16
|
||||
func EditHTML(rq *http.Request, hyphaName, textAreaFill, warning string) string {
|
||||
//line templates/http_mutators.qtpl:16
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_mutators.qtpl:13
|
||||
WriteEditHTML(qb422016, hyphaName, textAreaFill, warning)
|
||||
//line templates/http_mutators.qtpl:13
|
||||
//line templates/http_mutators.qtpl:16
|
||||
WriteEditHTML(qb422016, rq, hyphaName, textAreaFill, warning)
|
||||
//line templates/http_mutators.qtpl:16
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_mutators.qtpl:13
|
||||
//line templates/http_mutators.qtpl:16
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_mutators.qtpl:13
|
||||
//line templates/http_mutators.qtpl:16
|
||||
return qs422016
|
||||
//line templates/http_mutators.qtpl:13
|
||||
//line templates/http_mutators.qtpl:16
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
{% func HistoryHTML(hyphaName, tbody string) %}
|
||||
{% import "net/http" %}
|
||||
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||
|
||||
{% func HistoryHTML(rq *http.Request, hyphaName, tbody string) %}
|
||||
<main>
|
||||
{%= navHTML(hyphaName, "history") %}
|
||||
{%= navHTML(rq, hyphaName, "history") %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@ -16,9 +19,9 @@
|
||||
</main>
|
||||
{% endfunc %}
|
||||
|
||||
{% func RevisionHTML(hyphaName, naviTitle, contents, tree, revHash string) %}
|
||||
{% func RevisionHTML(rq *http.Request, hyphaName, naviTitle, contents, tree, revHash string) %}
|
||||
<main>
|
||||
{%= navHTML(hyphaName, "revision", revHash) %}
|
||||
{%= navHTML(rq, hyphaName, "revision", revHash) %}
|
||||
<article>
|
||||
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
|
||||
{%s= naviTitle %}
|
||||
@ -32,9 +35,9 @@
|
||||
{% endfunc %}
|
||||
|
||||
If `contents` == "", a helpful message is shown instead.
|
||||
{% func PageHTML(hyphaName, naviTitle, contents, tree string) %}
|
||||
{% func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, tree string) %}
|
||||
<main>
|
||||
{%= navHTML(hyphaName, "page") %}
|
||||
{%= navHTML(rq, hyphaName, "page") %}
|
||||
<article>
|
||||
{%s= naviTitle %}
|
||||
{% if contents == "" %}
|
||||
@ -44,6 +47,7 @@ If `contents` == "", a helpful message is shown instead.
|
||||
{% endif %}
|
||||
</article>
|
||||
<hr/>
|
||||
{% if u := user.FromRequest(rq).OrAnon(); u.Group > user.UserAnon %}
|
||||
<form action="/upload-binary/{%s hyphaName %}"
|
||||
method="post" enctype="multipart/form-data">
|
||||
<label for="upload-binary__input">Upload new binary part</label>
|
||||
@ -52,6 +56,7 @@ If `contents` == "", a helpful message is shown instead.
|
||||
<input type="submit"/>
|
||||
</form>
|
||||
<hr/>
|
||||
{% endif %}
|
||||
<aside>
|
||||
{%s= tree %}
|
||||
</aside>
|
||||
|
@ -5,27 +5,33 @@
|
||||
package templates
|
||||
|
||||
//line templates/http_readers.qtpl:1
|
||||
import "net/http"
|
||||
|
||||
//line templates/http_readers.qtpl:2
|
||||
import "github.com/bouncepaw/mycorrhiza/user"
|
||||
|
||||
//line templates/http_readers.qtpl:4
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/http_readers.qtpl:1
|
||||
//line templates/http_readers.qtpl:4
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line templates/http_readers.qtpl:1
|
||||
func StreamHistoryHTML(qw422016 *qt422016.Writer, hyphaName, tbody string) {
|
||||
//line templates/http_readers.qtpl:1
|
||||
//line templates/http_readers.qtpl:4
|
||||
func StreamHistoryHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, tbody string) {
|
||||
//line templates/http_readers.qtpl:4
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:3
|
||||
streamnavHTML(qw422016, hyphaName, "history")
|
||||
//line templates/http_readers.qtpl:3
|
||||
//line templates/http_readers.qtpl:6
|
||||
streamnavHTML(qw422016, rq, hyphaName, "history")
|
||||
//line templates/http_readers.qtpl:6
|
||||
qw422016.N().S(`
|
||||
<table>
|
||||
<thead>
|
||||
@ -37,155 +43,160 @@ func StreamHistoryHTML(qw422016 *qt422016.Writer, hyphaName, tbody string) {
|
||||
</thead>
|
||||
<tbody>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:13
|
||||
//line templates/http_readers.qtpl:16
|
||||
qw422016.N().S(tbody)
|
||||
//line templates/http_readers.qtpl:13
|
||||
//line templates/http_readers.qtpl:16
|
||||
qw422016.N().S(`
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:17
|
||||
//line templates/http_readers.qtpl:20
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:17
|
||||
func WriteHistoryHTML(qq422016 qtio422016.Writer, hyphaName, tbody string) {
|
||||
//line templates/http_readers.qtpl:17
|
||||
//line templates/http_readers.qtpl:20
|
||||
func WriteHistoryHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, tbody string) {
|
||||
//line templates/http_readers.qtpl:20
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_readers.qtpl:17
|
||||
StreamHistoryHTML(qw422016, hyphaName, tbody)
|
||||
//line templates/http_readers.qtpl:17
|
||||
//line templates/http_readers.qtpl:20
|
||||
StreamHistoryHTML(qw422016, rq, hyphaName, tbody)
|
||||
//line templates/http_readers.qtpl:20
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_readers.qtpl:17
|
||||
//line templates/http_readers.qtpl:20
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:17
|
||||
func HistoryHTML(hyphaName, tbody string) string {
|
||||
//line templates/http_readers.qtpl:17
|
||||
//line templates/http_readers.qtpl:20
|
||||
func HistoryHTML(rq *http.Request, hyphaName, tbody string) string {
|
||||
//line templates/http_readers.qtpl:20
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_readers.qtpl:17
|
||||
WriteHistoryHTML(qb422016, hyphaName, tbody)
|
||||
//line templates/http_readers.qtpl:17
|
||||
//line templates/http_readers.qtpl:20
|
||||
WriteHistoryHTML(qb422016, rq, hyphaName, tbody)
|
||||
//line templates/http_readers.qtpl:20
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_readers.qtpl:17
|
||||
//line templates/http_readers.qtpl:20
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_readers.qtpl:17
|
||||
//line templates/http_readers.qtpl:20
|
||||
return qs422016
|
||||
//line templates/http_readers.qtpl:17
|
||||
//line templates/http_readers.qtpl:20
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:19
|
||||
func StreamRevisionHTML(qw422016 *qt422016.Writer, hyphaName, naviTitle, contents, tree, revHash string) {
|
||||
//line templates/http_readers.qtpl:19
|
||||
//line templates/http_readers.qtpl:22
|
||||
func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, tree, revHash string) {
|
||||
//line templates/http_readers.qtpl:22
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:21
|
||||
streamnavHTML(qw422016, hyphaName, "revision", revHash)
|
||||
//line templates/http_readers.qtpl:21
|
||||
//line templates/http_readers.qtpl:24
|
||||
streamnavHTML(qw422016, rq, hyphaName, "revision", revHash)
|
||||
//line templates/http_readers.qtpl:24
|
||||
qw422016.N().S(`
|
||||
<article>
|
||||
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:27
|
||||
qw422016.N().S(naviTitle)
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:27
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:25
|
||||
//line templates/http_readers.qtpl:28
|
||||
qw422016.N().S(contents)
|
||||
//line templates/http_readers.qtpl:25
|
||||
//line templates/http_readers.qtpl:28
|
||||
qw422016.N().S(`
|
||||
</article>
|
||||
<hr/>
|
||||
<aside>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:29
|
||||
//line templates/http_readers.qtpl:32
|
||||
qw422016.N().S(tree)
|
||||
//line templates/http_readers.qtpl:29
|
||||
//line templates/http_readers.qtpl:32
|
||||
qw422016.N().S(`
|
||||
</aside>
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:32
|
||||
//line templates/http_readers.qtpl:35
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:32
|
||||
func WriteRevisionHTML(qq422016 qtio422016.Writer, hyphaName, naviTitle, contents, tree, revHash string) {
|
||||
//line templates/http_readers.qtpl:32
|
||||
//line templates/http_readers.qtpl:35
|
||||
func WriteRevisionHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, tree, revHash string) {
|
||||
//line templates/http_readers.qtpl:35
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_readers.qtpl:32
|
||||
StreamRevisionHTML(qw422016, hyphaName, naviTitle, contents, tree, revHash)
|
||||
//line templates/http_readers.qtpl:32
|
||||
//line templates/http_readers.qtpl:35
|
||||
StreamRevisionHTML(qw422016, rq, hyphaName, naviTitle, contents, tree, revHash)
|
||||
//line templates/http_readers.qtpl:35
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_readers.qtpl:32
|
||||
//line templates/http_readers.qtpl:35
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:32
|
||||
func RevisionHTML(hyphaName, naviTitle, contents, tree, revHash string) string {
|
||||
//line templates/http_readers.qtpl:32
|
||||
//line templates/http_readers.qtpl:35
|
||||
func RevisionHTML(rq *http.Request, hyphaName, naviTitle, contents, tree, revHash string) string {
|
||||
//line templates/http_readers.qtpl:35
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_readers.qtpl:32
|
||||
WriteRevisionHTML(qb422016, hyphaName, naviTitle, contents, tree, revHash)
|
||||
//line templates/http_readers.qtpl:32
|
||||
//line templates/http_readers.qtpl:35
|
||||
WriteRevisionHTML(qb422016, rq, hyphaName, naviTitle, contents, tree, revHash)
|
||||
//line templates/http_readers.qtpl:35
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_readers.qtpl:32
|
||||
//line templates/http_readers.qtpl:35
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_readers.qtpl:32
|
||||
//line templates/http_readers.qtpl:35
|
||||
return qs422016
|
||||
//line templates/http_readers.qtpl:32
|
||||
//line templates/http_readers.qtpl:35
|
||||
}
|
||||
|
||||
// If `contents` == "", a helpful message is shown instead.
|
||||
|
||||
//line templates/http_readers.qtpl:35
|
||||
func StreamPageHTML(qw422016 *qt422016.Writer, hyphaName, naviTitle, contents, tree string) {
|
||||
//line templates/http_readers.qtpl:35
|
||||
//line templates/http_readers.qtpl:38
|
||||
func StreamPageHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, tree string) {
|
||||
//line templates/http_readers.qtpl:38
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:37
|
||||
streamnavHTML(qw422016, hyphaName, "page")
|
||||
//line templates/http_readers.qtpl:37
|
||||
//line templates/http_readers.qtpl:40
|
||||
streamnavHTML(qw422016, rq, hyphaName, "page")
|
||||
//line templates/http_readers.qtpl:40
|
||||
qw422016.N().S(`
|
||||
<article>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:39
|
||||
//line templates/http_readers.qtpl:42
|
||||
qw422016.N().S(naviTitle)
|
||||
//line templates/http_readers.qtpl:39
|
||||
//line templates/http_readers.qtpl:42
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:40
|
||||
//line templates/http_readers.qtpl:43
|
||||
if contents == "" {
|
||||
//line templates/http_readers.qtpl:40
|
||||
//line templates/http_readers.qtpl:43
|
||||
qw422016.N().S(`
|
||||
<p>This hypha has no text. Why not <a href="/edit/`)
|
||||
//line templates/http_readers.qtpl:41
|
||||
//line templates/http_readers.qtpl:44
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:41
|
||||
//line templates/http_readers.qtpl:44
|
||||
qw422016.N().S(`">create it</a>?</p>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:42
|
||||
//line templates/http_readers.qtpl:45
|
||||
} else {
|
||||
//line templates/http_readers.qtpl:42
|
||||
//line templates/http_readers.qtpl:45
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:43
|
||||
//line templates/http_readers.qtpl:46
|
||||
qw422016.N().S(contents)
|
||||
//line templates/http_readers.qtpl:43
|
||||
//line templates/http_readers.qtpl:46
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:44
|
||||
//line templates/http_readers.qtpl:47
|
||||
}
|
||||
//line templates/http_readers.qtpl:44
|
||||
//line templates/http_readers.qtpl:47
|
||||
qw422016.N().S(`
|
||||
</article>
|
||||
<hr/>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:50
|
||||
if u := user.FromRequest(rq).OrAnon(); u.Group > user.UserAnon {
|
||||
//line templates/http_readers.qtpl:50
|
||||
qw422016.N().S(`
|
||||
<form action="/upload-binary/`)
|
||||
//line templates/http_readers.qtpl:47
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:47
|
||||
qw422016.N().S(`"
|
||||
//line templates/http_readers.qtpl:51
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:51
|
||||
qw422016.N().S(`"
|
||||
method="post" enctype="multipart/form-data">
|
||||
<label for="upload-binary__input">Upload new binary part</label>
|
||||
<br>
|
||||
@ -193,40 +204,45 @@ func StreamPageHTML(qw422016 *qt422016.Writer, hyphaName, naviTitle, contents, t
|
||||
<input type="submit"/>
|
||||
</form>
|
||||
<hr/>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:59
|
||||
}
|
||||
//line templates/http_readers.qtpl:59
|
||||
qw422016.N().S(`
|
||||
<aside>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:56
|
||||
//line templates/http_readers.qtpl:61
|
||||
qw422016.N().S(tree)
|
||||
//line templates/http_readers.qtpl:56
|
||||
//line templates/http_readers.qtpl:61
|
||||
qw422016.N().S(`
|
||||
</aside>
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:59
|
||||
//line templates/http_readers.qtpl:64
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:59
|
||||
func WritePageHTML(qq422016 qtio422016.Writer, hyphaName, naviTitle, contents, tree string) {
|
||||
//line templates/http_readers.qtpl:59
|
||||
//line templates/http_readers.qtpl:64
|
||||
func WritePageHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, naviTitle, contents, tree string) {
|
||||
//line templates/http_readers.qtpl:64
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_readers.qtpl:59
|
||||
StreamPageHTML(qw422016, hyphaName, naviTitle, contents, tree)
|
||||
//line templates/http_readers.qtpl:59
|
||||
//line templates/http_readers.qtpl:64
|
||||
StreamPageHTML(qw422016, rq, hyphaName, naviTitle, contents, tree)
|
||||
//line templates/http_readers.qtpl:64
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_readers.qtpl:59
|
||||
//line templates/http_readers.qtpl:64
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:59
|
||||
func PageHTML(hyphaName, naviTitle, contents, tree string) string {
|
||||
//line templates/http_readers.qtpl:59
|
||||
//line templates/http_readers.qtpl:64
|
||||
func PageHTML(rq *http.Request, hyphaName, naviTitle, contents, tree string) string {
|
||||
//line templates/http_readers.qtpl:64
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_readers.qtpl:59
|
||||
WritePageHTML(qb422016, hyphaName, naviTitle, contents, tree)
|
||||
//line templates/http_readers.qtpl:59
|
||||
//line templates/http_readers.qtpl:64
|
||||
WritePageHTML(qb422016, rq, hyphaName, naviTitle, contents, tree)
|
||||
//line templates/http_readers.qtpl:64
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_readers.qtpl:59
|
||||
//line templates/http_readers.qtpl:64
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_readers.qtpl:59
|
||||
//line templates/http_readers.qtpl:64
|
||||
return qs422016
|
||||
//line templates/http_readers.qtpl:59
|
||||
//line templates/http_readers.qtpl:64
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
{% import "net/http" %}
|
||||
This dialog is to be shown to a user when they try to rename a hypha.
|
||||
{% func RenameAskHTML(hyphaName string, isOld bool) %}
|
||||
{% func RenameAskHTML(rq *http.Request, hyphaName string, isOld bool) %}
|
||||
<main>
|
||||
{%= navHTML(hyphaName, "rename-ask") %}
|
||||
{%= navHTML(rq, hyphaName, "rename-ask") %}
|
||||
{%- if isOld -%}
|
||||
<section>
|
||||
<h1>Rename {%s hyphaName %}</h1>
|
||||
|
@ -1,55 +1,58 @@
|
||||
// Code generated by qtc from "rename.qtpl". DO NOT EDIT.
|
||||
// See https://github.com/valyala/quicktemplate for details.
|
||||
|
||||
// This dialog is to be shown to a user when they try to rename a hypha.
|
||||
|
||||
//line templates/rename.qtpl:2
|
||||
//line templates/rename.qtpl:1
|
||||
package templates
|
||||
|
||||
//line templates/rename.qtpl:2
|
||||
//line templates/rename.qtpl:1
|
||||
import "net/http"
|
||||
|
||||
// This dialog is to be shown to a user when they try to rename a hypha.
|
||||
|
||||
//line templates/rename.qtpl:3
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/rename.qtpl:2
|
||||
//line templates/rename.qtpl:3
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line templates/rename.qtpl:2
|
||||
func StreamRenameAskHTML(qw422016 *qt422016.Writer, hyphaName string, isOld bool) {
|
||||
//line templates/rename.qtpl:2
|
||||
//line templates/rename.qtpl:3
|
||||
func StreamRenameAskHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName string, isOld bool) {
|
||||
//line templates/rename.qtpl:3
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
`)
|
||||
//line templates/rename.qtpl:4
|
||||
streamnavHTML(qw422016, hyphaName, "rename-ask")
|
||||
//line templates/rename.qtpl:4
|
||||
//line templates/rename.qtpl:5
|
||||
streamnavHTML(qw422016, rq, hyphaName, "rename-ask")
|
||||
//line templates/rename.qtpl:5
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/rename.qtpl:5
|
||||
//line templates/rename.qtpl:6
|
||||
if isOld {
|
||||
//line templates/rename.qtpl:5
|
||||
//line templates/rename.qtpl:6
|
||||
qw422016.N().S(` <section>
|
||||
<h1>Rename `)
|
||||
//line templates/rename.qtpl:7
|
||||
//line templates/rename.qtpl:8
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/rename.qtpl:7
|
||||
//line templates/rename.qtpl:8
|
||||
qw422016.N().S(`</h1>
|
||||
<form action="/rename-confirm/`)
|
||||
//line templates/rename.qtpl:8
|
||||
//line templates/rename.qtpl:9
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/rename.qtpl:8
|
||||
//line templates/rename.qtpl:9
|
||||
qw422016.N().S(`" method="post" enctype="multipart/form-data">
|
||||
<fieldset>
|
||||
<legend>New name</legend>
|
||||
<input type="text" value="`)
|
||||
//line templates/rename.qtpl:11
|
||||
//line templates/rename.qtpl:12
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/rename.qtpl:11
|
||||
//line templates/rename.qtpl:12
|
||||
qw422016.N().S(`" required autofocus id="new-name" name="new-name"/>
|
||||
</fieldset>
|
||||
|
||||
@ -64,92 +67,92 @@ func StreamRenameAskHTML(qw422016 *qt422016.Writer, hyphaName string, isOld bool
|
||||
</form>
|
||||
</section>
|
||||
`)
|
||||
//line templates/rename.qtpl:24
|
||||
//line templates/rename.qtpl:25
|
||||
} else {
|
||||
//line templates/rename.qtpl:24
|
||||
//line templates/rename.qtpl:25
|
||||
qw422016.N().S(` `)
|
||||
//line templates/rename.qtpl:25
|
||||
//line templates/rename.qtpl:26
|
||||
streamcannotRenameDueToNonExistence(qw422016, hyphaName)
|
||||
//line templates/rename.qtpl:25
|
||||
//line templates/rename.qtpl:26
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/rename.qtpl:26
|
||||
//line templates/rename.qtpl:27
|
||||
}
|
||||
//line templates/rename.qtpl:26
|
||||
//line templates/rename.qtpl:27
|
||||
qw422016.N().S(`</main>
|
||||
`)
|
||||
//line templates/rename.qtpl:28
|
||||
//line templates/rename.qtpl:29
|
||||
}
|
||||
|
||||
//line templates/rename.qtpl:28
|
||||
func WriteRenameAskHTML(qq422016 qtio422016.Writer, hyphaName string, isOld bool) {
|
||||
//line templates/rename.qtpl:28
|
||||
//line templates/rename.qtpl:29
|
||||
func WriteRenameAskHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName string, isOld bool) {
|
||||
//line templates/rename.qtpl:29
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/rename.qtpl:28
|
||||
StreamRenameAskHTML(qw422016, hyphaName, isOld)
|
||||
//line templates/rename.qtpl:28
|
||||
//line templates/rename.qtpl:29
|
||||
StreamRenameAskHTML(qw422016, rq, hyphaName, isOld)
|
||||
//line templates/rename.qtpl:29
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/rename.qtpl:28
|
||||
//line templates/rename.qtpl:29
|
||||
}
|
||||
|
||||
//line templates/rename.qtpl:28
|
||||
func RenameAskHTML(hyphaName string, isOld bool) string {
|
||||
//line templates/rename.qtpl:28
|
||||
//line templates/rename.qtpl:29
|
||||
func RenameAskHTML(rq *http.Request, hyphaName string, isOld bool) string {
|
||||
//line templates/rename.qtpl:29
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/rename.qtpl:28
|
||||
WriteRenameAskHTML(qb422016, hyphaName, isOld)
|
||||
//line templates/rename.qtpl:28
|
||||
//line templates/rename.qtpl:29
|
||||
WriteRenameAskHTML(qb422016, rq, hyphaName, isOld)
|
||||
//line templates/rename.qtpl:29
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/rename.qtpl:28
|
||||
//line templates/rename.qtpl:29
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/rename.qtpl:28
|
||||
//line templates/rename.qtpl:29
|
||||
return qs422016
|
||||
//line templates/rename.qtpl:28
|
||||
//line templates/rename.qtpl:29
|
||||
}
|
||||
|
||||
//line templates/rename.qtpl:30
|
||||
//line templates/rename.qtpl:31
|
||||
func streamcannotRenameDueToNonExistence(qw422016 *qt422016.Writer, hyphaName string) {
|
||||
//line templates/rename.qtpl:30
|
||||
//line templates/rename.qtpl:31
|
||||
qw422016.N().S(`
|
||||
<section>
|
||||
<h1>Cannot rename `)
|
||||
//line templates/rename.qtpl:32
|
||||
//line templates/rename.qtpl:33
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/rename.qtpl:32
|
||||
//line templates/rename.qtpl:33
|
||||
qw422016.N().S(`</h1>
|
||||
<p>This hypha does not exist.</p>
|
||||
<p><a href="/page/`)
|
||||
//line templates/rename.qtpl:34
|
||||
//line templates/rename.qtpl:35
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/rename.qtpl:34
|
||||
//line templates/rename.qtpl:35
|
||||
qw422016.N().S(`">Go back</a></p>
|
||||
</section>
|
||||
`)
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
}
|
||||
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
func writecannotRenameDueToNonExistence(qq422016 qtio422016.Writer, hyphaName string) {
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
streamcannotRenameDueToNonExistence(qw422016, hyphaName)
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
}
|
||||
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
func cannotRenameDueToNonExistence(hyphaName string) string {
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
writecannotRenameDueToNonExistence(qb422016, hyphaName)
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
return qs422016
|
||||
//line templates/rename.qtpl:36
|
||||
//line templates/rename.qtpl:37
|
||||
}
|
||||
|
@ -8,6 +8,13 @@ import (
|
||||
"github.com/bouncepaw/mycorrhiza/util"
|
||||
)
|
||||
|
||||
func (u *User) OrAnon() *User {
|
||||
if u == nil {
|
||||
return &User{}
|
||||
}
|
||||
return u
|
||||
}
|
||||
|
||||
func LogoutFromRequest(w http.ResponseWriter, rq *http.Request) {
|
||||
cookieFromUser, err := rq.Cookie("mycorrhiza_token")
|
||||
if err == nil {
|
||||
|
Loading…
Reference in New Issue
Block a user