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