mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-10-30 11:46:16 +00:00
Move the user link to the header links
This commit is contained in:
parent
455a3e0f79
commit
e33e5d06a1
@ -28,7 +28,7 @@ func handlerLogout(w http.ResponseWriter, rq *http.Request) {
|
|||||||
log.Println("Unknown user tries to log out")
|
log.Println("Unknown user tries to log out")
|
||||||
w.WriteHeader(http.StatusForbidden)
|
w.WriteHeader(http.StatusForbidden)
|
||||||
}
|
}
|
||||||
w.Write([]byte(base("Logout?", templates.LogoutHTML(can))))
|
w.Write([]byte(base("Logout?", templates.LogoutHTML(can), u)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlerLogoutConfirm(w http.ResponseWriter, rq *http.Request) {
|
func handlerLogoutConfirm(w http.ResponseWriter, rq *http.Request) {
|
||||||
@ -44,7 +44,7 @@ func handlerLoginData(w http.ResponseWriter, rq *http.Request) {
|
|||||||
err = user.LoginDataHTTP(w, rq, username, password)
|
err = user.LoginDataHTTP(w, rq, username, password)
|
||||||
)
|
)
|
||||||
if err != "" {
|
if err != "" {
|
||||||
w.Write([]byte(base(err, templates.LoginErrorHTML(err))))
|
w.Write([]byte(base(err, templates.LoginErrorHTML(err), user.EmptyUser())))
|
||||||
} else {
|
} else {
|
||||||
http.Redirect(w, rq, "/", http.StatusSeeOther)
|
http.Redirect(w, rq, "/", http.StatusSeeOther)
|
||||||
}
|
}
|
||||||
@ -58,5 +58,5 @@ func handlerLogin(w http.ResponseWriter, rq *http.Request) {
|
|||||||
} else {
|
} else {
|
||||||
w.WriteHeader(http.StatusForbidden)
|
w.WriteHeader(http.StatusForbidden)
|
||||||
}
|
}
|
||||||
w.Write([]byte(base("Login", templates.LoginHTML())))
|
w.Write([]byte(base("Login", templates.LoginHTML(), user.EmptyUser())))
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/bouncepaw/mycorrhiza/history"
|
"github.com/bouncepaw/mycorrhiza/history"
|
||||||
"github.com/bouncepaw/mycorrhiza/templates"
|
"github.com/bouncepaw/mycorrhiza/templates"
|
||||||
|
"github.com/bouncepaw/mycorrhiza/user"
|
||||||
"github.com/bouncepaw/mycorrhiza/util"
|
"github.com/bouncepaw/mycorrhiza/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -34,7 +35,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(rq, hyphaName, list)))
|
base(hyphaName, templates.HistoryHTML(rq, hyphaName, list), user.FromRequest(rq)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recent changes
|
// Recent changes
|
||||||
@ -45,7 +46,7 @@ func handlerRecentChanges(w http.ResponseWriter, rq *http.Request) {
|
|||||||
n, err = strconv.Atoi(noPrefix)
|
n, err = strconv.Atoi(noPrefix)
|
||||||
)
|
)
|
||||||
if err == nil && n < 101 {
|
if err == nil && n < 101 {
|
||||||
util.HTTP200Page(w, base(strconv.Itoa(n)+" recent changes", history.RecentChanges(n)))
|
util.HTTP200Page(w, base(strconv.Itoa(n)+" recent changes", history.RecentChanges(n), user.FromRequest(rq)))
|
||||||
} else {
|
} else {
|
||||||
http.Redirect(w, rq, "/recent-changes/20", http.StatusSeeOther)
|
http.Redirect(w, rq, "/recent-changes/20", http.StatusSeeOther)
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ func handlerUnattachAsk(w http.ResponseWriter, rq *http.Request) {
|
|||||||
log.Println("Rejected (no rights):", rq.URL)
|
log.Println("Rejected (no rights):", rq.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
util.HTTP200Page(w, base("Unattach "+hyphaName+"?", templates.UnattachAskHTML(rq, hyphaName, isOld)))
|
util.HTTP200Page(w, base("Unattach "+hyphaName+"?", templates.UnattachAskHTML(rq, hyphaName, isOld), user.FromRequest(rq)))
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlerUnattachConfirm(w http.ResponseWriter, rq *http.Request) {
|
func handlerUnattachConfirm(w http.ResponseWriter, rq *http.Request) {
|
||||||
@ -82,13 +82,14 @@ func handlerRenameAsk(w http.ResponseWriter, rq *http.Request) {
|
|||||||
var (
|
var (
|
||||||
hyphaName = HyphaNameFromRq(rq, "rename-ask")
|
hyphaName = HyphaNameFromRq(rq, "rename-ask")
|
||||||
_, isOld = HyphaStorage[hyphaName]
|
_, isOld = HyphaStorage[hyphaName]
|
||||||
|
u = user.FromRequest(rq)
|
||||||
)
|
)
|
||||||
if ok := user.CanProceed(rq, "rename-confirm"); !ok {
|
if !u.CanProceed("rename-confirm") {
|
||||||
HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be a trusted editor to rename pages.")
|
HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be a trusted editor to rename pages.")
|
||||||
log.Println("Rejected", rq.URL)
|
log.Println("Rejected", rq.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
util.HTTP200Page(w, base("Rename "+hyphaName+"?", templates.RenameAskHTML(rq, hyphaName, isOld)))
|
util.HTTP200Page(w, base("Rename "+hyphaName+"?", templates.RenameAskHTML(rq, hyphaName, isOld), u))
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlerRenameConfirm(w http.ResponseWriter, rq *http.Request) {
|
func handlerRenameConfirm(w http.ResponseWriter, rq *http.Request) {
|
||||||
@ -134,13 +135,14 @@ func handlerDeleteAsk(w http.ResponseWriter, rq *http.Request) {
|
|||||||
var (
|
var (
|
||||||
hyphaName = HyphaNameFromRq(rq, "delete-ask")
|
hyphaName = HyphaNameFromRq(rq, "delete-ask")
|
||||||
_, isOld = HyphaStorage[hyphaName]
|
_, isOld = HyphaStorage[hyphaName]
|
||||||
|
u = user.FromRequest(rq)
|
||||||
)
|
)
|
||||||
if ok := user.CanProceed(rq, "delete-ask"); !ok {
|
if !u.CanProceed("delete-ask") {
|
||||||
HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be a moderator to delete pages.")
|
HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be a moderator to delete pages.")
|
||||||
log.Println("Rejected", rq.URL)
|
log.Println("Rejected", rq.URL)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
util.HTTP200Page(w, base("Delete "+hyphaName+"?", templates.DeleteAskHTML(rq, hyphaName, isOld)))
|
util.HTTP200Page(w, base("Delete "+hyphaName+"?", templates.DeleteAskHTML(rq, hyphaName, isOld), u))
|
||||||
}
|
}
|
||||||
|
|
||||||
// handlerDeleteConfirm deletes a hypha for sure
|
// handlerDeleteConfirm deletes a hypha for sure
|
||||||
@ -151,7 +153,7 @@ func handlerDeleteConfirm(w http.ResponseWriter, rq *http.Request) {
|
|||||||
hyphaData, isOld = HyphaStorage[hyphaName]
|
hyphaData, isOld = HyphaStorage[hyphaName]
|
||||||
u = user.FromRequest(rq)
|
u = user.FromRequest(rq)
|
||||||
)
|
)
|
||||||
if !user.CanProceed(rq, "delete-confirm") {
|
if !u.CanProceed("delete-confirm") {
|
||||||
HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be a moderator to delete pages.")
|
HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be a moderator to delete pages.")
|
||||||
log.Println("Rejected", rq.URL)
|
log.Println("Rejected", rq.URL)
|
||||||
return
|
return
|
||||||
@ -181,8 +183,9 @@ func handlerEdit(w http.ResponseWriter, rq *http.Request) {
|
|||||||
warning string
|
warning string
|
||||||
textAreaFill string
|
textAreaFill string
|
||||||
err error
|
err error
|
||||||
|
u = user.FromRequest(rq)
|
||||||
)
|
)
|
||||||
if ok := user.CanProceed(rq, "edit"); !ok {
|
if !u.CanProceed("edit") {
|
||||||
HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be an editor to edit pages.")
|
HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be an editor to edit pages.")
|
||||||
log.Println("Rejected", rq.URL)
|
log.Println("Rejected", rq.URL)
|
||||||
return
|
return
|
||||||
@ -197,7 +200,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(rq, hyphaName, textAreaFill, warning)))
|
util.HTTP200Page(w, base("Edit "+hyphaName, templates.EditHTML(rq, hyphaName, textAreaFill, warning), u))
|
||||||
}
|
}
|
||||||
|
|
||||||
// handlerUploadText uploads a new text part for the hypha.
|
// handlerUploadText uploads a new text part for the hypha.
|
||||||
@ -209,7 +212,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) {
|
|||||||
action = rq.PostFormValue("action")
|
action = rq.PostFormValue("action")
|
||||||
u = user.FromRequest(rq)
|
u = user.FromRequest(rq)
|
||||||
)
|
)
|
||||||
if ok := user.CanProceed(rq, "upload-text"); !ok {
|
if !u.CanProceed("upload-text") {
|
||||||
HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be an editor to edit pages.")
|
HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be an editor to edit pages.")
|
||||||
log.Println("Rejected", rq.URL)
|
log.Println("Rejected", rq.URL)
|
||||||
return
|
return
|
||||||
@ -219,7 +222,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if action == "Preview" {
|
if action == "Preview" {
|
||||||
util.HTTP200Page(w, base("Preview "+hyphaName, templates.PreviewHTML(rq, hyphaName, textData, "", markup.Doc(hyphaName, textData).AsHTML())))
|
util.HTTP200Page(w, base("Preview "+hyphaName, templates.PreviewHTML(rq, hyphaName, textData, "", markup.Doc(hyphaName, textData).AsHTML()), u))
|
||||||
} else if hop := UploadText(hyphaName, textData, u); len(hop.Errs) != 0 {
|
} else if hop := UploadText(hyphaName, textData, u); len(hop.Errs) != 0 {
|
||||||
HttpErr(w, http.StatusInternalServerError, hyphaName, "Error", hop.Errs[0].Error())
|
HttpErr(w, http.StatusInternalServerError, hyphaName, "Error", hop.Errs[0].Error())
|
||||||
} else {
|
} else {
|
||||||
|
@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/bouncepaw/mycorrhiza/markup"
|
"github.com/bouncepaw/mycorrhiza/markup"
|
||||||
"github.com/bouncepaw/mycorrhiza/templates"
|
"github.com/bouncepaw/mycorrhiza/templates"
|
||||||
"github.com/bouncepaw/mycorrhiza/tree"
|
"github.com/bouncepaw/mycorrhiza/tree"
|
||||||
|
"github.com/bouncepaw/mycorrhiza/user"
|
||||||
"github.com/bouncepaw/mycorrhiza/util"
|
"github.com/bouncepaw/mycorrhiza/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -34,6 +35,7 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
|
|||||||
contents = fmt.Sprintf(`<p>This hypha had no text at this revision.</p>`)
|
contents = fmt.Sprintf(`<p>This hypha had no text at this revision.</p>`)
|
||||||
textPath = hyphaName + ".myco"
|
textPath = hyphaName + ".myco"
|
||||||
textContents, err = history.FileAtRevision(textPath, revHash)
|
textContents, err = history.FileAtRevision(textPath, revHash)
|
||||||
|
u = user.FromRequest(rq)
|
||||||
)
|
)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
contents = markup.Doc(hyphaName, textContents).AsHTML()
|
contents = markup.Doc(hyphaName, textContents).AsHTML()
|
||||||
@ -49,7 +51,7 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
|
|||||||
)
|
)
|
||||||
w.Header().Set("Content-Type", "text/html;charset=utf-8")
|
w.Header().Set("Content-Type", "text/html;charset=utf-8")
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(base(hyphaName, page)))
|
w.Write([]byte(base(hyphaName, page, u)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// handlerText serves raw source text of the hypha.
|
// handlerText serves raw source text of the hypha.
|
||||||
@ -83,6 +85,7 @@ func handlerPage(w http.ResponseWriter, rq *http.Request) {
|
|||||||
hasAmnt = hyphaExists && data.binaryPath != ""
|
hasAmnt = hyphaExists && data.binaryPath != ""
|
||||||
contents string
|
contents string
|
||||||
openGraph string
|
openGraph string
|
||||||
|
u = user.FromRequest(rq)
|
||||||
)
|
)
|
||||||
if hyphaExists {
|
if hyphaExists {
|
||||||
fileContentsT, errT := ioutil.ReadFile(data.textPath)
|
fileContentsT, errT := ioutil.ReadFile(data.textPath)
|
||||||
@ -105,5 +108,6 @@ func handlerPage(w http.ResponseWriter, rq *http.Request) {
|
|||||||
contents,
|
contents,
|
||||||
treeHTML, prevHypha, nextHypha,
|
treeHTML, prevHypha, nextHypha,
|
||||||
hasAmnt),
|
hasAmnt),
|
||||||
|
u,
|
||||||
openGraph))
|
openGraph))
|
||||||
}
|
}
|
||||||
|
18
main.go
18
main.go
@ -41,9 +41,18 @@ func HttpErr(w http.ResponseWriter, status int, name, title, errMsg string) {
|
|||||||
log.Println(errMsg, "for", name)
|
log.Println(errMsg, "for", name)
|
||||||
w.Header().Set("Content-Type", "text/html;charset=utf-8")
|
w.Header().Set("Content-Type", "text/html;charset=utf-8")
|
||||||
w.WriteHeader(status)
|
w.WriteHeader(status)
|
||||||
fmt.Fprint(w, base(title, fmt.Sprintf(
|
fmt.Fprint(
|
||||||
|
w,
|
||||||
|
base(
|
||||||
|
title,
|
||||||
|
fmt.Sprintf(
|
||||||
`<main><p>%s. <a href="/page/%s">Go back to the hypha.<a></p></main>`,
|
`<main><p>%s. <a href="/page/%s">Go back to the hypha.<a></p></main>`,
|
||||||
errMsg, name)))
|
errMsg,
|
||||||
|
name,
|
||||||
|
),
|
||||||
|
user.EmptyUser(),
|
||||||
|
),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show all hyphae
|
// Show all hyphae
|
||||||
@ -52,11 +61,12 @@ func handlerList(w http.ResponseWriter, rq *http.Request) {
|
|||||||
var (
|
var (
|
||||||
tbody string
|
tbody string
|
||||||
pageCount = hyphae.Count()
|
pageCount = hyphae.Count()
|
||||||
|
u = user.FromRequest(rq)
|
||||||
)
|
)
|
||||||
for hyphaName, data := range HyphaStorage {
|
for hyphaName, data := range HyphaStorage {
|
||||||
tbody += templates.HyphaListRowHTML(hyphaName, ExtensionToMime(filepath.Ext(data.binaryPath)), data.binaryPath != "")
|
tbody += templates.HyphaListRowHTML(hyphaName, ExtensionToMime(filepath.Ext(data.binaryPath)), data.binaryPath != "")
|
||||||
}
|
}
|
||||||
util.HTTP200Page(w, base("List of pages", templates.HyphaListHTML(tbody, pageCount)))
|
util.HTTP200Page(w, base("List of pages", templates.HyphaListHTML(tbody, pageCount), u))
|
||||||
}
|
}
|
||||||
|
|
||||||
// This part is present in all html documents.
|
// This part is present in all html documents.
|
||||||
@ -146,7 +156,7 @@ func handlerIcon(w http.ResponseWriter, rq *http.Request) {
|
|||||||
func handlerAbout(w http.ResponseWriter, rq *http.Request) {
|
func handlerAbout(w http.ResponseWriter, rq *http.Request) {
|
||||||
w.Header().Set("Content-Type", "text/html;charset=utf-8")
|
w.Header().Set("Content-Type", "text/html;charset=utf-8")
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
w.Write([]byte(base("About "+util.SiteName, templates.AboutHTML())))
|
w.Write([]byte(base("About "+util.SiteName, templates.AboutHTML(), user.FromRequest(rq))))
|
||||||
}
|
}
|
||||||
|
|
||||||
func handlerRobotsTxt(w http.ResponseWriter, rq *http.Request) {
|
func handlerRobotsTxt(w http.ResponseWriter, rq *http.Request) {
|
||||||
|
@ -29,6 +29,7 @@ func StreamDefaultCSS(qw422016 *qt422016.Writer) {
|
|||||||
.hypha-tabs { padding: 1rem 2rem; margin: 0 auto; width: 800px; }
|
.hypha-tabs { padding: 1rem 2rem; margin: 0 auto; width: 800px; }
|
||||||
header { margin: 0 auto; width: 800px; }
|
header { margin: 0 auto; width: 800px; }
|
||||||
.header-links__entry { margin-right: 1.5rem; }
|
.header-links__entry { margin-right: 1.5rem; }
|
||||||
|
.header-links__entry_user { margin: 0 2rem 0 auto; }
|
||||||
.header-links__entry:nth-of-type(1),
|
.header-links__entry:nth-of-type(1),
|
||||||
.hypha-tabs__tab:nth-of-type(1) { margin-left: 2rem; }
|
.hypha-tabs__tab:nth-of-type(1) { margin-left: 2rem; }
|
||||||
.hypha-tabs__tab { margin-right: 1.5rem; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2); border-bottom: 2px #ddd solid; padding: 0 .5rem; }
|
.hypha-tabs__tab { margin-right: 1.5rem; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2); border-bottom: 2px #ddd solid; padding: 0 .5rem; }
|
||||||
@ -94,13 +95,13 @@ figcaption { padding-bottom: .5rem; }
|
|||||||
#new-name {width:100%;}
|
#new-name {width:100%;}
|
||||||
|
|
||||||
header { margin-bottom: .5rem; }
|
header { margin-bottom: .5rem; }
|
||||||
|
.header-links__entry_user { font-style:italic; }
|
||||||
.header-links__link { text-decoration: none; display: block; width: 100%; height: 100%; padding: .25rem; }
|
.header-links__link { text-decoration: none; display: block; width: 100%; height: 100%; padding: .25rem; }
|
||||||
.hypha-tabs { padding: 0; }
|
.hypha-tabs { padding: 0; }
|
||||||
.header-links__list, .hypha-tabs__flex { margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
|
.header-links__list, .hypha-tabs__flex { margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
|
||||||
.header-links__entry, .hypha-tabs__tab { list-style-type: none; }
|
.header-links__entry, .hypha-tabs__tab { list-style-type: none; }
|
||||||
.hypha-tabs__tab a { text-decoration: none; }
|
.hypha-tabs__tab a { text-decoration: none; }
|
||||||
.hypha-tabs__tab_active { font-weight: bold; }
|
.hypha-tabs__tab_active { font-weight: bold; }
|
||||||
.hypha-tabs__user { font-style:italic; }
|
|
||||||
|
|
||||||
.rc-entry { display: grid; list-style-type: none; padding: .25rem; grid-template-columns: 1fr 1fr; }
|
.rc-entry { display: grid; list-style-type: none; padding: .25rem; grid-template-columns: 1fr 1fr; }
|
||||||
.rc-entry__time { font-style: italic; }
|
.rc-entry__time { font-style: italic; }
|
||||||
|
@ -41,18 +41,17 @@ var navEntries = []navEntry{
|
|||||||
</li>
|
</li>
|
||||||
{%- endif -%}
|
{%- endif -%}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{%s= userMenuHTML(u) %}
|
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
{% endfunc %}
|
{% endfunc %}
|
||||||
|
|
||||||
{% func userMenuHTML(u *user.User) %}
|
{% func userMenuHTML(u *user.User) %}
|
||||||
{% if user.AuthUsed %}
|
{% if user.AuthUsed %}
|
||||||
<li class="hypha-tabs__tab hypha-tabs__user">
|
<li class="header-links__entry header-links__entry_user">
|
||||||
{% if u.Group == "anon" %}
|
{% if u.Group == "anon" %}
|
||||||
<a href="/login">Login</a>
|
<a href="/login" class="header-links__link">Login</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="/page/{%s util.UserHypha %}/{%s u.Name %}">{%s u.Name %}</a>
|
<a href="/page/{%s util.UserHypha %}/{%s u.Name %}" class="header-links__link">{%s u.Name %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -106,114 +106,109 @@ func streamnavHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navTy
|
|||||||
//line templates/common.qtpl:43
|
//line templates/common.qtpl:43
|
||||||
}
|
}
|
||||||
//line templates/common.qtpl:43
|
//line templates/common.qtpl:43
|
||||||
qw422016.N().S(` `)
|
qw422016.N().S(` </ul>
|
||||||
//line templates/common.qtpl:44
|
|
||||||
qw422016.N().S(userMenuHTML(u))
|
|
||||||
//line templates/common.qtpl:44
|
|
||||||
qw422016.N().S(`
|
|
||||||
</ul>
|
|
||||||
</nav>
|
</nav>
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
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 templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
streamnavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
|
streamnavHTML(qw422016, rq, hyphaName, navType, revisionHash...)
|
||||||
//line templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
|
func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string {
|
||||||
//line templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
writenavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
|
writenavHTML(qb422016, rq, hyphaName, navType, revisionHash...)
|
||||||
//line templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/common.qtpl:47
|
//line templates/common.qtpl:46
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:49
|
//line templates/common.qtpl:48
|
||||||
func streamuserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
|
func streamuserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
|
||||||
|
//line templates/common.qtpl:48
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line templates/common.qtpl:49
|
||||||
|
if user.AuthUsed {
|
||||||
//line templates/common.qtpl:49
|
//line templates/common.qtpl:49
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
|
<li class="header-links__entry header-links__entry_user">
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:50
|
//line templates/common.qtpl:51
|
||||||
if user.AuthUsed {
|
|
||||||
//line templates/common.qtpl:50
|
|
||||||
qw422016.N().S(`
|
|
||||||
<li class="hypha-tabs__tab hypha-tabs__user">
|
|
||||||
`)
|
|
||||||
//line templates/common.qtpl:52
|
|
||||||
if u.Group == "anon" {
|
if u.Group == "anon" {
|
||||||
//line templates/common.qtpl:52
|
//line templates/common.qtpl:51
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<a href="/login">Login</a>
|
<a href="/login" class="header-links__link">Login</a>
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:54
|
//line templates/common.qtpl:53
|
||||||
} else {
|
} else {
|
||||||
//line templates/common.qtpl:54
|
//line templates/common.qtpl:53
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<a href="/page/`)
|
<a href="/page/`)
|
||||||
//line templates/common.qtpl:55
|
//line templates/common.qtpl:54
|
||||||
qw422016.E().S(util.UserHypha)
|
qw422016.E().S(util.UserHypha)
|
||||||
//line templates/common.qtpl:55
|
//line templates/common.qtpl:54
|
||||||
qw422016.N().S(`/`)
|
qw422016.N().S(`/`)
|
||||||
//line templates/common.qtpl:55
|
//line templates/common.qtpl:54
|
||||||
qw422016.E().S(u.Name)
|
qw422016.E().S(u.Name)
|
||||||
//line templates/common.qtpl:55
|
//line templates/common.qtpl:54
|
||||||
qw422016.N().S(`">`)
|
qw422016.N().S(`" class="header-links__link">`)
|
||||||
//line templates/common.qtpl:55
|
//line templates/common.qtpl:54
|
||||||
qw422016.E().S(u.Name)
|
qw422016.E().S(u.Name)
|
||||||
//line templates/common.qtpl:55
|
//line templates/common.qtpl:54
|
||||||
qw422016.N().S(`</a>
|
qw422016.N().S(`</a>
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:56
|
//line templates/common.qtpl:55
|
||||||
}
|
}
|
||||||
//line templates/common.qtpl:56
|
//line templates/common.qtpl:55
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</li>
|
</li>
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:57
|
||||||
}
|
}
|
||||||
//line templates/common.qtpl:58
|
//line templates/common.qtpl:57
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
func writeuserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
|
func writeuserMenuHTML(qq422016 qtio422016.Writer, u *user.User) {
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
streamuserMenuHTML(qw422016, u)
|
streamuserMenuHTML(qw422016, u)
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
func userMenuHTML(u *user.User) string {
|
func userMenuHTML(u *user.User) string {
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
writeuserMenuHTML(qb422016, u)
|
writeuserMenuHTML(qb422016, u)
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/common.qtpl:59
|
//line templates/common.qtpl:58
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
.hypha-tabs { padding: 1rem 2rem; margin: 0 auto; width: 800px; }
|
.hypha-tabs { padding: 1rem 2rem; margin: 0 auto; width: 800px; }
|
||||||
header { margin: 0 auto; width: 800px; }
|
header { margin: 0 auto; width: 800px; }
|
||||||
.header-links__entry { margin-right: 1.5rem; }
|
.header-links__entry { margin-right: 1.5rem; }
|
||||||
|
.header-links__entry_user { margin: 0 2rem 0 auto; }
|
||||||
.header-links__entry:nth-of-type(1),
|
.header-links__entry:nth-of-type(1),
|
||||||
.hypha-tabs__tab:nth-of-type(1) { margin-left: 2rem; }
|
.hypha-tabs__tab:nth-of-type(1) { margin-left: 2rem; }
|
||||||
.hypha-tabs__tab { margin-right: 1.5rem; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2); border-bottom: 2px #ddd solid; padding: 0 .5rem; }
|
.hypha-tabs__tab { margin-right: 1.5rem; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2); border-bottom: 2px #ddd solid; padding: 0 .5rem; }
|
||||||
@ -69,13 +70,13 @@ figcaption { padding-bottom: .5rem; }
|
|||||||
#new-name {width:100%;}
|
#new-name {width:100%;}
|
||||||
|
|
||||||
header { margin-bottom: .5rem; }
|
header { margin-bottom: .5rem; }
|
||||||
|
.header-links__entry_user { font-style:italic; }
|
||||||
.header-links__link { text-decoration: none; display: block; width: 100%; height: 100%; padding: .25rem; }
|
.header-links__link { text-decoration: none; display: block; width: 100%; height: 100%; padding: .25rem; }
|
||||||
.hypha-tabs { padding: 0; }
|
.hypha-tabs { padding: 0; }
|
||||||
.header-links__list, .hypha-tabs__flex { margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
|
.header-links__list, .hypha-tabs__flex { margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
|
||||||
.header-links__entry, .hypha-tabs__tab { list-style-type: none; }
|
.header-links__entry, .hypha-tabs__tab { list-style-type: none; }
|
||||||
.hypha-tabs__tab a { text-decoration: none; }
|
.hypha-tabs__tab a { text-decoration: none; }
|
||||||
.hypha-tabs__tab_active { font-weight: bold; }
|
.hypha-tabs__tab_active { font-weight: bold; }
|
||||||
.hypha-tabs__user { font-style:italic; }
|
|
||||||
|
|
||||||
.rc-entry { display: grid; list-style-type: none; padding: .25rem; grid-template-columns: 1fr 1fr; }
|
.rc-entry { display: grid; list-style-type: none; padding: .25rem; grid-template-columns: 1fr 1fr; }
|
||||||
.rc-entry__time { font-style: italic; }
|
.rc-entry__time { font-style: italic; }
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||||
|
|
||||||
{% func BaseHTML(title, body string, headElements ...string) %}
|
{% func BaseHTML(title, body string, u *user.User, headElements ...string) %}
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@ -17,6 +17,7 @@
|
|||||||
{%- for _, link := range util.HeaderLinks -%}
|
{%- for _, link := range util.HeaderLinks -%}
|
||||||
<li class="header-links__entry"><a class="header-links__link" href="{%s link.Href %}">{%s link.Display %}</a></li>
|
<li class="header-links__entry"><a class="header-links__link" href="{%s link.Href %}">{%s link.Display %}</a></li>
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
|
{%s= userMenuHTML(u) %}
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
@ -24,7 +24,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:4
|
//line templates/http_stuff.qtpl:4
|
||||||
func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, headElements ...string) {
|
func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, u *user.User, headElements ...string) {
|
||||||
//line templates/http_stuff.qtpl:4
|
//line templates/http_stuff.qtpl:4
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
@ -68,56 +68,61 @@ func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, headElements
|
|||||||
//line templates/http_stuff.qtpl:19
|
//line templates/http_stuff.qtpl:19
|
||||||
}
|
}
|
||||||
//line templates/http_stuff.qtpl:19
|
//line templates/http_stuff.qtpl:19
|
||||||
qw422016.N().S(` </ul>
|
qw422016.N().S(` `)
|
||||||
|
//line templates/http_stuff.qtpl:20
|
||||||
|
qw422016.N().S(userMenuHTML(u))
|
||||||
|
//line templates/http_stuff.qtpl:20
|
||||||
|
qw422016.N().S(`
|
||||||
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:23
|
//line templates/http_stuff.qtpl:24
|
||||||
qw422016.N().S(body)
|
qw422016.N().S(body)
|
||||||
//line templates/http_stuff.qtpl:23
|
//line templates/http_stuff.qtpl:24
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
func WriteBaseHTML(qq422016 qtio422016.Writer, title, body string, headElements ...string) {
|
func WriteBaseHTML(qq422016 qtio422016.Writer, title, body string, u *user.User, headElements ...string) {
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
StreamBaseHTML(qw422016, title, body, headElements...)
|
StreamBaseHTML(qw422016, title, body, u, headElements...)
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
func BaseHTML(title, body string, headElements ...string) string {
|
func BaseHTML(title, body string, u *user.User, headElements ...string) string {
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
WriteBaseHTML(qb422016, title, body, headElements...)
|
WriteBaseHTML(qb422016, title, body, u, headElements...)
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/http_stuff.qtpl:26
|
//line templates/http_stuff.qtpl:27
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:28
|
//line templates/http_stuff.qtpl:29
|
||||||
func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int) {
|
func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int) {
|
||||||
//line templates/http_stuff.qtpl:28
|
//line templates/http_stuff.qtpl:29
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<main>
|
<main>
|
||||||
<h1>List of hyphae</h1>
|
<h1>List of hyphae</h1>
|
||||||
<p>This wiki has `)
|
<p>This wiki has `)
|
||||||
//line templates/http_stuff.qtpl:31
|
//line templates/http_stuff.qtpl:32
|
||||||
qw422016.N().D(pageCount)
|
qw422016.N().D(pageCount)
|
||||||
//line templates/http_stuff.qtpl:31
|
//line templates/http_stuff.qtpl:32
|
||||||
qw422016.N().S(` hyphae.</p>
|
qw422016.N().S(` hyphae.</p>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
@ -128,203 +133,203 @@ func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int)
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:40
|
//line templates/http_stuff.qtpl:41
|
||||||
qw422016.N().S(tbody)
|
qw422016.N().S(tbody)
|
||||||
//line templates/http_stuff.qtpl:40
|
//line templates/http_stuff.qtpl:41
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</main>
|
</main>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
func WriteHyphaListHTML(qq422016 qtio422016.Writer, tbody string, pageCount int) {
|
func WriteHyphaListHTML(qq422016 qtio422016.Writer, tbody string, pageCount int) {
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
StreamHyphaListHTML(qw422016, tbody, pageCount)
|
StreamHyphaListHTML(qw422016, tbody, pageCount)
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
func HyphaListHTML(tbody string, pageCount int) string {
|
func HyphaListHTML(tbody string, pageCount int) string {
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
WriteHyphaListHTML(qb422016, tbody, pageCount)
|
WriteHyphaListHTML(qb422016, tbody, pageCount)
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/http_stuff.qtpl:44
|
//line templates/http_stuff.qtpl:45
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:46
|
//line templates/http_stuff.qtpl:47
|
||||||
func StreamHyphaListRowHTML(qw422016 *qt422016.Writer, hyphaName, binaryMime string, binaryPresent bool) {
|
func StreamHyphaListRowHTML(qw422016 *qt422016.Writer, hyphaName, binaryMime string, binaryPresent bool) {
|
||||||
//line templates/http_stuff.qtpl:46
|
//line templates/http_stuff.qtpl:47
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="/page/`)
|
<td><a href="/page/`)
|
||||||
//line templates/http_stuff.qtpl:48
|
//line templates/http_stuff.qtpl:49
|
||||||
qw422016.E().S(hyphaName)
|
qw422016.E().S(hyphaName)
|
||||||
//line templates/http_stuff.qtpl:48
|
//line templates/http_stuff.qtpl:49
|
||||||
qw422016.N().S(`">`)
|
qw422016.N().S(`">`)
|
||||||
//line templates/http_stuff.qtpl:48
|
//line templates/http_stuff.qtpl:49
|
||||||
qw422016.E().S(hyphaName)
|
qw422016.E().S(hyphaName)
|
||||||
//line templates/http_stuff.qtpl:48
|
//line templates/http_stuff.qtpl:49
|
||||||
qw422016.N().S(`</a></td>
|
qw422016.N().S(`</a></td>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:49
|
//line templates/http_stuff.qtpl:50
|
||||||
if binaryPresent {
|
if binaryPresent {
|
||||||
//line templates/http_stuff.qtpl:49
|
//line templates/http_stuff.qtpl:50
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<td>`)
|
<td>`)
|
||||||
//line templates/http_stuff.qtpl:50
|
//line templates/http_stuff.qtpl:51
|
||||||
qw422016.E().S(binaryMime)
|
qw422016.E().S(binaryMime)
|
||||||
//line templates/http_stuff.qtpl:50
|
//line templates/http_stuff.qtpl:51
|
||||||
qw422016.N().S(`</td>
|
qw422016.N().S(`</td>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:51
|
//line templates/http_stuff.qtpl:52
|
||||||
} else {
|
} else {
|
||||||
//line templates/http_stuff.qtpl:51
|
//line templates/http_stuff.qtpl:52
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<td></td>
|
<td></td>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:53
|
//line templates/http_stuff.qtpl:54
|
||||||
}
|
}
|
||||||
//line templates/http_stuff.qtpl:53
|
//line templates/http_stuff.qtpl:54
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</tr>
|
</tr>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
func WriteHyphaListRowHTML(qq422016 qtio422016.Writer, hyphaName, binaryMime string, binaryPresent bool) {
|
func WriteHyphaListRowHTML(qq422016 qtio422016.Writer, hyphaName, binaryMime string, binaryPresent bool) {
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
StreamHyphaListRowHTML(qw422016, hyphaName, binaryMime, binaryPresent)
|
StreamHyphaListRowHTML(qw422016, hyphaName, binaryMime, binaryPresent)
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
func HyphaListRowHTML(hyphaName, binaryMime string, binaryPresent bool) string {
|
func HyphaListRowHTML(hyphaName, binaryMime string, binaryPresent bool) string {
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
WriteHyphaListRowHTML(qb422016, hyphaName, binaryMime, binaryPresent)
|
WriteHyphaListRowHTML(qb422016, hyphaName, binaryMime, binaryPresent)
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/http_stuff.qtpl:55
|
//line templates/http_stuff.qtpl:56
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:57
|
//line templates/http_stuff.qtpl:58
|
||||||
func StreamAboutHTML(qw422016 *qt422016.Writer) {
|
func StreamAboutHTML(qw422016 *qt422016.Writer) {
|
||||||
//line templates/http_stuff.qtpl:57
|
//line templates/http_stuff.qtpl:58
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<main>
|
<main>
|
||||||
<section>
|
<section>
|
||||||
<h1>About `)
|
<h1>About `)
|
||||||
//line templates/http_stuff.qtpl:60
|
//line templates/http_stuff.qtpl:61
|
||||||
qw422016.E().S(util.SiteName)
|
qw422016.E().S(util.SiteName)
|
||||||
//line templates/http_stuff.qtpl:60
|
//line templates/http_stuff.qtpl:61
|
||||||
qw422016.N().S(`</h1>
|
qw422016.N().S(`</h1>
|
||||||
<ul>
|
<ul>
|
||||||
<li><b><a href="https://mycorrhiza.lesarbr.es">MycorrhizaWiki</a> version:</b> β 0.12 indev</li>
|
<li><b><a href="https://mycorrhiza.lesarbr.es">MycorrhizaWiki</a> version:</b> β 0.12 indev</li>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:63
|
//line templates/http_stuff.qtpl:64
|
||||||
if user.AuthUsed {
|
if user.AuthUsed {
|
||||||
//line templates/http_stuff.qtpl:63
|
//line templates/http_stuff.qtpl:64
|
||||||
qw422016.N().S(` <li><b>User count:</b> `)
|
qw422016.N().S(` <li><b>User count:</b> `)
|
||||||
//line templates/http_stuff.qtpl:64
|
//line templates/http_stuff.qtpl:65
|
||||||
qw422016.N().D(user.Count())
|
qw422016.N().D(user.Count())
|
||||||
//line templates/http_stuff.qtpl:64
|
//line templates/http_stuff.qtpl:65
|
||||||
qw422016.N().S(`</li>
|
qw422016.N().S(`</li>
|
||||||
<li><b>Home page:</b> <a href="/">`)
|
<li><b>Home page:</b> <a href="/">`)
|
||||||
//line templates/http_stuff.qtpl:65
|
//line templates/http_stuff.qtpl:66
|
||||||
qw422016.E().S(util.HomePage)
|
qw422016.E().S(util.HomePage)
|
||||||
//line templates/http_stuff.qtpl:65
|
//line templates/http_stuff.qtpl:66
|
||||||
qw422016.N().S(`</a></li>
|
qw422016.N().S(`</a></li>
|
||||||
<li><b>Administrators:</b>`)
|
<li><b>Administrators:</b>`)
|
||||||
//line templates/http_stuff.qtpl:66
|
//line templates/http_stuff.qtpl:67
|
||||||
for i, username := range user.ListUsersWithGroup("admin") {
|
for i, username := range user.ListUsersWithGroup("admin") {
|
||||||
//line templates/http_stuff.qtpl:67
|
//line templates/http_stuff.qtpl:68
|
||||||
if i > 0 {
|
if i > 0 {
|
||||||
//line templates/http_stuff.qtpl:67
|
//line templates/http_stuff.qtpl:68
|
||||||
qw422016.N().S(`<span aria-hidden="true">, </span>
|
qw422016.N().S(`<span aria-hidden="true">, </span>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:68
|
//line templates/http_stuff.qtpl:69
|
||||||
}
|
}
|
||||||
//line templates/http_stuff.qtpl:68
|
//line templates/http_stuff.qtpl:69
|
||||||
qw422016.N().S(` <a href="/page/`)
|
qw422016.N().S(` <a href="/page/`)
|
||||||
//line templates/http_stuff.qtpl:69
|
//line templates/http_stuff.qtpl:70
|
||||||
qw422016.E().S(util.UserHypha)
|
qw422016.E().S(util.UserHypha)
|
||||||
//line templates/http_stuff.qtpl:69
|
//line templates/http_stuff.qtpl:70
|
||||||
qw422016.N().S(`/`)
|
qw422016.N().S(`/`)
|
||||||
//line templates/http_stuff.qtpl:69
|
//line templates/http_stuff.qtpl:70
|
||||||
qw422016.E().S(username)
|
qw422016.E().S(username)
|
||||||
//line templates/http_stuff.qtpl:69
|
//line templates/http_stuff.qtpl:70
|
||||||
qw422016.N().S(`">`)
|
qw422016.N().S(`">`)
|
||||||
//line templates/http_stuff.qtpl:69
|
//line templates/http_stuff.qtpl:70
|
||||||
qw422016.E().S(username)
|
qw422016.E().S(username)
|
||||||
//line templates/http_stuff.qtpl:69
|
//line templates/http_stuff.qtpl:70
|
||||||
qw422016.N().S(`</a>`)
|
qw422016.N().S(`</a>`)
|
||||||
//line templates/http_stuff.qtpl:69
|
//line templates/http_stuff.qtpl:70
|
||||||
}
|
}
|
||||||
//line templates/http_stuff.qtpl:69
|
//line templates/http_stuff.qtpl:70
|
||||||
qw422016.N().S(`</li>
|
qw422016.N().S(`</li>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:70
|
//line templates/http_stuff.qtpl:71
|
||||||
} else {
|
} else {
|
||||||
//line templates/http_stuff.qtpl:70
|
//line templates/http_stuff.qtpl:71
|
||||||
qw422016.N().S(` <li>This wiki does not use authorization</li>
|
qw422016.N().S(` <li>This wiki does not use authorization</li>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:72
|
//line templates/http_stuff.qtpl:73
|
||||||
}
|
}
|
||||||
//line templates/http_stuff.qtpl:72
|
//line templates/http_stuff.qtpl:73
|
||||||
qw422016.N().S(` </ul>
|
qw422016.N().S(` </ul>
|
||||||
<p>See <a href="/list">/list</a> for information about hyphae on this wiki.</p>
|
<p>See <a href="/list">/list</a> for information about hyphae on this wiki.</p>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
func WriteAboutHTML(qq422016 qtio422016.Writer) {
|
func WriteAboutHTML(qq422016 qtio422016.Writer) {
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
StreamAboutHTML(qw422016)
|
StreamAboutHTML(qw422016)
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
func AboutHTML() string {
|
func AboutHTML() string {
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
WriteAboutHTML(qb422016)
|
WriteAboutHTML(qb422016)
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/http_stuff.qtpl:77
|
//line templates/http_stuff.qtpl:78
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ func CanProceed(rq *http.Request, route string) bool {
|
|||||||
func FromRequest(rq *http.Request) *User {
|
func FromRequest(rq *http.Request) *User {
|
||||||
cookie, err := rq.Cookie("mycorrhiza_token")
|
cookie, err := rq.Cookie("mycorrhiza_token")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return emptyUser()
|
return EmptyUser()
|
||||||
}
|
}
|
||||||
return userByToken(cookie.Value)
|
return userByToken(cookie.Value)
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ var groupRight = map[string]int{
|
|||||||
"admin": 4,
|
"admin": 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
func emptyUser() *User {
|
func EmptyUser() *User {
|
||||||
return &User{
|
return &User{
|
||||||
Name: "anon",
|
Name: "anon",
|
||||||
Group: "anon",
|
Group: "anon",
|
||||||
|
@ -44,7 +44,7 @@ func userByToken(token string) *User {
|
|||||||
username := usernameUntyped.(string)
|
username := usernameUntyped.(string)
|
||||||
return userByName(username)
|
return userByName(username)
|
||||||
}
|
}
|
||||||
return emptyUser()
|
return EmptyUser()
|
||||||
}
|
}
|
||||||
|
|
||||||
func userByName(username string) *User {
|
func userByName(username string) *User {
|
||||||
@ -52,7 +52,7 @@ func userByName(username string) *User {
|
|||||||
user := userUntyped.(*User)
|
user := userUntyped.(*User)
|
||||||
return user
|
return user
|
||||||
}
|
}
|
||||||
return emptyUser()
|
return EmptyUser()
|
||||||
}
|
}
|
||||||
|
|
||||||
func commenceSession(username, token string) {
|
func commenceSession(username, token string) {
|
||||||
|
Loading…
Reference in New Issue
Block a user