1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-10-30 11:46:16 +00:00

Sync edit and preview templates and fix some bugs

This commit is contained in:
handlerug 2021-06-20 12:56:19 +07:00
parent d1176adc7b
commit 26099e7dda
No known key found for this signature in database
GPG Key ID: 38009F0605051491
3 changed files with 14 additions and 15 deletions

View File

@ -117,7 +117,6 @@ textarea {font-size:16px; font-family: 'PT Sans', 'Liberation Sans', sans-serif;
.edit__preview { border: 2px dashed #ddd; } .edit__preview { border: 2px dashed #ddd; }
.edit-form { height: calc(100vh - 12rem); } .edit-form { height: calc(100vh - 12rem); }
.edit-form__textarea { width: 100%; height: calc(100% - 8rem); min-height: 4rem; } .edit-form__textarea { width: 100%; height: calc(100% - 8rem); min-height: 4rem; }
.edit-form label { font-style: italic; }
.edit-form__message { width: 100%; margin: 0.25em 0; } .edit-form__message { width: 100%; margin: 0.25em 0; }
.edit-form__save { font-weight: bold; } .edit-form__save { font-weight: bold; }
.edit-toolbar__buttons, .edit-toolbar__ad { margin: .5rem; } .edit-toolbar__buttons, .edit-toolbar__ad { margin: .5rem; }

View File

@ -95,20 +95,20 @@
{%s= NavHTML(rq, hyphaName, "edit") %} {%s= NavHTML(rq, hyphaName, "edit") %}
<div class="layout"> <div class="layout">
<main class="main-width edit edit_with-preview"> <main class="main-width edit edit_with-preview">
<h1>Edit {%s util.BeautifulName(hyphaName) %} (preview)</h1> <h1 class="edit__title">Edit {%s util.BeautifulName(hyphaName) %}</h1>
{%s= warning %} {%s= warning %}
<form method="post" class="edit-form" <form method="post" class="edit-form"
action="/upload-text/{%s hyphaName %}"> action="/upload-text/{%s hyphaName %}">
<textarea class="edit-form__textarea" name="text">{%s textAreaFill %}</textarea> <textarea name="text" class="edit-form__textarea" autofocus>{%s textAreaFill %}</textarea>
<br/><br/> <br/><br/>
<label for="text">Edit description:</label> <label for="text">Describe your changes:</label><br>
<input id="text" type="text" name="message" class="edit-form__message" value="{%s message %}"> <input id="text" type="text" name="message" class="edit-form__message" value="{%s message %}">
<br/><br/> <br/><br/>
<input type="submit" name="action" class="btn btn_accent" value="Save" class="edit-form__save"/> <input type="submit" name="action" class="btn btn_accent edit-form__save" value="Save"/>
<input type="submit" name="action" class="btn" value="Preview" class="edit-form__preview"> <input type="submit" name="action" class="btn edit-form__preview" value="Preview">
<a href="/hypha/{%s hyphaName %}" class="btn btn_weak">Cancel</a> <a href="/hypha/{%s hyphaName %}" class="btn btn_weak">Cancel</a>
</form> </form>
<p class="warning">Note that the hypha is not saved yet. You can preview the changes ↓</p> <p class="warning">Note that the hypha hasn't been saved yet. Here's the preview:</p>
<article class="edit__preview">{%s= renderedPage %}</article> <article class="edit__preview">{%s= renderedPage %}</article>
</main> </main>
{%s= Toolbar(user.FromRequest(rq)) %} {%s= Toolbar(user.FromRequest(rq)) %}
@ -120,4 +120,4 @@
{% for _, scriptPath := range cfg.EditScripts %} {% for _, scriptPath := range cfg.EditScripts %}
<script src="{%s scriptPath %}"></script> <script src="{%s scriptPath %}"></script>
{% endfor %} {% endfor %}
{% endfunc %} {% endfunc %}

View File

@ -269,11 +269,11 @@ func StreamPreviewHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, t
qw422016.N().S(` qw422016.N().S(`
<div class="layout"> <div class="layout">
<main class="main-width edit edit_with-preview"> <main class="main-width edit edit_with-preview">
<h1>Edit `) <h1 class="edit__title">Edit `)
//line views/mutators.qtpl:98 //line views/mutators.qtpl:98
qw422016.E().S(util.BeautifulName(hyphaName)) qw422016.E().S(util.BeautifulName(hyphaName))
//line views/mutators.qtpl:98 //line views/mutators.qtpl:98
qw422016.N().S(` (preview)</h1> qw422016.N().S(`</h1>
`) `)
//line views/mutators.qtpl:99 //line views/mutators.qtpl:99
qw422016.N().S(warning) qw422016.N().S(warning)
@ -285,28 +285,28 @@ func StreamPreviewHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, t
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line views/mutators.qtpl:101 //line views/mutators.qtpl:101
qw422016.N().S(`"> qw422016.N().S(`">
<textarea class="edit-form__textarea" name="text">`) <textarea name="text" class="edit-form__textarea" autofocus>`)
//line views/mutators.qtpl:102 //line views/mutators.qtpl:102
qw422016.E().S(textAreaFill) qw422016.E().S(textAreaFill)
//line views/mutators.qtpl:102 //line views/mutators.qtpl:102
qw422016.N().S(`</textarea> qw422016.N().S(`</textarea>
<br/><br/> <br/><br/>
<label for="text">Edit description:</label> <label for="text">Describe your changes:</label><br>
<input id="text" type="text" name="message" class="edit-form__message" value="`) <input id="text" type="text" name="message" class="edit-form__message" value="`)
//line views/mutators.qtpl:105 //line views/mutators.qtpl:105
qw422016.E().S(message) qw422016.E().S(message)
//line views/mutators.qtpl:105 //line views/mutators.qtpl:105
qw422016.N().S(`"> qw422016.N().S(`">
<br/><br/> <br/><br/>
<input type="submit" name="action" class="btn btn_accent" value="Save" class="edit-form__save"/> <input type="submit" name="action" class="btn btn_accent edit-form__save" value="Save"/>
<input type="submit" name="action" class="btn" value="Preview" class="edit-form__preview"> <input type="submit" name="action" class="btn edit-form__preview" value="Preview">
<a href="/hypha/`) <a href="/hypha/`)
//line views/mutators.qtpl:109 //line views/mutators.qtpl:109
qw422016.E().S(hyphaName) qw422016.E().S(hyphaName)
//line views/mutators.qtpl:109 //line views/mutators.qtpl:109
qw422016.N().S(`" class="btn btn_weak">Cancel</a> qw422016.N().S(`" class="btn btn_weak">Cancel</a>
</form> </form>
<p class="warning">Note that the hypha is not saved yet. You can preview the changes </p> <p class="warning">Note that the hypha hasn't been saved yet. Here's the preview:</p>
<article class="edit__preview">`) <article class="edit__preview">`)
//line views/mutators.qtpl:112 //line views/mutators.qtpl:112
qw422016.N().S(renderedPage) qw422016.N().S(renderedPage)