query param to edit readonly page and link on readonly pages to it
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
{{ define "_readonly" }}
|
||||
<div class="fullscreen tb_fullscreen">
|
||||
<article id="article">
|
||||
</article>
|
||||
<script>
|
||||
document.getElementById("article").innerHTML = {{ .This.Content }}
|
||||
</script>
|
||||
</div>
|
||||
{{ end }}
|
||||
@@ -1,5 +1,6 @@
|
||||
{{ define "_readonly" }}
|
||||
<div class="fullscreen tb_fullscreen">
|
||||
<a href="/ui/files/{{ .This.ID }}?edit"><button>Edit this page</button></a>
|
||||
<article id="article"></article>
|
||||
<script>
|
||||
document.getElementById("article").innerHTML = {{ .This.Content }}
|
||||
|
||||
@@ -274,7 +274,11 @@ func (server *Server) uiFilesHandler(w http.ResponseWriter, r *http.Request) err
|
||||
leaf.Meta.Title = "My New File"
|
||||
}
|
||||
if leaf.Meta.ReadOnly {
|
||||
if _, ok := r.URL.Query()["edit"]; !ok {
|
||||
leaf.Content = Gomarkdown([]byte(leaf.Content))
|
||||
} else {
|
||||
leaf.Meta.ReadOnly = false
|
||||
}
|
||||
}
|
||||
data := map[string]interface{}{
|
||||
"This": map[string]interface{}{
|
||||
|
||||
Reference in New Issue
Block a user