mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-18 22:52:50 +00:00
Add renaming support
This commit is contained in:
parent
3a1d1c2ce2
commit
2add791ba9
@ -5,7 +5,7 @@ A wiki engine.
|
||||
This is a development branch for 0.9 version. Features I want to implement in this release:
|
||||
* [x] Recent changes page.
|
||||
* [x] Hypha deletion.
|
||||
* [ ] Hypha renaming.
|
||||
* [x] Hypha renaming.
|
||||
* [x] Support async git ops.
|
||||
|
||||
## Installation
|
||||
|
@ -64,6 +64,16 @@ func (hop *HistoryOp) WithFilesRemoved(paths ...string) *HistoryOp {
|
||||
return hop.gitop(args...)
|
||||
}
|
||||
|
||||
// WithFilesRenamed git-mv-s all passed keys of `pairs` to values of `pairs`. Paths can be rooted ot not. Empty keys are ignored.
|
||||
func (hop *HistoryOp) WithFilesRenamed(pairs map[string]string) *HistoryOp {
|
||||
for from, to := range pairs {
|
||||
if from != "" {
|
||||
hop.gitop(append([]string{"mv"}, from, to)...)
|
||||
}
|
||||
}
|
||||
return hop
|
||||
}
|
||||
|
||||
// WithFiles stages all passed `paths`. Paths can be rooted or not.
|
||||
func (hop *HistoryOp) WithFiles(paths ...string) *HistoryOp {
|
||||
for i, path := range paths {
|
||||
|
@ -19,6 +19,49 @@ func init() {
|
||||
http.HandleFunc("/edit/", handlerEdit)
|
||||
http.HandleFunc("/delete-ask/", handlerDeleteAsk)
|
||||
http.HandleFunc("/delete-confirm/", handlerDeleteConfirm)
|
||||
http.HandleFunc("/rename-ask/", handlerRenameAsk)
|
||||
http.HandleFunc("/rename-confirm/", handlerRenameConfirm)
|
||||
}
|
||||
|
||||
func handlerRenameAsk(w http.ResponseWriter, rq *http.Request) {
|
||||
log.Println(rq.URL)
|
||||
var (
|
||||
hyphaName = HyphaNameFromRq(rq, "rename-ask")
|
||||
_, isOld = HyphaStorage[hyphaName]
|
||||
)
|
||||
util.HTTP200Page(w, base("Rename "+hyphaName+"?", templates.RenameAskHTML(hyphaName, isOld)))
|
||||
}
|
||||
|
||||
func handlerRenameConfirm(w http.ResponseWriter, rq *http.Request) {
|
||||
log.Println(rq.URL)
|
||||
var (
|
||||
hyphaName = HyphaNameFromRq(rq, "rename-confirm")
|
||||
hyphaData, isOld = HyphaStorage[hyphaName]
|
||||
newName = CanonicalName(rq.PostFormValue("new-name"))
|
||||
_, newNameIsUsed = HyphaStorage[newName]
|
||||
)
|
||||
switch {
|
||||
case newNameIsUsed:
|
||||
HttpErr(w, http.StatusBadRequest, hyphaName, "Error: hypha exists",
|
||||
fmt.Sprintf("Hypha named <a href='/page/%s'>%s</a> already exists.", hyphaName, hyphaName))
|
||||
case newName == "":
|
||||
HttpErr(w, http.StatusBadRequest, hyphaName, "Error: no name",
|
||||
"No new name is given.")
|
||||
case !isOld:
|
||||
HttpErr(w, http.StatusBadRequest, hyphaName, "Error: no such hypha",
|
||||
"Cannot rename a hypha that does not exist yet.")
|
||||
case !HyphaPattern.MatchString(newName):
|
||||
HttpErr(w, http.StatusBadRequest, hyphaName, "Error: invalid name",
|
||||
"Invalid new name. Names cannot contain characters <code>^?!:#@><*|\"\\'&%</code>")
|
||||
default:
|
||||
if hop := hyphaData.RenameHypha(hyphaName, newName); len(hop.Errs) == 0 {
|
||||
http.Redirect(w, rq, "/page/"+newName, http.StatusSeeOther)
|
||||
} else {
|
||||
HttpErr(w, http.StatusInternalServerError, hyphaName,
|
||||
"Error: could not rename hypha",
|
||||
fmt.Sprintf("Could not rename this hypha due to an internal error. Server errors: <code>%v</code>", hop.Errs))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// handlerDeleteAsk shows a delete dialog.
|
||||
|
24
hypha.go
24
hypha.go
@ -7,6 +7,7 @@ import (
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/gemtext"
|
||||
"github.com/bouncepaw/mycorrhiza/history"
|
||||
@ -47,6 +48,29 @@ func (hd *HyphaData) DeleteHypha(hyphaName string) *history.HistoryOp {
|
||||
Apply()
|
||||
}
|
||||
|
||||
// RenameHypha renames hypha from old name `hyphaName` to `newName` and makes a history record about that.
|
||||
func (hd *HyphaData) RenameHypha(hyphaName, newName string) *history.HistoryOp {
|
||||
var (
|
||||
newTextPath = strings.Replace(hd.textPath, hyphaName, newName, 1)
|
||||
newBinaryPath = strings.Replace(hd.binaryPath, hyphaName, newName, 1)
|
||||
hop = history.Operation(history.TypeRenameHypha).
|
||||
WithFilesRenamed(map[string]string{
|
||||
hd.textPath: newTextPath,
|
||||
hd.binaryPath: newBinaryPath,
|
||||
}).
|
||||
WithMsg(fmt.Sprintf("Rename ‘%s’ to ‘%s’", hyphaName, newName)).
|
||||
WithSignature("anon").
|
||||
Apply()
|
||||
)
|
||||
if len(hop.Errs) == 0 {
|
||||
hd.textPath = newTextPath
|
||||
hd.binaryPath = newBinaryPath
|
||||
HyphaStorage[newName] = hd
|
||||
delete(HyphaStorage, hyphaName)
|
||||
}
|
||||
return hop
|
||||
}
|
||||
|
||||
// binaryHtmlBlock creates an html block for binary part of the hypha.
|
||||
func binaryHtmlBlock(hyphaName string, d *HyphaData) string {
|
||||
switch d.binaryType {
|
||||
|
4
main.go
4
main.go
@ -21,7 +21,7 @@ import (
|
||||
// WikiDir is a rooted path to the wiki storage directory.
|
||||
var WikiDir string
|
||||
|
||||
// HyphaPattern is a pattern which all hyphae must match. Not used currently.
|
||||
// HyphaPattern is a pattern which all hyphae must match.
|
||||
var HyphaPattern = regexp.MustCompile(`[^?!:#@><*|"\'&%]+`)
|
||||
|
||||
// HyphaStorage is a mapping between canonical hypha names and their meta information.
|
||||
@ -120,7 +120,7 @@ func main() {
|
||||
|
||||
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(WikiDir+"/static"))))
|
||||
// See http_readers.go for /page/, /text/, /binary/, /history/.
|
||||
// See http_mutators.go for /upload-binary/, /upload-text/, /edit/, /delete-ask/, /delete-confirm/.
|
||||
// See http_mutators.go for /upload-binary/, /upload-text/, /edit/, /delete-ask/, /delete-confirm/, /rename-ask/, /rename-confirm/.
|
||||
http.HandleFunc("/list", handlerList)
|
||||
http.HandleFunc("/reindex", handlerReindex)
|
||||
http.HandleFunc("/random", handlerRandom)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 2c0e43199ed28f7022a38463a0eec3af3ecb03c9
|
||||
Subproject commit c21b47739bc149456acc205e2c5acfa4b9eeb9d7
|
32
templates/common.qtpl
Normal file
32
templates/common.qtpl
Normal file
@ -0,0 +1,32 @@
|
||||
This is the <nav> seen on top of many pages.
|
||||
{% code
|
||||
type navEntry struct {
|
||||
path string
|
||||
title string
|
||||
}
|
||||
var navEntries = []navEntry{
|
||||
{"page", "Hypha"},
|
||||
{"edit", "Edit"},
|
||||
{"text", "Raw text"},
|
||||
{"history", "History"},
|
||||
{"revision", "NOT REACHED"},
|
||||
{"delete-ask", "Delete"},
|
||||
{"rename-ask", "Rename"},
|
||||
}
|
||||
%}
|
||||
|
||||
{% func navHTML(hyphaName, navType string, revisionHash ...string) %}
|
||||
<nav>
|
||||
<ul>
|
||||
{%- for _, entry := range navEntries -%}
|
||||
{%- if navType == "revision" && entry.path == "revision" -%}
|
||||
<li><b>{%s revisionHash[0] %}</b></li>
|
||||
{%- elseif navType == entry.path -%}
|
||||
<li><b>{%s entry.title %}</b></li>
|
||||
{%- elseif entry.path != "revision"-%}
|
||||
<li><a href="/{%s entry.path %}/{%s hyphaName %}">{%s entry.title %}</a></li>
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
</ul>
|
||||
</nav>
|
||||
{% endfunc %}
|
117
templates/common.qtpl.go
Normal file
117
templates/common.qtpl.go
Normal file
@ -0,0 +1,117 @@
|
||||
// Code generated by qtc from "common.qtpl". DO NOT EDIT.
|
||||
// See https://github.com/valyala/quicktemplate for details.
|
||||
|
||||
// This is the <nav> seen on top of many pages.
|
||||
|
||||
//line templates/common.qtpl:2
|
||||
package templates
|
||||
|
||||
//line templates/common.qtpl:2
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/common.qtpl:2
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line templates/common.qtpl:3
|
||||
type navEntry struct {
|
||||
path string
|
||||
title string
|
||||
}
|
||||
|
||||
var navEntries = []navEntry{
|
||||
{"page", "Hypha"},
|
||||
{"edit", "Edit"},
|
||||
{"text", "Raw text"},
|
||||
{"history", "History"},
|
||||
{"revision", "NOT REACHED"},
|
||||
{"delete-ask", "Delete"},
|
||||
{"rename-ask", "Rename"},
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:18
|
||||
func streamnavHTML(qw422016 *qt422016.Writer, hyphaName, navType string, revisionHash ...string) {
|
||||
//line templates/common.qtpl:18
|
||||
qw422016.N().S(`
|
||||
<nav>
|
||||
<ul>
|
||||
`)
|
||||
//line templates/common.qtpl:21
|
||||
for _, entry := range navEntries {
|
||||
//line templates/common.qtpl:22
|
||||
if navType == "revision" && entry.path == "revision" {
|
||||
//line templates/common.qtpl:22
|
||||
qw422016.N().S(` <li><b>`)
|
||||
//line templates/common.qtpl:23
|
||||
qw422016.E().S(revisionHash[0])
|
||||
//line templates/common.qtpl:23
|
||||
qw422016.N().S(`</b></li>
|
||||
`)
|
||||
//line templates/common.qtpl:24
|
||||
} else if navType == entry.path {
|
||||
//line templates/common.qtpl:24
|
||||
qw422016.N().S(` <li><b>`)
|
||||
//line templates/common.qtpl:25
|
||||
qw422016.E().S(entry.title)
|
||||
//line templates/common.qtpl:25
|
||||
qw422016.N().S(`</b></li>
|
||||
`)
|
||||
//line templates/common.qtpl:26
|
||||
} else if entry.path != "revision" {
|
||||
//line templates/common.qtpl:26
|
||||
qw422016.N().S(` <li><a href="/`)
|
||||
//line templates/common.qtpl:27
|
||||
qw422016.E().S(entry.path)
|
||||
//line templates/common.qtpl:27
|
||||
qw422016.N().S(`/`)
|
||||
//line templates/common.qtpl:27
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/common.qtpl:27
|
||||
qw422016.N().S(`">`)
|
||||
//line templates/common.qtpl:27
|
||||
qw422016.E().S(entry.title)
|
||||
//line templates/common.qtpl:27
|
||||
qw422016.N().S(`</a></li>
|
||||
`)
|
||||
//line templates/common.qtpl:28
|
||||
}
|
||||
//line templates/common.qtpl:29
|
||||
}
|
||||
//line templates/common.qtpl:29
|
||||
qw422016.N().S(` </ul>
|
||||
</nav>
|
||||
`)
|
||||
//line templates/common.qtpl:32
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:32
|
||||
func writenavHTML(qq422016 qtio422016.Writer, hyphaName, navType string, revisionHash ...string) {
|
||||
//line templates/common.qtpl:32
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/common.qtpl:32
|
||||
streamnavHTML(qw422016, hyphaName, navType, revisionHash...)
|
||||
//line templates/common.qtpl:32
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/common.qtpl:32
|
||||
}
|
||||
|
||||
//line templates/common.qtpl:32
|
||||
func navHTML(hyphaName, navType string, revisionHash ...string) string {
|
||||
//line templates/common.qtpl:32
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/common.qtpl:32
|
||||
writenavHTML(qb422016, hyphaName, navType, revisionHash...)
|
||||
//line templates/common.qtpl:32
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/common.qtpl:32
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/common.qtpl:32
|
||||
return qs422016
|
||||
//line templates/common.qtpl:32
|
||||
}
|
@ -1,15 +1,7 @@
|
||||
This dialog is to be shown to a user when they try to delete a hypha.
|
||||
{% func DeleteAskHTML(hyphaName string, isOld bool) %}
|
||||
<main>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/page/{%s hyphaName %}">Hypha</a></li>
|
||||
<li><a href="/edit/{%s hyphaName %}">Edit</a></li>
|
||||
<li><a href="/text/{%s hyphaName %}">Raw text</a></li>
|
||||
<li><a href="/history/{%s hyphaName %}">History</a></li>
|
||||
<li><b>Delete</b></li>
|
||||
</ul>
|
||||
</nav>
|
||||
{%= navHTML(hyphaName, "delete-ask") %}
|
||||
{% if isOld %}
|
||||
<section>
|
||||
<h1>Delete {%s hyphaName %}?</h1>
|
||||
|
@ -24,148 +24,128 @@ func StreamDeleteAskHTML(qw422016 *qt422016.Writer, hyphaName string, isOld bool
|
||||
//line templates/http_delete.qtpl:2
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/page/`)
|
||||
//line templates/http_delete.qtpl:6
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:6
|
||||
qw422016.N().S(`">Hypha</a></li>
|
||||
<li><a href="/edit/`)
|
||||
//line templates/http_delete.qtpl:7
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:7
|
||||
qw422016.N().S(`">Edit</a></li>
|
||||
<li><a href="/text/`)
|
||||
//line templates/http_delete.qtpl:8
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:8
|
||||
qw422016.N().S(`">Raw text</a></li>
|
||||
<li><a href="/history/`)
|
||||
//line templates/http_delete.qtpl:9
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:9
|
||||
qw422016.N().S(`">History</a></li>
|
||||
<li><b>Delete</b></li>
|
||||
</ul>
|
||||
</nav>
|
||||
`)
|
||||
//line templates/http_delete.qtpl:13
|
||||
//line templates/http_delete.qtpl:4
|
||||
streamnavHTML(qw422016, hyphaName, "delete-ask")
|
||||
//line templates/http_delete.qtpl:4
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_delete.qtpl:5
|
||||
if isOld {
|
||||
//line templates/http_delete.qtpl:13
|
||||
//line templates/http_delete.qtpl:5
|
||||
qw422016.N().S(`
|
||||
<section>
|
||||
<h1>Delete `)
|
||||
//line templates/http_delete.qtpl:15
|
||||
//line templates/http_delete.qtpl:7
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:15
|
||||
//line templates/http_delete.qtpl:7
|
||||
qw422016.N().S(`?</h1>
|
||||
<p>Do you really want to delete hypha <em>`)
|
||||
//line templates/http_delete.qtpl:16
|
||||
//line templates/http_delete.qtpl:8
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:16
|
||||
//line templates/http_delete.qtpl:8
|
||||
qw422016.N().S(`</em>?</p>
|
||||
<p>In this version of MycorrhizaWiki you cannot undelete a deleted hypha but the history can still be accessed.</p>
|
||||
<p><a href="/delete-confirm/`)
|
||||
//line templates/http_delete.qtpl:18
|
||||
//line templates/http_delete.qtpl:10
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:18
|
||||
//line templates/http_delete.qtpl:10
|
||||
qw422016.N().S(`"><strong>Confirm</strong></a></p>
|
||||
<p><a href="/page/`)
|
||||
//line templates/http_delete.qtpl:19
|
||||
//line templates/http_delete.qtpl:11
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:19
|
||||
//line templates/http_delete.qtpl:11
|
||||
qw422016.N().S(`">Cancel</a></p>
|
||||
</section>
|
||||
`)
|
||||
//line templates/http_delete.qtpl:21
|
||||
//line templates/http_delete.qtpl:13
|
||||
} else {
|
||||
//line templates/http_delete.qtpl:21
|
||||
//line templates/http_delete.qtpl:13
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_delete.qtpl:22
|
||||
//line templates/http_delete.qtpl:14
|
||||
streamcannotDeleteDueToNonExistence(qw422016, hyphaName)
|
||||
//line templates/http_delete.qtpl:22
|
||||
//line templates/http_delete.qtpl:14
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_delete.qtpl:23
|
||||
//line templates/http_delete.qtpl:15
|
||||
}
|
||||
//line templates/http_delete.qtpl:23
|
||||
//line templates/http_delete.qtpl:15
|
||||
qw422016.N().S(`
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
}
|
||||
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
func WriteDeleteAskHTML(qq422016 qtio422016.Writer, hyphaName string, isOld bool) {
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
StreamDeleteAskHTML(qw422016, hyphaName, isOld)
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
}
|
||||
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
func DeleteAskHTML(hyphaName string, isOld bool) string {
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
WriteDeleteAskHTML(qb422016, hyphaName, isOld)
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
return qs422016
|
||||
//line templates/http_delete.qtpl:25
|
||||
//line templates/http_delete.qtpl:17
|
||||
}
|
||||
|
||||
//line templates/http_delete.qtpl:27
|
||||
//line templates/http_delete.qtpl:19
|
||||
func streamcannotDeleteDueToNonExistence(qw422016 *qt422016.Writer, hyphaName string) {
|
||||
//line templates/http_delete.qtpl:27
|
||||
//line templates/http_delete.qtpl:19
|
||||
qw422016.N().S(`
|
||||
<section>
|
||||
<h1>Cannot delete `)
|
||||
//line templates/http_delete.qtpl:29
|
||||
//line templates/http_delete.qtpl:21
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:29
|
||||
//line templates/http_delete.qtpl:21
|
||||
qw422016.N().S(`</h1>
|
||||
<p>This hypha does not exist.</p>
|
||||
<p><a href="/page/`)
|
||||
//line templates/http_delete.qtpl:31
|
||||
//line templates/http_delete.qtpl:23
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:31
|
||||
//line templates/http_delete.qtpl:23
|
||||
qw422016.N().S(`">Go back</a></p>
|
||||
</section>
|
||||
`)
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
}
|
||||
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
func writecannotDeleteDueToNonExistence(qq422016 qtio422016.Writer, hyphaName string) {
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
streamcannotDeleteDueToNonExistence(qw422016, hyphaName)
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
}
|
||||
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
func cannotDeleteDueToNonExistence(hyphaName string) string {
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
writecannotDeleteDueToNonExistence(qb422016, hyphaName)
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
return qs422016
|
||||
//line templates/http_delete.qtpl:33
|
||||
//line templates/http_delete.qtpl:25
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
|
||||
{% func EditHTML(hyphaName, textAreaFill, warning string) %}
|
||||
<main>
|
||||
<h1>Edit {%s hyphaName %}</h1>
|
||||
|
@ -1,83 +1,83 @@
|
||||
// Code generated by qtc from "http_mutators.qtpl". DO NOT EDIT.
|
||||
// See https://github.com/valyala/quicktemplate for details.
|
||||
|
||||
//line templates/http_mutators.qtpl:2
|
||||
//line templates/http_mutators.qtpl:1
|
||||
package templates
|
||||
|
||||
//line templates/http_mutators.qtpl:2
|
||||
//line templates/http_mutators.qtpl:1
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/http_mutators.qtpl:2
|
||||
//line templates/http_mutators.qtpl:1
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line templates/http_mutators.qtpl:2
|
||||
//line templates/http_mutators.qtpl:1
|
||||
func StreamEditHTML(qw422016 *qt422016.Writer, hyphaName, textAreaFill, warning string) {
|
||||
//line templates/http_mutators.qtpl:2
|
||||
//line templates/http_mutators.qtpl:1
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
<h1>Edit `)
|
||||
//line templates/http_mutators.qtpl:4
|
||||
//line templates/http_mutators.qtpl:3
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_mutators.qtpl:4
|
||||
//line templates/http_mutators.qtpl:3
|
||||
qw422016.N().S(`</h1>
|
||||
`)
|
||||
//line templates/http_mutators.qtpl:5
|
||||
//line templates/http_mutators.qtpl:4
|
||||
qw422016.N().S(warning)
|
||||
//line templates/http_mutators.qtpl:5
|
||||
//line templates/http_mutators.qtpl:4
|
||||
qw422016.N().S(`
|
||||
<form method="post" class="upload-text-form"
|
||||
action="/upload-text/`)
|
||||
//line templates/http_mutators.qtpl:7
|
||||
//line templates/http_mutators.qtpl:6
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_mutators.qtpl:7
|
||||
//line templates/http_mutators.qtpl:6
|
||||
qw422016.N().S(`">
|
||||
<textarea name="text">`)
|
||||
//line templates/http_mutators.qtpl:8
|
||||
//line templates/http_mutators.qtpl:7
|
||||
qw422016.E().S(textAreaFill)
|
||||
//line templates/http_mutators.qtpl:8
|
||||
//line templates/http_mutators.qtpl:7
|
||||
qw422016.N().S(`</textarea>
|
||||
<br/>
|
||||
<input type="submit"/>
|
||||
<a href="/page/`)
|
||||
//line templates/http_mutators.qtpl:11
|
||||
//line templates/http_mutators.qtpl:10
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_mutators.qtpl:11
|
||||
//line templates/http_mutators.qtpl:10
|
||||
qw422016.N().S(`">Cancel</a>
|
||||
</form>
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
}
|
||||
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
func WriteEditHTML(qq422016 qtio422016.Writer, hyphaName, textAreaFill, warning string) {
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
StreamEditHTML(qw422016, hyphaName, textAreaFill, warning)
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
}
|
||||
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
func EditHTML(hyphaName, textAreaFill, warning string) string {
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
WriteEditHTML(qb422016, hyphaName, textAreaFill, warning)
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
return qs422016
|
||||
//line templates/http_mutators.qtpl:14
|
||||
//line templates/http_mutators.qtpl:13
|
||||
}
|
||||
|
@ -1,84 +1,59 @@
|
||||
{% func HistoryHTML(hyphaName, tbody string) %}
|
||||
<main>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/page/{%s hyphaName %}">Hypha</a></li>
|
||||
<li><a href="/edit/{%s hyphaName %}">Edit</a></li>
|
||||
<li><a href="/text/{%s hyphaName %}">Raw text</a></li>
|
||||
<li><b>History</b></li>
|
||||
<li><a href="/delete-ask/{%s hyphaName %}">Delete</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<th>Hash</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{%s= tbody %}
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
<main>
|
||||
{%= navHTML(hyphaName, "history") %}
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<th>Hash</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{%s= tbody %}
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
{% endfunc %}
|
||||
|
||||
{% func RevisionHTML(hyphaName, naviTitle, contents, tree, revHash string) %}
|
||||
<main>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/page/{%s hyphaName %}">Hypha</a></li>
|
||||
<li><a href="/edit/{%s hyphaName %}">Edit</a></li>
|
||||
<li><a href="/text/{%s hyphaName %}">Raw text</a></li>
|
||||
<li><a href="/history/{%s hyphaName %}">History</a></li>
|
||||
<li><b>{%s revHash %}</b></li>
|
||||
<li><a href="/delete-ask/{%s hyphaName %}">Delete</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article>
|
||||
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
|
||||
{%s= naviTitle %}
|
||||
{%s= contents %}
|
||||
</article>
|
||||
<hr/>
|
||||
<aside>
|
||||
{%s= tree %}
|
||||
</aside>
|
||||
</main>
|
||||
<main>
|
||||
{%= navHTML(hyphaName, "revision", revHash) %}
|
||||
<article>
|
||||
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
|
||||
{%s= naviTitle %}
|
||||
{%s= contents %}
|
||||
</article>
|
||||
<hr/>
|
||||
<aside>
|
||||
{%s= tree %}
|
||||
</aside>
|
||||
</main>
|
||||
{% endfunc %}
|
||||
|
||||
If `contents` == "", a helpful message is shown instead.
|
||||
{% func PageHTML(hyphaName, naviTitle, contents, tree string) %}
|
||||
<main>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><b>Hypha</b></li>
|
||||
<li><a href="/edit/{%s hyphaName %}">Edit</a></li>
|
||||
<li><a href="/text/{%s hyphaName %}">Raw text</a></li>
|
||||
<li><a href="/history/{%s hyphaName %}">History</a></li>
|
||||
<li><a href="/delete-ask/{%s hyphaName %}">Delete</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article>
|
||||
{%s= naviTitle %}
|
||||
{% if contents == "" %}
|
||||
<p>This hypha has no text. Why not <a href="/edit/{%s hyphaName %}">create it</a>?</p>
|
||||
{% else %}
|
||||
{%s= contents %}
|
||||
{% endif %}
|
||||
</article>
|
||||
<hr/>
|
||||
<form action="/upload-binary/{%s hyphaName %}"
|
||||
method="post" enctype="multipart/form-data">
|
||||
<label for="upload-binary__input">Upload new binary part</label>
|
||||
<br>
|
||||
<input type="file" id="upload-binary__input" name="binary"/>
|
||||
<input type="submit"/>
|
||||
</form>
|
||||
<hr/>
|
||||
<aside>
|
||||
{%s= tree %}
|
||||
</aside>
|
||||
</main>
|
||||
<main>
|
||||
{%= navHTML(hyphaName, "page") %}
|
||||
<article>
|
||||
{%s= naviTitle %}
|
||||
{% if contents == "" %}
|
||||
<p>This hypha has no text. Why not <a href="/edit/{%s hyphaName %}">create it</a>?</p>
|
||||
{% else %}
|
||||
{%s= contents %}
|
||||
{% endif %}
|
||||
</article>
|
||||
<hr/>
|
||||
<form action="/upload-binary/{%s hyphaName %}"
|
||||
method="post" enctype="multipart/form-data">
|
||||
<label for="upload-binary__input">Upload new binary part</label>
|
||||
<br>
|
||||
<input type="file" id="upload-binary__input" name="binary"/>
|
||||
<input type="submit"/>
|
||||
</form>
|
||||
<hr/>
|
||||
<aside>
|
||||
{%s= tree %}
|
||||
</aside>
|
||||
</main>
|
||||
{% endfunc %}
|
||||
|
@ -21,281 +21,212 @@ var (
|
||||
func StreamHistoryHTML(qw422016 *qt422016.Writer, hyphaName, tbody string) {
|
||||
//line templates/http_readers.qtpl:1
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/page/`)
|
||||
//line templates/http_readers.qtpl:5
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:5
|
||||
qw422016.N().S(`">Hypha</a></li>
|
||||
<li><a href="/edit/`)
|
||||
//line templates/http_readers.qtpl:6
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:6
|
||||
qw422016.N().S(`">Edit</a></li>
|
||||
<li><a href="/text/`)
|
||||
//line templates/http_readers.qtpl:7
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:7
|
||||
qw422016.N().S(`">Raw text</a></li>
|
||||
<li><b>History</b></li>
|
||||
<li><a href="/delete-ask/`)
|
||||
//line templates/http_readers.qtpl:9
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:9
|
||||
qw422016.N().S(`">Delete</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<th>Hash</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:21
|
||||
<main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:3
|
||||
streamnavHTML(qw422016, hyphaName, "history")
|
||||
//line templates/http_readers.qtpl:3
|
||||
qw422016.N().S(`
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Time</th>
|
||||
<th>Hash</th>
|
||||
<th>Message</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:13
|
||||
qw422016.N().S(tbody)
|
||||
//line templates/http_readers.qtpl:13
|
||||
qw422016.N().S(`
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:17
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:17
|
||||
func WriteHistoryHTML(qq422016 qtio422016.Writer, hyphaName, tbody string) {
|
||||
//line templates/http_readers.qtpl:17
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_readers.qtpl:17
|
||||
StreamHistoryHTML(qw422016, hyphaName, tbody)
|
||||
//line templates/http_readers.qtpl:17
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_readers.qtpl:17
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:17
|
||||
func HistoryHTML(hyphaName, tbody string) string {
|
||||
//line templates/http_readers.qtpl:17
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_readers.qtpl:17
|
||||
WriteHistoryHTML(qb422016, hyphaName, tbody)
|
||||
//line templates/http_readers.qtpl:17
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_readers.qtpl:17
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_readers.qtpl:17
|
||||
return qs422016
|
||||
//line templates/http_readers.qtpl:17
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:19
|
||||
func StreamRevisionHTML(qw422016 *qt422016.Writer, hyphaName, naviTitle, contents, tree, revHash string) {
|
||||
//line templates/http_readers.qtpl:19
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:21
|
||||
streamnavHTML(qw422016, hyphaName, "revision", revHash)
|
||||
//line templates/http_readers.qtpl:21
|
||||
qw422016.N().S(`
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:25
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:25
|
||||
func WriteHistoryHTML(qq422016 qtio422016.Writer, hyphaName, tbody string) {
|
||||
//line templates/http_readers.qtpl:25
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_readers.qtpl:25
|
||||
StreamHistoryHTML(qw422016, hyphaName, tbody)
|
||||
//line templates/http_readers.qtpl:25
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_readers.qtpl:25
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:25
|
||||
func HistoryHTML(hyphaName, tbody string) string {
|
||||
//line templates/http_readers.qtpl:25
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_readers.qtpl:25
|
||||
WriteHistoryHTML(qb422016, hyphaName, tbody)
|
||||
//line templates/http_readers.qtpl:25
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_readers.qtpl:25
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_readers.qtpl:25
|
||||
return qs422016
|
||||
//line templates/http_readers.qtpl:25
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:27
|
||||
func StreamRevisionHTML(qw422016 *qt422016.Writer, hyphaName, naviTitle, contents, tree, revHash string) {
|
||||
//line templates/http_readers.qtpl:27
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/page/`)
|
||||
//line templates/http_readers.qtpl:31
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:31
|
||||
qw422016.N().S(`">Hypha</a></li>
|
||||
<li><a href="/edit/`)
|
||||
//line templates/http_readers.qtpl:32
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:32
|
||||
qw422016.N().S(`">Edit</a></li>
|
||||
<li><a href="/text/`)
|
||||
//line templates/http_readers.qtpl:33
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:33
|
||||
qw422016.N().S(`">Raw text</a></li>
|
||||
<li><a href="/history/`)
|
||||
//line templates/http_readers.qtpl:34
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:34
|
||||
qw422016.N().S(`">History</a></li>
|
||||
<li><b>`)
|
||||
//line templates/http_readers.qtpl:35
|
||||
qw422016.E().S(revHash)
|
||||
//line templates/http_readers.qtpl:35
|
||||
qw422016.N().S(`</b></li>
|
||||
<li><a href="/delete-ask/`)
|
||||
//line templates/http_readers.qtpl:36
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:36
|
||||
qw422016.N().S(`">Delete</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article>
|
||||
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:41
|
||||
<article>
|
||||
<p>Please note that viewing binary parts of hyphae is not supported in history for now.</p>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:24
|
||||
qw422016.N().S(naviTitle)
|
||||
//line templates/http_readers.qtpl:41
|
||||
//line templates/http_readers.qtpl:24
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:42
|
||||
`)
|
||||
//line templates/http_readers.qtpl:25
|
||||
qw422016.N().S(contents)
|
||||
//line templates/http_readers.qtpl:42
|
||||
//line templates/http_readers.qtpl:25
|
||||
qw422016.N().S(`
|
||||
</article>
|
||||
<hr/>
|
||||
<aside>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:46
|
||||
</article>
|
||||
<hr/>
|
||||
<aside>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:29
|
||||
qw422016.N().S(tree)
|
||||
//line templates/http_readers.qtpl:46
|
||||
//line templates/http_readers.qtpl:29
|
||||
qw422016.N().S(`
|
||||
</aside>
|
||||
</main>
|
||||
</aside>
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
func WriteRevisionHTML(qq422016 qtio422016.Writer, hyphaName, naviTitle, contents, tree, revHash string) {
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
StreamRevisionHTML(qw422016, hyphaName, naviTitle, contents, tree, revHash)
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
func RevisionHTML(hyphaName, naviTitle, contents, tree, revHash string) string {
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
WriteRevisionHTML(qb422016, hyphaName, naviTitle, contents, tree, revHash)
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
return qs422016
|
||||
//line templates/http_readers.qtpl:49
|
||||
//line templates/http_readers.qtpl:32
|
||||
}
|
||||
|
||||
// If `contents` == "", a helpful message is shown instead.
|
||||
|
||||
//line templates/http_readers.qtpl:52
|
||||
//line templates/http_readers.qtpl:35
|
||||
func StreamPageHTML(qw422016 *qt422016.Writer, hyphaName, naviTitle, contents, tree string) {
|
||||
//line templates/http_readers.qtpl:52
|
||||
//line templates/http_readers.qtpl:35
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><b>Hypha</b></li>
|
||||
<li><a href="/edit/`)
|
||||
//line templates/http_readers.qtpl:57
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:57
|
||||
qw422016.N().S(`">Edit</a></li>
|
||||
<li><a href="/text/`)
|
||||
//line templates/http_readers.qtpl:58
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:58
|
||||
qw422016.N().S(`">Raw text</a></li>
|
||||
<li><a href="/history/`)
|
||||
//line templates/http_readers.qtpl:59
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:59
|
||||
qw422016.N().S(`">History</a></li>
|
||||
<li><a href="/delete-ask/`)
|
||||
//line templates/http_readers.qtpl:60
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:60
|
||||
qw422016.N().S(`">Delete</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
<article>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:64
|
||||
qw422016.N().S(naviTitle)
|
||||
//line templates/http_readers.qtpl:64
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:65
|
||||
if contents == "" {
|
||||
//line templates/http_readers.qtpl:65
|
||||
qw422016.N().S(`
|
||||
<p>This hypha has no text. Why not <a href="/edit/`)
|
||||
//line templates/http_readers.qtpl:66
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:66
|
||||
qw422016.N().S(`">create it</a>?</p>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:67
|
||||
} else {
|
||||
//line templates/http_readers.qtpl:67
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:68
|
||||
qw422016.N().S(contents)
|
||||
//line templates/http_readers.qtpl:68
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:69
|
||||
}
|
||||
//line templates/http_readers.qtpl:69
|
||||
qw422016.N().S(`
|
||||
</article>
|
||||
<hr/>
|
||||
<form action="/upload-binary/`)
|
||||
//line templates/http_readers.qtpl:72
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:72
|
||||
qw422016.N().S(`"
|
||||
method="post" enctype="multipart/form-data">
|
||||
<label for="upload-binary__input">Upload new binary part</label>
|
||||
<br>
|
||||
<input type="file" id="upload-binary__input" name="binary"/>
|
||||
<input type="submit"/>
|
||||
</form>
|
||||
<hr/>
|
||||
<aside>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:81
|
||||
qw422016.N().S(tree)
|
||||
//line templates/http_readers.qtpl:81
|
||||
qw422016.N().S(`
|
||||
</aside>
|
||||
</main>
|
||||
<main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:37
|
||||
streamnavHTML(qw422016, hyphaName, "page")
|
||||
//line templates/http_readers.qtpl:37
|
||||
qw422016.N().S(`
|
||||
<article>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:39
|
||||
qw422016.N().S(naviTitle)
|
||||
//line templates/http_readers.qtpl:39
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:40
|
||||
if contents == "" {
|
||||
//line templates/http_readers.qtpl:40
|
||||
qw422016.N().S(`
|
||||
<p>This hypha has no text. Why not <a href="/edit/`)
|
||||
//line templates/http_readers.qtpl:41
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:41
|
||||
qw422016.N().S(`">create it</a>?</p>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:42
|
||||
} else {
|
||||
//line templates/http_readers.qtpl:42
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:43
|
||||
qw422016.N().S(contents)
|
||||
//line templates/http_readers.qtpl:43
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:44
|
||||
}
|
||||
//line templates/http_readers.qtpl:44
|
||||
qw422016.N().S(`
|
||||
</article>
|
||||
<hr/>
|
||||
<form action="/upload-binary/`)
|
||||
//line templates/http_readers.qtpl:47
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:47
|
||||
qw422016.N().S(`"
|
||||
method="post" enctype="multipart/form-data">
|
||||
<label for="upload-binary__input">Upload new binary part</label>
|
||||
<br>
|
||||
<input type="file" id="upload-binary__input" name="binary"/>
|
||||
<input type="submit"/>
|
||||
</form>
|
||||
<hr/>
|
||||
<aside>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:56
|
||||
qw422016.N().S(tree)
|
||||
//line templates/http_readers.qtpl:56
|
||||
qw422016.N().S(`
|
||||
</aside>
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:59
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:59
|
||||
func WritePageHTML(qq422016 qtio422016.Writer, hyphaName, naviTitle, contents, tree string) {
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:59
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:59
|
||||
StreamPageHTML(qw422016, hyphaName, naviTitle, contents, tree)
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:59
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:59
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:59
|
||||
func PageHTML(hyphaName, naviTitle, contents, tree string) string {
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:59
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:59
|
||||
WritePageHTML(qb422016, hyphaName, naviTitle, contents, tree)
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:59
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:59
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:59
|
||||
return qs422016
|
||||
//line templates/http_readers.qtpl:84
|
||||
//line templates/http_readers.qtpl:59
|
||||
}
|
||||
|
27
templates/rename.qtpl
Normal file
27
templates/rename.qtpl
Normal file
@ -0,0 +1,27 @@
|
||||
This dialog is to be shown to a user when they try to rename a hypha.
|
||||
{% func RenameAskHTML(hyphaName string, isOld bool) %}
|
||||
<main>
|
||||
{%= navHTML(hyphaName, "rename-ask") %}
|
||||
{%- if isOld -%}
|
||||
<section>
|
||||
<h1>Rename {%s hyphaName %}</h1>
|
||||
<form action="/rename-confirm/{%s hyphaName %}" method="post" enctype="multipart/form-data">
|
||||
<label for="new-name">New name:</label>
|
||||
<input type="text" value="{%s hyphaName %}" required autofocus id="new-name" name="new-name"/>
|
||||
<input type="submit"/>
|
||||
</form>
|
||||
<p>If you rename this hypha, all incoming links and all relative outcoming links will break. You will also lose all history for the new name. Rename carefully.</p>
|
||||
</section>
|
||||
{%- else -%}
|
||||
{%= cannotRenameDueToNonExistence(hyphaName) %}
|
||||
{%- endif -%}
|
||||
</main>
|
||||
{% endfunc %}
|
||||
|
||||
{% func cannotRenameDueToNonExistence(hyphaName string) %}
|
||||
<section>
|
||||
<h1>Cannot rename {%s hyphaName %}</h1>
|
||||
<p>This hypha does not exist.</p>
|
||||
<p><a href="/page/{%s hyphaName %}">Go back</a></p>
|
||||
</section>
|
||||
{% endfunc %}
|
146
templates/rename.qtpl.go
Normal file
146
templates/rename.qtpl.go
Normal file
@ -0,0 +1,146 @@
|
||||
// Code generated by qtc from "rename.qtpl". DO NOT EDIT.
|
||||
// See https://github.com/valyala/quicktemplate for details.
|
||||
|
||||
// This dialog is to be shown to a user when they try to rename a hypha.
|
||||
|
||||
//line templates/rename.qtpl:2
|
||||
package templates
|
||||
|
||||
//line templates/rename.qtpl:2
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/rename.qtpl:2
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line templates/rename.qtpl:2
|
||||
func StreamRenameAskHTML(qw422016 *qt422016.Writer, hyphaName string, isOld bool) {
|
||||
//line templates/rename.qtpl:2
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
`)
|
||||
//line templates/rename.qtpl:4
|
||||
streamnavHTML(qw422016, hyphaName, "rename-ask")
|
||||
//line templates/rename.qtpl:4
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/rename.qtpl:5
|
||||
if isOld {
|
||||
//line templates/rename.qtpl:5
|
||||
qw422016.N().S(` <section>
|
||||
<h1>Rename `)
|
||||
//line templates/rename.qtpl:7
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/rename.qtpl:7
|
||||
qw422016.N().S(`</h1>
|
||||
<form action="/rename-confirm/`)
|
||||
//line templates/rename.qtpl:8
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/rename.qtpl:8
|
||||
qw422016.N().S(`" method="post" enctype="multipart/form-data">
|
||||
<label for="new-name">New name:</label>
|
||||
<input type="text" value="`)
|
||||
//line templates/rename.qtpl:10
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/rename.qtpl:10
|
||||
qw422016.N().S(`" required autofocus id="new-name" name="new-name"/>
|
||||
<input type="submit"/>
|
||||
</form>
|
||||
<p>If you rename this hypha, all incoming links and all relative outcoming links will break. You will also lose all history for the new name. Rename carefully.</p>
|
||||
</section>
|
||||
`)
|
||||
//line templates/rename.qtpl:15
|
||||
} else {
|
||||
//line templates/rename.qtpl:15
|
||||
qw422016.N().S(` `)
|
||||
//line templates/rename.qtpl:16
|
||||
streamcannotRenameDueToNonExistence(qw422016, hyphaName)
|
||||
//line templates/rename.qtpl:16
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/rename.qtpl:17
|
||||
}
|
||||
//line templates/rename.qtpl:17
|
||||
qw422016.N().S(`</main>
|
||||
`)
|
||||
//line templates/rename.qtpl:19
|
||||
}
|
||||
|
||||
//line templates/rename.qtpl:19
|
||||
func WriteRenameAskHTML(qq422016 qtio422016.Writer, hyphaName string, isOld bool) {
|
||||
//line templates/rename.qtpl:19
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/rename.qtpl:19
|
||||
StreamRenameAskHTML(qw422016, hyphaName, isOld)
|
||||
//line templates/rename.qtpl:19
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/rename.qtpl:19
|
||||
}
|
||||
|
||||
//line templates/rename.qtpl:19
|
||||
func RenameAskHTML(hyphaName string, isOld bool) string {
|
||||
//line templates/rename.qtpl:19
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/rename.qtpl:19
|
||||
WriteRenameAskHTML(qb422016, hyphaName, isOld)
|
||||
//line templates/rename.qtpl:19
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/rename.qtpl:19
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/rename.qtpl:19
|
||||
return qs422016
|
||||
//line templates/rename.qtpl:19
|
||||
}
|
||||
|
||||
//line templates/rename.qtpl:21
|
||||
func streamcannotRenameDueToNonExistence(qw422016 *qt422016.Writer, hyphaName string) {
|
||||
//line templates/rename.qtpl:21
|
||||
qw422016.N().S(`
|
||||
<section>
|
||||
<h1>Cannot rename `)
|
||||
//line templates/rename.qtpl:23
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/rename.qtpl:23
|
||||
qw422016.N().S(`</h1>
|
||||
<p>This hypha does not exist.</p>
|
||||
<p><a href="/page/`)
|
||||
//line templates/rename.qtpl:25
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/rename.qtpl:25
|
||||
qw422016.N().S(`">Go back</a></p>
|
||||
</section>
|
||||
`)
|
||||
//line templates/rename.qtpl:27
|
||||
}
|
||||
|
||||
//line templates/rename.qtpl:27
|
||||
func writecannotRenameDueToNonExistence(qq422016 qtio422016.Writer, hyphaName string) {
|
||||
//line templates/rename.qtpl:27
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/rename.qtpl:27
|
||||
streamcannotRenameDueToNonExistence(qw422016, hyphaName)
|
||||
//line templates/rename.qtpl:27
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/rename.qtpl:27
|
||||
}
|
||||
|
||||
//line templates/rename.qtpl:27
|
||||
func cannotRenameDueToNonExistence(hyphaName string) string {
|
||||
//line templates/rename.qtpl:27
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/rename.qtpl:27
|
||||
writecannotRenameDueToNonExistence(qb422016, hyphaName)
|
||||
//line templates/rename.qtpl:27
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/rename.qtpl:27
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/rename.qtpl:27
|
||||
return qs422016
|
||||
//line templates/rename.qtpl:27
|
||||
}
|
Loading…
Reference in New Issue
Block a user