mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-13 05:50:27 +00:00
Add the attachment tab
This commit is contained in:
parent
22420bf690
commit
a8a2735363
@ -23,7 +23,11 @@ func StreamDefaultCSS(qw422016 *qt422016.Writer) {
|
|||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line assets/assets.qtpl:2
|
//line assets/assets.qtpl:2
|
||||||
qw422016.N().S(`.modal__title { font-size: 2rem; }
|
qw422016.N().S(`.amnt-grid { display: grid; grid-template-columns: 1fr 1fr; }
|
||||||
|
.upload-binary__input { display: block; margin: .25rem 0; }
|
||||||
|
|
||||||
|
.modal__title { font-size: 2rem; }
|
||||||
|
.modal__title_small { font-size: 1.5rem; }
|
||||||
.modal__confirmation-msg { margin: 0 0 .5rem 0; }
|
.modal__confirmation-msg { margin: 0 0 .5rem 0; }
|
||||||
.modal__action { display: inline-block; font-size: 1rem; padding: .25rem; border-radius: .25rem; }
|
.modal__action { display: inline-block; font-size: 1rem; padding: .25rem; border-radius: .25rem; }
|
||||||
.modal__submit { border: 1px #999 solid; }
|
.modal__submit { border: 1px #999 solid; }
|
||||||
@ -56,6 +60,7 @@ header { width: 100%; margin-bottom: 1rem; }
|
|||||||
.backlinks__link { text-decoration: none; display: block; padding: .25rem; padding-left: 1.25rem; }
|
.backlinks__link { text-decoration: none; display: block; padding: .25rem; padding-left: 1.25rem; }
|
||||||
|
|
||||||
@media screen and (max-width: 800px) {
|
@media screen and (max-width: 800px) {
|
||||||
|
.amnt-grid { grid-template-columns: 1fr; }
|
||||||
.layout { grid-template-column: auto; grid-template-row: auto auto auto; }
|
.layout { grid-template-column: auto; grid-template-row: auto auto auto; }
|
||||||
.main-width { width: 100%; }
|
.main-width { width: 100%; }
|
||||||
main { padding: 1rem; margin: 0; }
|
main { padding: 1rem; margin: 0; }
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
|
.amnt-grid { display: grid; grid-template-columns: 1fr 1fr; }
|
||||||
|
.upload-binary__input { display: block; margin: .25rem 0; }
|
||||||
|
|
||||||
.modal__title { font-size: 2rem; }
|
.modal__title { font-size: 2rem; }
|
||||||
|
.modal__title_small { font-size: 1.5rem; }
|
||||||
.modal__confirmation-msg { margin: 0 0 .5rem 0; }
|
.modal__confirmation-msg { margin: 0 0 .5rem 0; }
|
||||||
.modal__action { display: inline-block; font-size: 1rem; padding: .25rem; border-radius: .25rem; }
|
.modal__action { display: inline-block; font-size: 1rem; padding: .25rem; border-radius: .25rem; }
|
||||||
.modal__submit { border: 1px #999 solid; }
|
.modal__submit { border: 1px #999 solid; }
|
||||||
@ -31,6 +35,7 @@ header { width: 100%; margin-bottom: 1rem; }
|
|||||||
.backlinks__link { text-decoration: none; display: block; padding: .25rem; padding-left: 1.25rem; }
|
.backlinks__link { text-decoration: none; display: block; padding: .25rem; padding-left: 1.25rem; }
|
||||||
|
|
||||||
@media screen and (max-width: 800px) {
|
@media screen and (max-width: 800px) {
|
||||||
|
.amnt-grid { grid-template-columns: 1fr; }
|
||||||
.layout { grid-template-column: auto; grid-template-row: auto auto auto; }
|
.layout { grid-template-column: auto; grid-template-row: auto auto auto; }
|
||||||
.main-width { width: 100%; }
|
.main-width { width: 100%; }
|
||||||
main { padding: 1rem; margin: 0; }
|
main { padding: 1rem; margin: 0; }
|
||||||
|
@ -24,6 +24,21 @@ func init() {
|
|||||||
http.HandleFunc("/text/", handlerText)
|
http.HandleFunc("/text/", handlerText)
|
||||||
http.HandleFunc("/binary/", handlerBinary)
|
http.HandleFunc("/binary/", handlerBinary)
|
||||||
http.HandleFunc("/rev/", handlerRevision)
|
http.HandleFunc("/rev/", handlerRevision)
|
||||||
|
http.HandleFunc("/attachment/", handlerAttachment)
|
||||||
|
}
|
||||||
|
|
||||||
|
func handlerAttachment(w http.ResponseWriter, rq *http.Request) {
|
||||||
|
log.Println(rq.URL)
|
||||||
|
var (
|
||||||
|
hyphaName = HyphaNameFromRq(rq, "attachment")
|
||||||
|
h = hyphae.ByName(hyphaName)
|
||||||
|
u = user.FromRequest(rq)
|
||||||
|
)
|
||||||
|
util.HTTP200Page(w,
|
||||||
|
views.BaseHTML(
|
||||||
|
fmt.Sprintf("Attachment of %s", util.BeautifulName(hyphaName)),
|
||||||
|
views.AttachmentMenuHTML(rq, h, u),
|
||||||
|
u))
|
||||||
}
|
}
|
||||||
|
|
||||||
// handlerRevision displays a specific revision of text part a page
|
// handlerRevision displays a specific revision of text part a page
|
||||||
|
2
main.go
2
main.go
@ -178,7 +178,7 @@ func main() {
|
|||||||
|
|
||||||
// See http_admin.go for /admin, /admin/*
|
// See http_admin.go for /admin, /admin/*
|
||||||
initAdmin()
|
initAdmin()
|
||||||
// See http_readers.go for /page/, /hypha/, /text/, /binary/
|
// See http_readers.go for /page/, /hypha/, /text/, /binary/, /attachment/
|
||||||
// See http_mutators.go for /upload-binary/, /upload-text/, /edit/, /delete-ask/, /delete-confirm/, /rename-ask/, /rename-confirm/, /unattach-ask/, /unattach-confirm/
|
// See http_mutators.go for /upload-binary/, /upload-text/, /edit/, /delete-ask/, /delete-confirm/, /rename-ask/, /rename-confirm/, /unattach-ask/, /unattach-confirm/
|
||||||
// See http_auth.go for /login, /login-data, /logout, /logout-confirm
|
// See http_auth.go for /login, /login-data, /logout, /logout-confirm
|
||||||
// See http_history.go for /history/, /recent-changes
|
// See http_history.go for /history/, /recent-changes
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
{% func UnattachAskHTML(rq *http.Request, hyphaName string, isOld bool) %}
|
{% func UnattachAskHTML(rq *http.Request, hyphaName string, isOld bool) %}
|
||||||
{%= NavHTML(rq, hyphaName, "unattach-ask") %}
|
{%= NavHTML(rq, hyphaName, "unattach-ask") %}
|
||||||
{%= modalBegin(
|
{%= modalBegin(
|
||||||
"unattach-confirm",
|
"unattach",
|
||||||
hyphaName,
|
hyphaName,
|
||||||
"",
|
"",
|
||||||
"Unattach "+util.BeautifulName(hyphaName)+"?") %}
|
"Unattach "+util.BeautifulName(hyphaName)+"?") %}
|
||||||
|
@ -94,7 +94,7 @@ func StreamUnattachAskHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaNam
|
|||||||
`)
|
`)
|
||||||
//line views/modal.qtpl:18
|
//line views/modal.qtpl:18
|
||||||
streammodalBegin(qw422016,
|
streammodalBegin(qw422016,
|
||||||
"unattach-confirm",
|
"unattach",
|
||||||
hyphaName,
|
hyphaName,
|
||||||
"",
|
"",
|
||||||
"Unattach "+util.BeautifulName(hyphaName)+"?")
|
"Unattach "+util.BeautifulName(hyphaName)+"?")
|
||||||
|
@ -12,6 +12,7 @@ type navEntry struct {
|
|||||||
var navEntries = []navEntry{
|
var navEntries = []navEntry{
|
||||||
{"page", "Hypha"},
|
{"page", "Hypha"},
|
||||||
{"edit", "Edit"},
|
{"edit", "Edit"},
|
||||||
|
{"attachment", "Attachment"},
|
||||||
{"history", "History"},
|
{"history", "History"},
|
||||||
{"revision", "NOT REACHED"},
|
{"revision", "NOT REACHED"},
|
||||||
{"rename-ask", "Rename"},
|
{"rename-ask", "Rename"},
|
||||||
|
@ -40,6 +40,7 @@ type navEntry struct {
|
|||||||
var navEntries = []navEntry{
|
var navEntries = []navEntry{
|
||||||
{"page", "Hypha"},
|
{"page", "Hypha"},
|
||||||
{"edit", "Edit"},
|
{"edit", "Edit"},
|
||||||
|
{"attachment", "Attachment"},
|
||||||
{"history", "History"},
|
{"history", "History"},
|
||||||
{"revision", "NOT REACHED"},
|
{"revision", "NOT REACHED"},
|
||||||
{"rename-ask", "Rename"},
|
{"rename-ask", "Rename"},
|
||||||
@ -47,268 +48,268 @@ var navEntries = []navEntry{
|
|||||||
{"text", "Raw text"},
|
{"text", "Raw text"},
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/nav.qtpl:23
|
//line views/nav.qtpl:24
|
||||||
func StreamNavHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
func StreamNavHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
||||||
//line views/nav.qtpl:23
|
//line views/nav.qtpl:24
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:25
|
//line views/nav.qtpl:26
|
||||||
u := user.FromRequest(rq)
|
u := user.FromRequest(rq)
|
||||||
|
|
||||||
//line views/nav.qtpl:26
|
//line views/nav.qtpl:27
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<nav class="hypha-tabs main-width">
|
<nav class="hypha-tabs main-width">
|
||||||
<ul class="hypha-tabs__flex">
|
<ul class="hypha-tabs__flex">
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:29
|
//line views/nav.qtpl:30
|
||||||
for _, entry := range navEntries {
|
for _, entry := range navEntries {
|
||||||
//line views/nav.qtpl:30
|
//line views/nav.qtpl:31
|
||||||
if navType == "revision" && entry.path == "revision" {
|
if navType == "revision" && entry.path == "revision" {
|
||||||
//line views/nav.qtpl:30
|
//line views/nav.qtpl:31
|
||||||
qw422016.N().S(` <li class="hypha-tabs__tab hypha-tabs__tab_active">
|
qw422016.N().S(` <li class="hypha-tabs__tab hypha-tabs__tab_active">
|
||||||
<span class="hypha-tabs__selection">`)
|
<span class="hypha-tabs__selection">`)
|
||||||
//line views/nav.qtpl:32
|
//line views/nav.qtpl:33
|
||||||
qw422016.E().S(revisionHash[0])
|
qw422016.E().S(revisionHash[0])
|
||||||
//line views/nav.qtpl:32
|
//line views/nav.qtpl:33
|
||||||
qw422016.N().S(`</span>
|
qw422016.N().S(`</span>
|
||||||
</li>
|
</li>
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:34
|
//line views/nav.qtpl:35
|
||||||
} else if navType == entry.path {
|
} else if navType == entry.path {
|
||||||
//line views/nav.qtpl:34
|
//line views/nav.qtpl:35
|
||||||
qw422016.N().S(` <li class="hypha-tabs__tab hypha-tabs__tab_active">
|
qw422016.N().S(` <li class="hypha-tabs__tab hypha-tabs__tab_active">
|
||||||
<span class="hypha-tabs__selection">`)
|
<span class="hypha-tabs__selection">`)
|
||||||
//line views/nav.qtpl:36
|
//line views/nav.qtpl:37
|
||||||
qw422016.E().S(entry.title)
|
qw422016.E().S(entry.title)
|
||||||
//line views/nav.qtpl:36
|
//line views/nav.qtpl:37
|
||||||
qw422016.N().S(`</span>
|
qw422016.N().S(`</span>
|
||||||
</li>
|
</li>
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:38
|
//line views/nav.qtpl:39
|
||||||
} else if entry.path != "revision" && u.CanProceed(entry.path) {
|
} else if entry.path != "revision" && u.CanProceed(entry.path) {
|
||||||
//line views/nav.qtpl:38
|
//line views/nav.qtpl:39
|
||||||
qw422016.N().S(` <li class="hypha-tabs__tab">
|
qw422016.N().S(` <li class="hypha-tabs__tab">
|
||||||
<a class="hypha-tabs__link" href="/`)
|
<a class="hypha-tabs__link" href="/`)
|
||||||
//line views/nav.qtpl:40
|
//line views/nav.qtpl:41
|
||||||
qw422016.E().S(entry.path)
|
qw422016.E().S(entry.path)
|
||||||
//line views/nav.qtpl:40
|
//line views/nav.qtpl:41
|
||||||
qw422016.N().S(`/`)
|
qw422016.N().S(`/`)
|
||||||
//line views/nav.qtpl:40
|
//line views/nav.qtpl:41
|
||||||
qw422016.E().S(hyphaName)
|
qw422016.E().S(hyphaName)
|
||||||
//line views/nav.qtpl:40
|
//line views/nav.qtpl:41
|
||||||
qw422016.N().S(`">`)
|
qw422016.N().S(`">`)
|
||||||
//line views/nav.qtpl:40
|
//line views/nav.qtpl:41
|
||||||
qw422016.E().S(entry.title)
|
qw422016.E().S(entry.title)
|
||||||
//line views/nav.qtpl:40
|
//line views/nav.qtpl:41
|
||||||
qw422016.N().S(`</a>
|
qw422016.N().S(`</a>
|
||||||
</li>
|
</li>
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:42
|
//line views/nav.qtpl:43
|
||||||
}
|
}
|
||||||
//line views/nav.qtpl:43
|
//line views/nav.qtpl:44
|
||||||
}
|
}
|
||||||
//line views/nav.qtpl:43
|
//line views/nav.qtpl:44
|
||||||
qw422016.N().S(` </ul>
|
qw422016.N().S(` </ul>
|
||||||
</nav>
|
</nav>
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
func WriteNavHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
func WriteNavHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) {
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
StreamNavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
|
StreamNavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
func NavHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
|
func NavHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
WriteNavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
|
WriteNavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/nav.qtpl:46
|
//line views/nav.qtpl:47
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/nav.qtpl:48
|
//line views/nav.qtpl:49
|
||||||
func StreamUserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
|
func StreamUserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
|
||||||
//line views/nav.qtpl:48
|
//line views/nav.qtpl:49
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:49
|
//line views/nav.qtpl:50
|
||||||
if user.AuthUsed {
|
if user.AuthUsed {
|
||||||
//line views/nav.qtpl:49
|
//line views/nav.qtpl:50
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<li class="header-links__entry header-links__entry_user">
|
<li class="header-links__entry header-links__entry_user">
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:51
|
//line views/nav.qtpl:52
|
||||||
if u.Group == "anon" {
|
if u.Group == "anon" {
|
||||||
//line views/nav.qtpl:51
|
//line views/nav.qtpl:52
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<a href="/login" class="header-links__link">Login</a>
|
<a href="/login" class="header-links__link">Login</a>
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:53
|
//line views/nav.qtpl:54
|
||||||
} else {
|
} else {
|
||||||
//line views/nav.qtpl:53
|
//line views/nav.qtpl:54
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<a href="/page/`)
|
<a href="/page/`)
|
||||||
//line views/nav.qtpl:54
|
//line views/nav.qtpl:55
|
||||||
qw422016.E().S(util.UserHypha)
|
qw422016.E().S(util.UserHypha)
|
||||||
//line views/nav.qtpl:54
|
//line views/nav.qtpl:55
|
||||||
qw422016.N().S(`/`)
|
qw422016.N().S(`/`)
|
||||||
//line views/nav.qtpl:54
|
//line views/nav.qtpl:55
|
||||||
qw422016.E().S(u.Name)
|
qw422016.E().S(u.Name)
|
||||||
//line views/nav.qtpl:54
|
//line views/nav.qtpl:55
|
||||||
qw422016.N().S(`" class="header-links__link">`)
|
qw422016.N().S(`" class="header-links__link">`)
|
||||||
//line views/nav.qtpl:54
|
//line views/nav.qtpl:55
|
||||||
qw422016.E().S(u.Name)
|
qw422016.E().S(u.Name)
|
||||||
//line views/nav.qtpl:54
|
//line views/nav.qtpl:55
|
||||||
qw422016.N().S(`</a>
|
qw422016.N().S(`</a>
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:55
|
//line views/nav.qtpl:56
|
||||||
}
|
}
|
||||||
//line views/nav.qtpl:55
|
//line views/nav.qtpl:56
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</li>
|
</li>
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:57
|
//line views/nav.qtpl:58
|
||||||
}
|
}
|
||||||
//line views/nav.qtpl:57
|
//line views/nav.qtpl:58
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
func WriteUserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
|
func WriteUserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
StreamUserMenuHTML(qw422016, u)
|
StreamUserMenuHTML(qw422016, u)
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
func UserMenuHTML(u *user.User) string {
|
func UserMenuHTML(u *user.User) string {
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
WriteUserMenuHTML(qb422016, u)
|
WriteUserMenuHTML(qb422016, u)
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/nav.qtpl:58
|
//line views/nav.qtpl:59
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/nav.qtpl:60
|
//line views/nav.qtpl:61
|
||||||
func StreamRelativeHyphaeHTML(qw422016 *qt422016.Writer, relatives string) {
|
func StreamRelativeHyphaeHTML(qw422016 *qt422016.Writer, relatives string) {
|
||||||
//line views/nav.qtpl:60
|
//line views/nav.qtpl:61
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<aside class="relative-hyphae layout-card">
|
<aside class="relative-hyphae layout-card">
|
||||||
<h2 class="relative-hyphae__title layout-card__title">Relative hyphae</h2>
|
<h2 class="relative-hyphae__title layout-card__title">Relative hyphae</h2>
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:63
|
//line views/nav.qtpl:64
|
||||||
qw422016.N().S(relatives)
|
qw422016.N().S(relatives)
|
||||||
//line views/nav.qtpl:63
|
//line views/nav.qtpl:64
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</aside>
|
</aside>
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
func WriteRelativeHyphaeHTML(qq422016 qtio422016.Writer, relatives string) {
|
func WriteRelativeHyphaeHTML(qq422016 qtio422016.Writer, relatives string) {
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
StreamRelativeHyphaeHTML(qw422016, relatives)
|
StreamRelativeHyphaeHTML(qw422016, relatives)
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
func RelativeHyphaeHTML(relatives string) string {
|
func RelativeHyphaeHTML(relatives string) string {
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
WriteRelativeHyphaeHTML(qb422016, relatives)
|
WriteRelativeHyphaeHTML(qb422016, relatives)
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/nav.qtpl:65
|
//line views/nav.qtpl:66
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/nav.qtpl:67
|
//line views/nav.qtpl:68
|
||||||
func StreamSubhyphaeHTML(qw422016 *qt422016.Writer, subhyphae string) {
|
func StreamSubhyphaeHTML(qw422016 *qt422016.Writer, subhyphae string) {
|
||||||
//line views/nav.qtpl:67
|
//line views/nav.qtpl:68
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:68
|
//line views/nav.qtpl:69
|
||||||
if strings.TrimSpace(subhyphae) != "" {
|
if strings.TrimSpace(subhyphae) != "" {
|
||||||
//line views/nav.qtpl:68
|
//line views/nav.qtpl:69
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<section class="subhyphae">
|
<section class="subhyphae">
|
||||||
<h2 class="subhyphae__title">Subhyphae</h2>
|
<h2 class="subhyphae__title">Subhyphae</h2>
|
||||||
<nav class="subhyphae__nav">
|
<nav class="subhyphae__nav">
|
||||||
<ul class="subhyphae__list">
|
<ul class="subhyphae__list">
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:73
|
//line views/nav.qtpl:74
|
||||||
qw422016.N().S(subhyphae)
|
qw422016.N().S(subhyphae)
|
||||||
//line views/nav.qtpl:73
|
//line views/nav.qtpl:74
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</section>
|
</section>
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:77
|
//line views/nav.qtpl:78
|
||||||
}
|
}
|
||||||
//line views/nav.qtpl:77
|
//line views/nav.qtpl:78
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
func WriteSubhyphaeHTML(qq422016 qtio422016.Writer, subhyphae string) {
|
func WriteSubhyphaeHTML(qq422016 qtio422016.Writer, subhyphae string) {
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
StreamSubhyphaeHTML(qw422016, subhyphae)
|
StreamSubhyphaeHTML(qw422016, subhyphae)
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
func SubhyphaeHTML(subhyphae string) string {
|
func SubhyphaeHTML(subhyphae string) string {
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
WriteSubhyphaeHTML(qb422016, subhyphae)
|
WriteSubhyphaeHTML(qb422016, subhyphae)
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/nav.qtpl:78
|
//line views/nav.qtpl:79
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,75 @@
|
|||||||
{% import "net/http" %}
|
{% import "net/http" %}
|
||||||
|
{% import "strings" %}
|
||||||
{% import "path" %}
|
{% import "path" %}
|
||||||
|
{% import "os" %}
|
||||||
|
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
|
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
|
||||||
|
{% import "github.com/bouncepaw/mycorrhiza/mimetype" %}
|
||||||
|
{% import "github.com/bouncepaw/mycorrhiza/tree" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/tree" %}
|
|
||||||
|
{% func AttachmentMenuHTML(rq *http.Request, h *hyphae.Hypha, u *user.User) %}
|
||||||
|
{%= NavHTML(rq, h.Name, "attachment") %}
|
||||||
|
<div class="layout">
|
||||||
|
<main class="main-width">
|
||||||
|
<h1>Attachment of {%s util.BeautifulName(h.Name) %}</h1>
|
||||||
|
{% if h.BinaryPath == "" %}
|
||||||
|
<p class="warning">This hypha has no attachment, you can upload it here.</p>
|
||||||
|
{% else %}
|
||||||
|
<p class="warning">You can manage the hypha's attachment on this page.</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
<section class="amnt-grid">
|
||||||
|
|
||||||
|
{% if h.BinaryPath != "" %}
|
||||||
|
{% code
|
||||||
|
mime := mimetype.FromExtension(path.Ext(h.BinaryPath))
|
||||||
|
fileinfo, err := os.Stat(h.BinaryPath) %}
|
||||||
|
{% if err == nil %}
|
||||||
|
<fieldset class="amnt-menu-block">
|
||||||
|
<legend class="modal__title modal__title_small">Stat</legend>
|
||||||
|
<p class="modal__confirmation-msg"><b>File size:</b> {%dl fileinfo.Size() %} bytes</p>
|
||||||
|
<p><b>MIME type:</b> {%s mime %}</p>
|
||||||
|
</fieldset>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if strings.HasPrefix(mime, "image/") %}
|
||||||
|
<fieldset class="amnt-menu-block">
|
||||||
|
<legend class="modal__title modal__title_small">Include</legend>
|
||||||
|
<p class="modal__confirmation-msg">This attachment is an image. To include it to a page, use a syntax like this:</p>
|
||||||
|
<pre class="codebleck"><code>img { {%s h.Name %} }</code></pre>
|
||||||
|
</fieldset>
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if u.CanProceed("upload-binary") %}
|
||||||
|
<form action="/upload-binary/{%s h.Name %}"
|
||||||
|
method="post" enctype="multipart/form-data"
|
||||||
|
class="modal amnt-menu-block">
|
||||||
|
<fieldset class="modal__fieldset upload-binary">
|
||||||
|
<legend class="modal__title modal__title_small">Attach</legend>
|
||||||
|
<p class="modal__confirmation-msg">You can upload a new attachment. Please do not upload too big pictures unless you need to because no server-side compression is done and other readers may not want to wait for big pictures to load.</p>
|
||||||
|
<input type="file" class="upload-binary__input" name="binary">
|
||||||
|
<input type="submit" class="modal__action modal__submit">
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if h.BinaryPath != "" && u.CanProceed("unattach-confirm") %}
|
||||||
|
<form action="/unattach-confirm/{%s h.Name %}" method="post" class="modal amnt-menu-block">
|
||||||
|
<fieldset class="modal__fieldset">
|
||||||
|
<legend class="modal__title modal__title_small">Unattach</legend>
|
||||||
|
<p class="modal__confirmation-msg">Please note that you don't have to unattach before uploading a new attachment.</p>
|
||||||
|
<input type="submit" class="modal__action modal__submit">
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
{% endfunc %}
|
||||||
|
|
||||||
If `contents` == "", a helpful message is shown instead.
|
If `contents` == "", a helpful message is shown instead.
|
||||||
{% func HyphaHTML(rq *http.Request, h *hyphae.Hypha, contents string) %}
|
{% func HyphaHTML(rq *http.Request, h *hyphae.Hypha, contents string) %}
|
||||||
@ -18,6 +83,16 @@ If `contents` == "", a helpful message is shown instead.
|
|||||||
{%s= NaviTitleHTML(h) %}
|
{%s= NaviTitleHTML(h) %}
|
||||||
{% if contents == "" %}
|
{% if contents == "" %}
|
||||||
<p>This hypha has no text. Why not <a href="/edit/{%s h.Name %}">create it</a>?</p>
|
<p>This hypha has no text. Why not <a href="/edit/{%s h.Name %}">create it</a>?</p>
|
||||||
|
{% if u := user.FromRequest(rq); (!user.AuthUsed || u.Group != "anon") && !h.Exists %}
|
||||||
|
<form action="/upload-binary/{%s h.Name %}"
|
||||||
|
method="post" enctype="multipart/form-data"
|
||||||
|
class="upload-binary">
|
||||||
|
<label for="upload-binary__input">Upload an attachment:</label>
|
||||||
|
<input type="file" id="upload-binary__input" name="binary">
|
||||||
|
<input type="submit">
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{%s= contents %}
|
{%s= contents %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@ -30,19 +105,6 @@ If `contents` == "", a helpful message is shown instead.
|
|||||||
<a class="prevnext__el prevnext__next" href="/hypha/{%s nextHyphaName %}" rel="next">{%s util.BeautifulName(path.Base(nextHyphaName)) %} →</a>
|
<a class="prevnext__el prevnext__next" href="/hypha/{%s nextHyphaName %}" rel="next">{%s util.BeautifulName(path.Base(nextHyphaName)) %} →</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</section>
|
</section>
|
||||||
{% if u := user.FromRequest(rq); !user.AuthUsed || u.Group != "anon" %}
|
|
||||||
<form action="/upload-binary/{%s h.Name %}"
|
|
||||||
method="post" enctype="multipart/form-data"
|
|
||||||
class="upload-amnt">
|
|
||||||
{% if h.Exists && h.BinaryPath != "" %}
|
|
||||||
<a class="upload-amnt__unattach" href="/unattach-ask/{%s h.Name %}">Unattach current attachment?</a>
|
|
||||||
{% endif %}
|
|
||||||
<label for="upload-binary__input">Upload a new attachment</label>
|
|
||||||
<br>
|
|
||||||
<input type="file" id="upload-binary__input" name="binary"/>
|
|
||||||
<input type="submit"/>
|
|
||||||
</form>
|
|
||||||
{% endif %}
|
|
||||||
{%= SubhyphaeHTML(subhyphae) %}
|
{%= SubhyphaeHTML(subhyphae) %}
|
||||||
</main>
|
</main>
|
||||||
{%= RelativeHyphaeHTML(relatives) %}
|
{%= RelativeHyphaeHTML(relatives) %}
|
||||||
|
@ -8,276 +8,447 @@ package views
|
|||||||
import "net/http"
|
import "net/http"
|
||||||
|
|
||||||
//line views/readers.qtpl:2
|
//line views/readers.qtpl:2
|
||||||
|
import "strings"
|
||||||
|
|
||||||
|
//line views/readers.qtpl:3
|
||||||
import "path"
|
import "path"
|
||||||
|
|
||||||
//line views/readers.qtpl:4
|
//line views/readers.qtpl:4
|
||||||
import "github.com/bouncepaw/mycorrhiza/hyphae"
|
import "os"
|
||||||
|
|
||||||
//line views/readers.qtpl:5
|
|
||||||
import "github.com/bouncepaw/mycorrhiza/user"
|
|
||||||
|
|
||||||
//line views/readers.qtpl:6
|
//line views/readers.qtpl:6
|
||||||
import "github.com/bouncepaw/mycorrhiza/util"
|
import "github.com/bouncepaw/mycorrhiza/hyphae"
|
||||||
|
|
||||||
//line views/readers.qtpl:7
|
//line views/readers.qtpl:7
|
||||||
|
import "github.com/bouncepaw/mycorrhiza/mimetype"
|
||||||
|
|
||||||
|
//line views/readers.qtpl:8
|
||||||
import "github.com/bouncepaw/mycorrhiza/tree"
|
import "github.com/bouncepaw/mycorrhiza/tree"
|
||||||
|
|
||||||
// If `contents` == "", a helpful message is shown instead.
|
//line views/readers.qtpl:9
|
||||||
|
import "github.com/bouncepaw/mycorrhiza/user"
|
||||||
|
|
||||||
//line views/readers.qtpl:10
|
//line views/readers.qtpl:10
|
||||||
|
import "github.com/bouncepaw/mycorrhiza/util"
|
||||||
|
|
||||||
|
//line views/readers.qtpl:12
|
||||||
import (
|
import (
|
||||||
qtio422016 "io"
|
qtio422016 "io"
|
||||||
|
|
||||||
qt422016 "github.com/valyala/quicktemplate"
|
qt422016 "github.com/valyala/quicktemplate"
|
||||||
)
|
)
|
||||||
|
|
||||||
//line views/readers.qtpl:10
|
//line views/readers.qtpl:12
|
||||||
var (
|
var (
|
||||||
_ = qtio422016.Copy
|
_ = qtio422016.Copy
|
||||||
_ = qt422016.AcquireByteBuffer
|
_ = qt422016.AcquireByteBuffer
|
||||||
)
|
)
|
||||||
|
|
||||||
//line views/readers.qtpl:10
|
//line views/readers.qtpl:12
|
||||||
func StreamHyphaHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, contents string) {
|
func StreamAttachmentMenuHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, u *user.User) {
|
||||||
//line views/readers.qtpl:10
|
//line views/readers.qtpl:12
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:12
|
//line views/readers.qtpl:13
|
||||||
relatives, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.Name)
|
StreamNavHTML(qw422016, rq, h.Name, "attachment")
|
||||||
|
|
||||||
//line views/readers.qtpl:13
|
//line views/readers.qtpl:13
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
|
<div class="layout">
|
||||||
|
<main class="main-width">
|
||||||
|
<h1>Attachment of `)
|
||||||
|
//line views/readers.qtpl:16
|
||||||
|
qw422016.E().S(util.BeautifulName(h.Name))
|
||||||
|
//line views/readers.qtpl:16
|
||||||
|
qw422016.N().S(`</h1>
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:17
|
||||||
|
if h.BinaryPath == "" {
|
||||||
|
//line views/readers.qtpl:17
|
||||||
|
qw422016.N().S(`
|
||||||
|
<p class="warning">This hypha has no attachment, you can upload it here.</p>
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:19
|
||||||
|
} else {
|
||||||
|
//line views/readers.qtpl:19
|
||||||
|
qw422016.N().S(`
|
||||||
|
<p class="warning">You can manage the hypha's attachment on this page.</p>
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:21
|
||||||
|
}
|
||||||
|
//line views/readers.qtpl:21
|
||||||
|
qw422016.N().S(`
|
||||||
|
|
||||||
|
<section class="amnt-grid">
|
||||||
|
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:25
|
||||||
|
if h.BinaryPath != "" {
|
||||||
|
//line views/readers.qtpl:25
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:27
|
||||||
|
mime := mimetype.FromExtension(path.Ext(h.BinaryPath))
|
||||||
|
fileinfo, err := os.Stat(h.BinaryPath)
|
||||||
|
|
||||||
|
//line views/readers.qtpl:28
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:29
|
||||||
|
if err == nil {
|
||||||
|
//line views/readers.qtpl:29
|
||||||
|
qw422016.N().S(`
|
||||||
|
<fieldset class="amnt-menu-block">
|
||||||
|
<legend class="modal__title modal__title_small">Stat</legend>
|
||||||
|
<p class="modal__confirmation-msg"><b>File size:</b> `)
|
||||||
|
//line views/readers.qtpl:32
|
||||||
|
qw422016.N().DL(fileinfo.Size())
|
||||||
|
//line views/readers.qtpl:32
|
||||||
|
qw422016.N().S(` bytes</p>
|
||||||
|
<p><b>MIME type:</b> `)
|
||||||
|
//line views/readers.qtpl:33
|
||||||
|
qw422016.E().S(mime)
|
||||||
|
//line views/readers.qtpl:33
|
||||||
|
qw422016.N().S(`</p>
|
||||||
|
</fieldset>
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:35
|
||||||
|
}
|
||||||
|
//line views/readers.qtpl:35
|
||||||
|
qw422016.N().S(`
|
||||||
|
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:37
|
||||||
|
if strings.HasPrefix(mime, "image/") {
|
||||||
|
//line views/readers.qtpl:37
|
||||||
|
qw422016.N().S(`
|
||||||
|
<fieldset class="amnt-menu-block">
|
||||||
|
<legend class="modal__title modal__title_small">Include</legend>
|
||||||
|
<p class="modal__confirmation-msg">This attachment is an image. To include it to a page, use a syntax like this:</p>
|
||||||
|
<pre class="codebleck"><code>img { `)
|
||||||
|
//line views/readers.qtpl:41
|
||||||
|
qw422016.E().S(h.Name)
|
||||||
|
//line views/readers.qtpl:41
|
||||||
|
qw422016.N().S(` }</code></pre>
|
||||||
|
</fieldset>
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:43
|
||||||
|
}
|
||||||
|
//line views/readers.qtpl:43
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:44
|
||||||
|
}
|
||||||
|
//line views/readers.qtpl:44
|
||||||
|
qw422016.N().S(`
|
||||||
|
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:46
|
||||||
|
if u.CanProceed("upload-binary") {
|
||||||
|
//line views/readers.qtpl:46
|
||||||
|
qw422016.N().S(`
|
||||||
|
<form action="/upload-binary/`)
|
||||||
|
//line views/readers.qtpl:47
|
||||||
|
qw422016.E().S(h.Name)
|
||||||
|
//line views/readers.qtpl:47
|
||||||
|
qw422016.N().S(`"
|
||||||
|
method="post" enctype="multipart/form-data"
|
||||||
|
class="modal amnt-menu-block">
|
||||||
|
<fieldset class="modal__fieldset upload-binary">
|
||||||
|
<legend class="modal__title modal__title_small">Attach</legend>
|
||||||
|
<p class="modal__confirmation-msg">You can upload a new attachment. Please do not upload too big pictures unless you need to because no server-side compression is done and other readers may not want to wait for big pictures to load.</p>
|
||||||
|
<input type="file" class="upload-binary__input" name="binary">
|
||||||
|
<input type="submit" class="modal__action modal__submit">
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:57
|
||||||
|
}
|
||||||
|
//line views/readers.qtpl:57
|
||||||
|
qw422016.N().S(`
|
||||||
|
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:59
|
||||||
|
if h.BinaryPath != "" && u.CanProceed("unattach-confirm") {
|
||||||
|
//line views/readers.qtpl:59
|
||||||
|
qw422016.N().S(`
|
||||||
|
<form action="/unattach-confirm/`)
|
||||||
|
//line views/readers.qtpl:60
|
||||||
|
qw422016.E().S(h.Name)
|
||||||
|
//line views/readers.qtpl:60
|
||||||
|
qw422016.N().S(`" method="post" class="modal amnt-menu-block">
|
||||||
|
<fieldset class="modal__fieldset">
|
||||||
|
<legend class="modal__title modal__title_small">Unattach</legend>
|
||||||
|
<p class="modal__confirmation-msg">Please note that you don't have to unattach before uploading a new attachment.</p>
|
||||||
|
<input type="submit" class="modal__action modal__submit">
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:67
|
||||||
|
}
|
||||||
|
//line views/readers.qtpl:67
|
||||||
|
qw422016.N().S(`
|
||||||
|
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:14
|
//line views/readers.qtpl:72
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/readers.qtpl:72
|
||||||
|
func WriteAttachmentMenuHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, u *user.User) {
|
||||||
|
//line views/readers.qtpl:72
|
||||||
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
|
//line views/readers.qtpl:72
|
||||||
|
StreamAttachmentMenuHTML(qw422016, rq, h, u)
|
||||||
|
//line views/readers.qtpl:72
|
||||||
|
qt422016.ReleaseWriter(qw422016)
|
||||||
|
//line views/readers.qtpl:72
|
||||||
|
}
|
||||||
|
|
||||||
|
//line views/readers.qtpl:72
|
||||||
|
func AttachmentMenuHTML(rq *http.Request, h *hyphae.Hypha, u *user.User) string {
|
||||||
|
//line views/readers.qtpl:72
|
||||||
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
|
//line views/readers.qtpl:72
|
||||||
|
WriteAttachmentMenuHTML(qb422016, rq, h, u)
|
||||||
|
//line views/readers.qtpl:72
|
||||||
|
qs422016 := string(qb422016.B)
|
||||||
|
//line views/readers.qtpl:72
|
||||||
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
|
//line views/readers.qtpl:72
|
||||||
|
return qs422016
|
||||||
|
//line views/readers.qtpl:72
|
||||||
|
}
|
||||||
|
|
||||||
|
// If `contents` == "", a helpful message is shown instead.
|
||||||
|
|
||||||
|
//line views/readers.qtpl:75
|
||||||
|
func StreamHyphaHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, contents string) {
|
||||||
|
//line views/readers.qtpl:75
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:77
|
||||||
|
relatives, subhyphae, prevHyphaName, nextHyphaName := tree.Tree(h.Name)
|
||||||
|
|
||||||
|
//line views/readers.qtpl:78
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:79
|
||||||
StreamNavHTML(qw422016, rq, h.Name, "page")
|
StreamNavHTML(qw422016, rq, h.Name, "page")
|
||||||
//line views/readers.qtpl:14
|
//line views/readers.qtpl:79
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width">
|
<main class="main-width">
|
||||||
<article>
|
<article>
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:18
|
//line views/readers.qtpl:83
|
||||||
qw422016.N().S(NaviTitleHTML(h))
|
qw422016.N().S(NaviTitleHTML(h))
|
||||||
//line views/readers.qtpl:18
|
//line views/readers.qtpl:83
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:19
|
//line views/readers.qtpl:84
|
||||||
if contents == "" {
|
if contents == "" {
|
||||||
//line views/readers.qtpl:19
|
//line views/readers.qtpl:84
|
||||||
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 views/readers.qtpl:20
|
//line views/readers.qtpl:85
|
||||||
qw422016.E().S(h.Name)
|
qw422016.E().S(h.Name)
|
||||||
//line views/readers.qtpl:20
|
//line views/readers.qtpl:85
|
||||||
qw422016.N().S(`">create it</a>?</p>
|
qw422016.N().S(`">create it</a>?</p>
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:21
|
//line views/readers.qtpl:86
|
||||||
} else {
|
if u := user.FromRequest(rq); (!user.AuthUsed || u.Group != "anon") && !h.Exists {
|
||||||
//line views/readers.qtpl:21
|
//line views/readers.qtpl:86
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
<form action="/upload-binary/`)
|
||||||
//line views/readers.qtpl:22
|
//line views/readers.qtpl:87
|
||||||
qw422016.N().S(contents)
|
qw422016.E().S(h.Name)
|
||||||
//line views/readers.qtpl:22
|
//line views/readers.qtpl:87
|
||||||
|
qw422016.N().S(`"
|
||||||
|
method="post" enctype="multipart/form-data"
|
||||||
|
class="upload-binary">
|
||||||
|
<label for="upload-binary__input">Upload an attachment:</label>
|
||||||
|
<input type="file" id="upload-binary__input" name="binary">
|
||||||
|
<input type="submit">
|
||||||
|
</form>
|
||||||
|
<br>
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:95
|
||||||
|
}
|
||||||
|
//line views/readers.qtpl:95
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:23
|
//line views/readers.qtpl:96
|
||||||
|
} else {
|
||||||
|
//line views/readers.qtpl:96
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:97
|
||||||
|
qw422016.N().S(contents)
|
||||||
|
//line views/readers.qtpl:97
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/readers.qtpl:98
|
||||||
}
|
}
|
||||||
//line views/readers.qtpl:23
|
//line views/readers.qtpl:98
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</article>
|
</article>
|
||||||
<section class="prevnext">
|
<section class="prevnext">
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:26
|
//line views/readers.qtpl:101
|
||||||
if prevHyphaName != "" {
|
if prevHyphaName != "" {
|
||||||
//line views/readers.qtpl:26
|
//line views/readers.qtpl:101
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<a class="prevnext__el prevnext__prev" href="/hypha/`)
|
<a class="prevnext__el prevnext__prev" href="/hypha/`)
|
||||||
//line views/readers.qtpl:27
|
//line views/readers.qtpl:102
|
||||||
qw422016.E().S(prevHyphaName)
|
qw422016.E().S(prevHyphaName)
|
||||||
//line views/readers.qtpl:27
|
//line views/readers.qtpl:102
|
||||||
qw422016.N().S(`" rel="prev">← `)
|
qw422016.N().S(`" rel="prev">← `)
|
||||||
//line views/readers.qtpl:27
|
//line views/readers.qtpl:102
|
||||||
qw422016.E().S(util.BeautifulName(path.Base(prevHyphaName)))
|
qw422016.E().S(util.BeautifulName(path.Base(prevHyphaName)))
|
||||||
//line views/readers.qtpl:27
|
//line views/readers.qtpl:102
|
||||||
qw422016.N().S(`</a>
|
qw422016.N().S(`</a>
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:28
|
//line views/readers.qtpl:103
|
||||||
}
|
}
|
||||||
//line views/readers.qtpl:28
|
//line views/readers.qtpl:103
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:29
|
//line views/readers.qtpl:104
|
||||||
if nextHyphaName != "" {
|
if nextHyphaName != "" {
|
||||||
//line views/readers.qtpl:29
|
//line views/readers.qtpl:104
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<a class="prevnext__el prevnext__next" href="/hypha/`)
|
<a class="prevnext__el prevnext__next" href="/hypha/`)
|
||||||
//line views/readers.qtpl:30
|
//line views/readers.qtpl:105
|
||||||
qw422016.E().S(nextHyphaName)
|
qw422016.E().S(nextHyphaName)
|
||||||
//line views/readers.qtpl:30
|
//line views/readers.qtpl:105
|
||||||
qw422016.N().S(`" rel="next">`)
|
qw422016.N().S(`" rel="next">`)
|
||||||
//line views/readers.qtpl:30
|
//line views/readers.qtpl:105
|
||||||
qw422016.E().S(util.BeautifulName(path.Base(nextHyphaName)))
|
qw422016.E().S(util.BeautifulName(path.Base(nextHyphaName)))
|
||||||
//line views/readers.qtpl:30
|
//line views/readers.qtpl:105
|
||||||
qw422016.N().S(` →</a>
|
qw422016.N().S(` →</a>
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:31
|
//line views/readers.qtpl:106
|
||||||
}
|
}
|
||||||
//line views/readers.qtpl:31
|
//line views/readers.qtpl:106
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</section>
|
</section>
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:33
|
//line views/readers.qtpl:108
|
||||||
if u := user.FromRequest(rq); !user.AuthUsed || u.Group != "anon" {
|
|
||||||
//line views/readers.qtpl:33
|
|
||||||
qw422016.N().S(`
|
|
||||||
<form action="/upload-binary/`)
|
|
||||||
//line views/readers.qtpl:34
|
|
||||||
qw422016.E().S(h.Name)
|
|
||||||
//line views/readers.qtpl:34
|
|
||||||
qw422016.N().S(`"
|
|
||||||
method="post" enctype="multipart/form-data"
|
|
||||||
class="upload-amnt">
|
|
||||||
`)
|
|
||||||
//line views/readers.qtpl:37
|
|
||||||
if h.Exists && h.BinaryPath != "" {
|
|
||||||
//line views/readers.qtpl:37
|
|
||||||
qw422016.N().S(`
|
|
||||||
<a class="upload-amnt__unattach" href="/unattach-ask/`)
|
|
||||||
//line views/readers.qtpl:38
|
|
||||||
qw422016.E().S(h.Name)
|
|
||||||
//line views/readers.qtpl:38
|
|
||||||
qw422016.N().S(`">Unattach current attachment?</a>
|
|
||||||
`)
|
|
||||||
//line views/readers.qtpl:39
|
|
||||||
}
|
|
||||||
//line views/readers.qtpl:39
|
|
||||||
qw422016.N().S(`
|
|
||||||
<label for="upload-binary__input">Upload a new attachment</label>
|
|
||||||
<br>
|
|
||||||
<input type="file" id="upload-binary__input" name="binary"/>
|
|
||||||
<input type="submit"/>
|
|
||||||
</form>
|
|
||||||
`)
|
|
||||||
//line views/readers.qtpl:45
|
|
||||||
}
|
|
||||||
//line views/readers.qtpl:45
|
|
||||||
qw422016.N().S(`
|
|
||||||
`)
|
|
||||||
//line views/readers.qtpl:46
|
|
||||||
StreamSubhyphaeHTML(qw422016, subhyphae)
|
StreamSubhyphaeHTML(qw422016, subhyphae)
|
||||||
//line views/readers.qtpl:46
|
//line views/readers.qtpl:108
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</main>
|
</main>
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:48
|
//line views/readers.qtpl:110
|
||||||
StreamRelativeHyphaeHTML(qw422016, relatives)
|
StreamRelativeHyphaeHTML(qw422016, relatives)
|
||||||
//line views/readers.qtpl:48
|
//line views/readers.qtpl:110
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:49
|
//line views/readers.qtpl:111
|
||||||
StreamBackLinksHTML(qw422016, h)
|
StreamBackLinksHTML(qw422016, h)
|
||||||
//line views/readers.qtpl:49
|
//line views/readers.qtpl:111
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
func WriteHyphaHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, contents string) {
|
func WriteHyphaHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, contents string) {
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
StreamHyphaHTML(qw422016, rq, h, contents)
|
StreamHyphaHTML(qw422016, rq, h, contents)
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
func HyphaHTML(rq *http.Request, h *hyphae.Hypha, contents string) string {
|
func HyphaHTML(rq *http.Request, h *hyphae.Hypha, contents string) string {
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
WriteHyphaHTML(qb422016, rq, h, contents)
|
WriteHyphaHTML(qb422016, rq, h, contents)
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/readers.qtpl:51
|
//line views/readers.qtpl:113
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/readers.qtpl:53
|
//line views/readers.qtpl:115
|
||||||
func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, revHash string) {
|
func StreamRevisionHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, revHash string) {
|
||||||
//line views/readers.qtpl:53
|
//line views/readers.qtpl:115
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:55
|
//line views/readers.qtpl:117
|
||||||
relatives, subhyphae, _, _ := tree.Tree(h.Name)
|
relatives, subhyphae, _, _ := tree.Tree(h.Name)
|
||||||
|
|
||||||
//line views/readers.qtpl:56
|
//line views/readers.qtpl:118
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:57
|
//line views/readers.qtpl:119
|
||||||
StreamNavHTML(qw422016, rq, h.Name, "revision", revHash)
|
StreamNavHTML(qw422016, rq, h.Name, "revision", revHash)
|
||||||
//line views/readers.qtpl:57
|
//line views/readers.qtpl:119
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width">
|
<main class="main-width">
|
||||||
<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 views/readers.qtpl:62
|
//line views/readers.qtpl:124
|
||||||
qw422016.N().S(NaviTitleHTML(h))
|
qw422016.N().S(NaviTitleHTML(h))
|
||||||
//line views/readers.qtpl:62
|
//line views/readers.qtpl:124
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:63
|
//line views/readers.qtpl:125
|
||||||
qw422016.N().S(contents)
|
qw422016.N().S(contents)
|
||||||
//line views/readers.qtpl:63
|
//line views/readers.qtpl:125
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</article>
|
</article>
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:65
|
//line views/readers.qtpl:127
|
||||||
StreamSubhyphaeHTML(qw422016, subhyphae)
|
StreamSubhyphaeHTML(qw422016, subhyphae)
|
||||||
//line views/readers.qtpl:65
|
//line views/readers.qtpl:127
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</main>
|
</main>
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:67
|
//line views/readers.qtpl:129
|
||||||
StreamRelativeHyphaeHTML(qw422016, relatives)
|
StreamRelativeHyphaeHTML(qw422016, relatives)
|
||||||
//line views/readers.qtpl:67
|
//line views/readers.qtpl:129
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
func WriteRevisionHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, revHash string) {
|
func WriteRevisionHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, contents, revHash string) {
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
StreamRevisionHTML(qw422016, rq, h, contents, revHash)
|
StreamRevisionHTML(qw422016, rq, h, contents, revHash)
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
func RevisionHTML(rq *http.Request, h *hyphae.Hypha, contents, revHash string) string {
|
func RevisionHTML(rq *http.Request, h *hyphae.Hypha, contents, revHash string) string {
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
WriteRevisionHTML(qb422016, rq, h, contents, revHash)
|
WriteRevisionHTML(qb422016, rq, h, contents, revHash)
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/readers.qtpl:69
|
//line views/readers.qtpl:131
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user