query param to edit readonly page and link on readonly pages to it
parent
553df97240
commit
aa8ca4d967
|
|
@ -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 {
|
||||
leaf.Content = Gomarkdown([]byte(leaf.Content))
|
||||
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{}{
|
||||
|
|
|
|||
Loading…
Reference in New Issue