mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2025-01-18 22:52:50 +00:00
Make hyphae deletable
This commit is contained in:
parent
4cf5937361
commit
00bc9d4b17
@ -43,9 +43,11 @@ func Revisions(hyphaName string) ([]Revision, error) {
|
||||
)
|
||||
if err == nil {
|
||||
for _, line := range strings.Split(out.String(), "\n") {
|
||||
if line != "" {
|
||||
revs = append(revs, parseRevisionLine(line))
|
||||
}
|
||||
}
|
||||
}
|
||||
return revs, err
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,8 @@ const (
|
||||
TypeNone OpType = iota
|
||||
TypeEditText
|
||||
TypeEditBinary
|
||||
TypeDeleteHypha
|
||||
TypeRenameHypha
|
||||
)
|
||||
|
||||
// HistoryOp is an object representing a history operation.
|
||||
@ -46,6 +48,17 @@ func (hop *HistoryOp) gitop(args ...string) *HistoryOp {
|
||||
return hop
|
||||
}
|
||||
|
||||
// WithFilesRemoved git-rm-s all passed `paths`. Paths can be rooted or not. Paths that are empty strings are ignored.
|
||||
func (hop *HistoryOp) WithFilesRemoved(paths ...string) *HistoryOp {
|
||||
args := []string{"rm", "--quiet", "--"}
|
||||
for _, path := range paths {
|
||||
if path != "" {
|
||||
args = append(args, path)
|
||||
}
|
||||
}
|
||||
return hop.gitop(args...)
|
||||
}
|
||||
|
||||
// WithFiles stages all passed `paths`. Paths can be rooted or not.
|
||||
func (hop *HistoryOp) WithFiles(paths ...string) *HistoryOp {
|
||||
for i, path := range paths {
|
||||
|
@ -17,6 +17,42 @@ func init() {
|
||||
http.HandleFunc("/upload-binary/", handlerUploadBinary)
|
||||
http.HandleFunc("/upload-text/", handlerUploadText)
|
||||
http.HandleFunc("/edit/", handlerEdit)
|
||||
http.HandleFunc("/delete-ask/", handlerDeleteAsk)
|
||||
http.HandleFunc("/delete-confirm/", handlerDeleteConfirm)
|
||||
}
|
||||
|
||||
// handlerDeleteAsk shows a delete dialog.
|
||||
func handlerDeleteAsk(w http.ResponseWriter, rq *http.Request) {
|
||||
log.Println(rq.URL)
|
||||
var (
|
||||
hyphaName = HyphaNameFromRq(rq, "delete-ask")
|
||||
_, isOld = HyphaStorage[hyphaName]
|
||||
)
|
||||
util.HTTP200Page(w, base("Delete "+hyphaName+"?", templates.DeleteAskHTML(hyphaName, isOld)))
|
||||
}
|
||||
|
||||
// handlerDeleteConfirm deletes a hypha for sure
|
||||
func handlerDeleteConfirm(w http.ResponseWriter, rq *http.Request) {
|
||||
log.Println(rq.URL)
|
||||
var (
|
||||
hyphaName = HyphaNameFromRq(rq, "delete-confirm")
|
||||
hyphaData, isOld = HyphaStorage[hyphaName]
|
||||
)
|
||||
if isOld {
|
||||
// If deleted successfully
|
||||
if hop := hyphaData.DeleteHypha(hyphaName); len(hop.Errs) == 0 {
|
||||
http.Redirect(w, rq, "/page/"+hyphaName, http.StatusSeeOther)
|
||||
} else {
|
||||
HttpErr(w, http.StatusInternalServerError, hyphaName,
|
||||
"Error: could not delete hypha",
|
||||
fmt.Sprintf("Could not delete this hypha due to an internal error. Server errors: <code>%v</code>", hop.Errs))
|
||||
}
|
||||
} else {
|
||||
// The precondition is to have the hypha in the first place.
|
||||
HttpErr(w, http.StatusPreconditionFailed, hyphaName,
|
||||
"Error: no such hypha",
|
||||
"Could not delete this hypha because it does not exist.")
|
||||
}
|
||||
}
|
||||
|
||||
// handlerEdit shows the edit form. It doesn't edit anything actually.
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/gemtext"
|
||||
@ -29,8 +28,9 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) {
|
||||
log.Println(rq.URL)
|
||||
var (
|
||||
shorterUrl = strings.TrimPrefix(rq.URL.Path, "/rev/")
|
||||
revHash = path.Dir(shorterUrl)
|
||||
hyphaName = CanonicalName(strings.TrimPrefix(shorterUrl, revHash+"/"))
|
||||
firstSlashIndex = strings.IndexRune(shorterUrl, '/')
|
||||
revHash = shorterUrl[:firstSlashIndex]
|
||||
hyphaName = CanonicalName(shorterUrl[firstSlashIndex+1:])
|
||||
contents = fmt.Sprintf(`<p>This hypha had no text at this revision.</p>`)
|
||||
textPath = hyphaName + "&.gmi"
|
||||
textContents, err = history.FileAtRevision(textPath, revHash)
|
||||
@ -55,15 +55,15 @@ func handlerHistory(w http.ResponseWriter, rq *http.Request) {
|
||||
log.Println(rq.URL)
|
||||
hyphaName := HyphaNameFromRq(rq, "history")
|
||||
var tbody string
|
||||
if _, ok := HyphaStorage[hyphaName]; ok {
|
||||
|
||||
// History can be found for files that do not exist anymore.
|
||||
revs, err := history.Revisions(hyphaName)
|
||||
if err == nil {
|
||||
for _, rev := range revs {
|
||||
tbody += rev.AsHtmlTableRow(hyphaName)
|
||||
}
|
||||
}
|
||||
log.Println(revs)
|
||||
}
|
||||
log.Println("Found", len(revs), "revisions for", hyphaName)
|
||||
|
||||
util.HTTP200Page(w,
|
||||
base(hyphaName, templates.HistoryHTML(hyphaName, tbody)))
|
||||
|
10
hypha.go
10
hypha.go
@ -9,6 +9,7 @@ import (
|
||||
"path/filepath"
|
||||
|
||||
"github.com/bouncepaw/mycorrhiza/gemtext"
|
||||
"github.com/bouncepaw/mycorrhiza/history"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -37,6 +38,15 @@ type HyphaData struct {
|
||||
binaryType BinaryType
|
||||
}
|
||||
|
||||
// DeleteHypha deletes hypha and makes a history record about that.
|
||||
func (hd *HyphaData) DeleteHypha(hyphaName string) *history.HistoryOp {
|
||||
return history.Operation(history.TypeDeleteHypha).
|
||||
WithFilesRemoved(hd.textPath, hd.binaryPath).
|
||||
WithMsg(fmt.Sprintf("Delete ‘%s’", hyphaName)).
|
||||
WithSignature("anon").
|
||||
Apply()
|
||||
}
|
||||
|
||||
// binaryHtmlBlock creates an html block for binary part of the hypha.
|
||||
func binaryHtmlBlock(hyphaName string, d *HyphaData) string {
|
||||
switch d.binaryType {
|
||||
|
2
main.go
2
main.go
@ -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/.
|
||||
// See http_mutators.go for /upload-binary/, /upload-text/, /edit/, /delete-ask/, /delete-confirm/.
|
||||
http.HandleFunc("/list", handlerList)
|
||||
http.HandleFunc("/reindex", handlerReindex)
|
||||
http.HandleFunc("/random", handlerRandom)
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 2c0e43199ed28f7022a38463a0eec3af3ecb03c9
|
||||
Subproject commit ecaa76f841afcb3514b7061eb6708092bc17ee08
|
33
templates/http_delete.qtpl
Normal file
33
templates/http_delete.qtpl
Normal file
@ -0,0 +1,33 @@
|
||||
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>
|
||||
{% if isOld %}
|
||||
<section>
|
||||
<h1>Delete {%s hyphaName %}?</h1>
|
||||
<p>Do you really want to delete hypha <em>{%s hyphaName %}</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/{%s hyphaName %}"><strong>Confirm</strong></a></p>
|
||||
<p><a href="/page/{%s hyphaName %}">Cancel</a></p>
|
||||
</section>
|
||||
{% else %}
|
||||
{%= cannotDeleteDueToNonExistence(hyphaName) %}
|
||||
{% endif %}
|
||||
</main>
|
||||
{% endfunc %}
|
||||
|
||||
{% func cannotDeleteDueToNonExistence(hyphaName string) %}
|
||||
<section>
|
||||
<h1>Cannot delete {%s hyphaName %}</h1>
|
||||
<p>This hypha does not exist.</p>
|
||||
<p><a href="/page/{%s hyphaName %}">Go back</a></p>
|
||||
</section>
|
||||
{% endfunc %}
|
171
templates/http_delete.qtpl.go
Normal file
171
templates/http_delete.qtpl.go
Normal file
@ -0,0 +1,171 @@
|
||||
// Code generated by qtc from "http_delete.qtpl". DO NOT EDIT.
|
||||
// See https://github.com/valyala/quicktemplate for details.
|
||||
|
||||
// This dialog is to be shown to a user when they try to delete a hypha.
|
||||
|
||||
//line templates/http_delete.qtpl:2
|
||||
package templates
|
||||
|
||||
//line templates/http_delete.qtpl:2
|
||||
import (
|
||||
qtio422016 "io"
|
||||
|
||||
qt422016 "github.com/valyala/quicktemplate"
|
||||
)
|
||||
|
||||
//line templates/http_delete.qtpl:2
|
||||
var (
|
||||
_ = qtio422016.Copy
|
||||
_ = qt422016.AcquireByteBuffer
|
||||
)
|
||||
|
||||
//line templates/http_delete.qtpl:2
|
||||
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
|
||||
if isOld {
|
||||
//line templates/http_delete.qtpl:13
|
||||
qw422016.N().S(`
|
||||
<section>
|
||||
<h1>Delete `)
|
||||
//line templates/http_delete.qtpl:15
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:15
|
||||
qw422016.N().S(`?</h1>
|
||||
<p>Do you really want to delete hypha <em>`)
|
||||
//line templates/http_delete.qtpl:16
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:16
|
||||
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
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:18
|
||||
qw422016.N().S(`"><strong>Confirm</strong></a></p>
|
||||
<p><a href="/page/`)
|
||||
//line templates/http_delete.qtpl:19
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:19
|
||||
qw422016.N().S(`">Cancel</a></p>
|
||||
</section>
|
||||
`)
|
||||
//line templates/http_delete.qtpl:21
|
||||
} else {
|
||||
//line templates/http_delete.qtpl:21
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_delete.qtpl:22
|
||||
streamcannotDeleteDueToNonExistence(qw422016, hyphaName)
|
||||
//line templates/http_delete.qtpl:22
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_delete.qtpl:23
|
||||
}
|
||||
//line templates/http_delete.qtpl:23
|
||||
qw422016.N().S(`
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_delete.qtpl:25
|
||||
}
|
||||
|
||||
//line templates/http_delete.qtpl:25
|
||||
func WriteDeleteAskHTML(qq422016 qtio422016.Writer, hyphaName string, isOld bool) {
|
||||
//line templates/http_delete.qtpl:25
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_delete.qtpl:25
|
||||
StreamDeleteAskHTML(qw422016, hyphaName, isOld)
|
||||
//line templates/http_delete.qtpl:25
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_delete.qtpl:25
|
||||
}
|
||||
|
||||
//line templates/http_delete.qtpl:25
|
||||
func DeleteAskHTML(hyphaName string, isOld bool) string {
|
||||
//line templates/http_delete.qtpl:25
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_delete.qtpl:25
|
||||
WriteDeleteAskHTML(qb422016, hyphaName, isOld)
|
||||
//line templates/http_delete.qtpl:25
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_delete.qtpl:25
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_delete.qtpl:25
|
||||
return qs422016
|
||||
//line templates/http_delete.qtpl:25
|
||||
}
|
||||
|
||||
//line templates/http_delete.qtpl:27
|
||||
func streamcannotDeleteDueToNonExistence(qw422016 *qt422016.Writer, hyphaName string) {
|
||||
//line templates/http_delete.qtpl:27
|
||||
qw422016.N().S(`
|
||||
<section>
|
||||
<h1>Cannot delete `)
|
||||
//line templates/http_delete.qtpl:29
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:29
|
||||
qw422016.N().S(`</h1>
|
||||
<p>This hypha does not exist.</p>
|
||||
<p><a href="/page/`)
|
||||
//line templates/http_delete.qtpl:31
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_delete.qtpl:31
|
||||
qw422016.N().S(`">Go back</a></p>
|
||||
</section>
|
||||
`)
|
||||
//line templates/http_delete.qtpl:33
|
||||
}
|
||||
|
||||
//line templates/http_delete.qtpl:33
|
||||
func writecannotDeleteDueToNonExistence(qq422016 qtio422016.Writer, hyphaName string) {
|
||||
//line templates/http_delete.qtpl:33
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_delete.qtpl:33
|
||||
streamcannotDeleteDueToNonExistence(qw422016, hyphaName)
|
||||
//line templates/http_delete.qtpl:33
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_delete.qtpl:33
|
||||
}
|
||||
|
||||
//line templates/http_delete.qtpl:33
|
||||
func cannotDeleteDueToNonExistence(hyphaName string) string {
|
||||
//line templates/http_delete.qtpl:33
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_delete.qtpl:33
|
||||
writecannotDeleteDueToNonExistence(qb422016, hyphaName)
|
||||
//line templates/http_delete.qtpl:33
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_delete.qtpl:33
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_delete.qtpl:33
|
||||
return qs422016
|
||||
//line templates/http_delete.qtpl:33
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
<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>
|
||||
@ -32,6 +33,7 @@
|
||||
<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>
|
||||
@ -55,6 +57,7 @@ If `contents` == "", a helpful message is shown instead.
|
||||
<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>
|
||||
|
@ -40,6 +40,11 @@ func StreamHistoryHTML(qw422016 *qt422016.Writer, hyphaName, tbody string) {
|
||||
//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>
|
||||
@ -52,193 +57,203 @@ func StreamHistoryHTML(qw422016 *qt422016.Writer, hyphaName, tbody string) {
|
||||
</thead>
|
||||
<tbody>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:20
|
||||
//line templates/http_readers.qtpl:21
|
||||
qw422016.N().S(tbody)
|
||||
//line templates/http_readers.qtpl:20
|
||||
//line templates/http_readers.qtpl:21
|
||||
qw422016.N().S(`
|
||||
</tbody>
|
||||
</table>
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
func WriteHistoryHTML(qq422016 qtio422016.Writer, hyphaName, tbody string) {
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
StreamHistoryHTML(qw422016, hyphaName, tbody)
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
func HistoryHTML(hyphaName, tbody string) string {
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
WriteHistoryHTML(qb422016, hyphaName, tbody)
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
return qs422016
|
||||
//line templates/http_readers.qtpl:24
|
||||
//line templates/http_readers.qtpl:25
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:26
|
||||
//line templates/http_readers.qtpl:27
|
||||
func StreamRevisionHTML(qw422016 *qt422016.Writer, hyphaName, naviTitle, contents, tree, revHash string) {
|
||||
//line templates/http_readers.qtpl:26
|
||||
//line templates/http_readers.qtpl:27
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><a href="/page/`)
|
||||
//line templates/http_readers.qtpl:30
|
||||
//line templates/http_readers.qtpl:31
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:30
|
||||
//line templates/http_readers.qtpl:31
|
||||
qw422016.N().S(`">Hypha</a></li>
|
||||
<li><a href="/edit/`)
|
||||
//line templates/http_readers.qtpl:31
|
||||
//line templates/http_readers.qtpl:32
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:31
|
||||
//line templates/http_readers.qtpl:32
|
||||
qw422016.N().S(`">Edit</a></li>
|
||||
<li><a href="/text/`)
|
||||
//line templates/http_readers.qtpl:32
|
||||
//line templates/http_readers.qtpl:33
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:32
|
||||
//line templates/http_readers.qtpl:33
|
||||
qw422016.N().S(`">Raw text</a></li>
|
||||
<li><a href="/history/`)
|
||||
//line templates/http_readers.qtpl:33
|
||||
//line templates/http_readers.qtpl:34
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:33
|
||||
//line templates/http_readers.qtpl:34
|
||||
qw422016.N().S(`">History</a></li>
|
||||
<li><b>`)
|
||||
//line templates/http_readers.qtpl:34
|
||||
//line templates/http_readers.qtpl:35
|
||||
qw422016.E().S(revHash)
|
||||
//line templates/http_readers.qtpl:34
|
||||
//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:39
|
||||
//line templates/http_readers.qtpl:41
|
||||
qw422016.N().S(naviTitle)
|
||||
//line templates/http_readers.qtpl:39
|
||||
//line templates/http_readers.qtpl:41
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:40
|
||||
//line templates/http_readers.qtpl:42
|
||||
qw422016.N().S(contents)
|
||||
//line templates/http_readers.qtpl:40
|
||||
//line templates/http_readers.qtpl:42
|
||||
qw422016.N().S(`
|
||||
</article>
|
||||
<hr/>
|
||||
<aside>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:44
|
||||
//line templates/http_readers.qtpl:46
|
||||
qw422016.N().S(tree)
|
||||
//line templates/http_readers.qtpl:44
|
||||
//line templates/http_readers.qtpl:46
|
||||
qw422016.N().S(`
|
||||
</aside>
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
func WriteRevisionHTML(qq422016 qtio422016.Writer, hyphaName, naviTitle, contents, tree, revHash string) {
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
StreamRevisionHTML(qw422016, hyphaName, naviTitle, contents, tree, revHash)
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
func RevisionHTML(hyphaName, naviTitle, contents, tree, revHash string) string {
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
WriteRevisionHTML(qb422016, hyphaName, naviTitle, contents, tree, revHash)
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
return qs422016
|
||||
//line templates/http_readers.qtpl:47
|
||||
//line templates/http_readers.qtpl:49
|
||||
}
|
||||
|
||||
// If `contents` == "", a helpful message is shown instead.
|
||||
|
||||
//line templates/http_readers.qtpl:50
|
||||
//line templates/http_readers.qtpl:52
|
||||
func StreamPageHTML(qw422016 *qt422016.Writer, hyphaName, naviTitle, contents, tree string) {
|
||||
//line templates/http_readers.qtpl:50
|
||||
//line templates/http_readers.qtpl:52
|
||||
qw422016.N().S(`
|
||||
<main>
|
||||
<nav>
|
||||
<ul>
|
||||
<li><b>Hypha</b></li>
|
||||
<li><a href="/edit/`)
|
||||
//line templates/http_readers.qtpl:55
|
||||
//line templates/http_readers.qtpl:57
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:55
|
||||
//line templates/http_readers.qtpl:57
|
||||
qw422016.N().S(`">Edit</a></li>
|
||||
<li><a href="/text/`)
|
||||
//line templates/http_readers.qtpl:56
|
||||
//line templates/http_readers.qtpl:58
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:56
|
||||
//line templates/http_readers.qtpl:58
|
||||
qw422016.N().S(`">Raw text</a></li>
|
||||
<li><a href="/history/`)
|
||||
//line templates/http_readers.qtpl:57
|
||||
//line templates/http_readers.qtpl:59
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:57
|
||||
//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:61
|
||||
//line templates/http_readers.qtpl:64
|
||||
qw422016.N().S(naviTitle)
|
||||
//line templates/http_readers.qtpl:61
|
||||
//line templates/http_readers.qtpl:64
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:62
|
||||
//line templates/http_readers.qtpl:65
|
||||
if contents == "" {
|
||||
//line templates/http_readers.qtpl:62
|
||||
//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:63
|
||||
//line templates/http_readers.qtpl:66
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:63
|
||||
//line templates/http_readers.qtpl:66
|
||||
qw422016.N().S(`">create it</a>?</p>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:64
|
||||
//line templates/http_readers.qtpl:67
|
||||
} else {
|
||||
//line templates/http_readers.qtpl:64
|
||||
//line templates/http_readers.qtpl:67
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:65
|
||||
//line templates/http_readers.qtpl:68
|
||||
qw422016.N().S(contents)
|
||||
//line templates/http_readers.qtpl:65
|
||||
//line templates/http_readers.qtpl:68
|
||||
qw422016.N().S(`
|
||||
`)
|
||||
//line templates/http_readers.qtpl:66
|
||||
//line templates/http_readers.qtpl:69
|
||||
}
|
||||
//line templates/http_readers.qtpl:66
|
||||
//line templates/http_readers.qtpl:69
|
||||
qw422016.N().S(`
|
||||
</article>
|
||||
<hr/>
|
||||
<form action="/upload-binary/`)
|
||||
//line templates/http_readers.qtpl:69
|
||||
//line templates/http_readers.qtpl:72
|
||||
qw422016.E().S(hyphaName)
|
||||
//line templates/http_readers.qtpl:69
|
||||
//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>
|
||||
@ -249,38 +264,38 @@ func StreamPageHTML(qw422016 *qt422016.Writer, hyphaName, naviTitle, contents, t
|
||||
<hr/>
|
||||
<aside>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:78
|
||||
//line templates/http_readers.qtpl:81
|
||||
qw422016.N().S(tree)
|
||||
//line templates/http_readers.qtpl:78
|
||||
//line templates/http_readers.qtpl:81
|
||||
qw422016.N().S(`
|
||||
</aside>
|
||||
</main>
|
||||
`)
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
func WritePageHTML(qq422016 qtio422016.Writer, hyphaName, naviTitle, contents, tree string) {
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
StreamPageHTML(qw422016, hyphaName, naviTitle, contents, tree)
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
qt422016.ReleaseWriter(qw422016)
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
}
|
||||
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
func PageHTML(hyphaName, naviTitle, contents, tree string) string {
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
qb422016 := qt422016.AcquireByteBuffer()
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
WritePageHTML(qb422016, hyphaName, naviTitle, contents, tree)
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
qs422016 := string(qb422016.B)
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
qt422016.ReleaseByteBuffer(qb422016)
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
return qs422016
|
||||
//line templates/http_readers.qtpl:81
|
||||
//line templates/http_readers.qtpl:84
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user