mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-13 05:50:27 +00:00
Organize the toolbar and add the link yourself button
This commit is contained in:
parent
9070ef90e2
commit
04f3372687
@ -177,11 +177,13 @@ header { width: 100%; margin-bottom: 1rem; }
|
|||||||
main { grid-column: 1 / span 1; grid-row: 1 / span 2; }
|
main { grid-column: 1 / span 1; grid-row: 1 / span 2; }
|
||||||
.relative-hyphae { grid-column: 2 / span 1; grid-row: 1 / span 1; }
|
.relative-hyphae { grid-column: 2 / span 1; grid-row: 1 / span 1; }
|
||||||
.layout-card { width: 100%; }
|
.layout-card { width: 100%; }
|
||||||
|
.edit-toolbar { margin: 0 0 0 auto; }
|
||||||
|
.edit-toolbar__buttons { display: grid; grid-template-columns: 1fr 1fr; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 1250px) {
|
@media screen and (min-width: 1250px) {
|
||||||
.layout { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
|
.layout { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
|
||||||
.layout-card { max-width: 16rem; }
|
.layout-card { max-width: 18rem; }
|
||||||
.main-width { margin: 0 auto; }
|
.main-width { margin: 0 auto; }
|
||||||
.backlinks { grid-column: 1 / span 1; margin-right: 0; }
|
.backlinks { grid-column: 1 / span 1; margin-right: 0; }
|
||||||
main { grid-column: 2 / span 1; }
|
main { grid-column: 2 / span 1; }
|
||||||
@ -204,6 +206,7 @@ textarea {font-size:16px; font-family: 'PT Sans', 'Liberation Sans', sans-serif;
|
|||||||
.edit-form {height:70vh;}
|
.edit-form {height:70vh;}
|
||||||
.edit-form textarea {width:100%;height:95%;}
|
.edit-form textarea {width:100%;height:95%;}
|
||||||
.edit-form__save { font-weight: bold; }
|
.edit-form__save { font-weight: bold; }
|
||||||
|
.edit-toolbar__buttons, .edit-toolbar__ad { margin: .5rem; }
|
||||||
|
|
||||||
.icon {margin-right: .25rem; vertical-align: bottom; }
|
.icon {margin-right: .25rem; vertical-align: bottom; }
|
||||||
|
|
||||||
@ -433,34 +436,19 @@ function getSelectedText(el = editTextarea) {
|
|||||||
return text.substring(start, end)
|
return text.substring(start, end)
|
||||||
}
|
}
|
||||||
|
|
||||||
function insertTextAtCursor(text, cursorPosition = null, el = editTextarea) {
|
function textInserter(text, cursorPosition = null, el = editTextarea) {
|
||||||
const [start, end] = [el.selectionStart, el.selectionEnd]
|
return function() {
|
||||||
el.setRangeText(text, start, end, 'select')
|
const [start, end] = [el.selectionStart, el.selectionEnd]
|
||||||
el.focus()
|
el.setRangeText(text, start, end, 'select')
|
||||||
if (cursorPosition == null) {
|
el.focus()
|
||||||
placeCursor(end + text.length)
|
if (cursorPosition == null) {
|
||||||
} else {
|
placeCursor(end + text.length)
|
||||||
placeCursor(end + cursorPosition)
|
} else {
|
||||||
|
placeCursor(end + cursorPosition)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function wrapSelection(prefix, postfix = null, el = editTextarea) {
|
|
||||||
const [start, end] = [el.selectionStart, el.selectionEnd]
|
|
||||||
if (postfix == null) {
|
|
||||||
postfix = prefix
|
|
||||||
}
|
|
||||||
text = getSelectedText(el)
|
|
||||||
result = prefix + text + postfix
|
|
||||||
el.setRangeText(result, start, end, 'select')
|
|
||||||
el.focus()
|
|
||||||
placeCursor(end + (prefix + postfix).length)
|
|
||||||
}
|
|
||||||
|
|
||||||
function insertDate() {
|
|
||||||
let date = new Date().toISOString().split('T')[0]
|
|
||||||
insertTextAtCursor(date)
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectionWrapper(cursorPosition, prefix, postfix = null, el = editTextarea) {
|
function selectionWrapper(cursorPosition, prefix, postfix = null, el = editTextarea) {
|
||||||
return function() {
|
return function() {
|
||||||
const [start, end] = [el.selectionStart, el.selectionEnd]
|
const [start, end] = [el.selectionStart, el.selectionEnd]
|
||||||
@ -485,14 +473,24 @@ const wrapBold = selectionWrapper(2, '**'),
|
|||||||
wrapHighlighted = selectionWrapper(2, '!!'),
|
wrapHighlighted = selectionWrapper(2, '!!'),
|
||||||
wrapLifted = selectionWrapper(1, '^'),
|
wrapLifted = selectionWrapper(1, '^'),
|
||||||
wrapLowered = selectionWrapper(2, ',,'),
|
wrapLowered = selectionWrapper(2, ',,'),
|
||||||
wrapStrikethrough = selectionWrapper(2, '~~')
|
wrapStrikethrough = selectionWrapper(2, '~~'),
|
||||||
|
wrapLink = selectionWrapper(2, '[[', ']]')
|
||||||
|
|
||||||
function insertHorizontalBar() {
|
const insertHorizontalBar = textInserter('----\n'),
|
||||||
insertTextAtCursor('----\n')
|
insertImgBlock = textInserter('img {\n\t\n}\n', 7),
|
||||||
|
insertTableBlock = textInserter('table {\n\t\n}\n', 9),
|
||||||
|
insertRocket = textInserter('=> '),
|
||||||
|
insertXcl = textInserter('<= ')
|
||||||
|
|
||||||
|
function insertDate() {
|
||||||
|
let date = new Date().toISOString().split('T')[0]
|
||||||
|
textInserter(date)()
|
||||||
}
|
}
|
||||||
|
|
||||||
function insertImgBlock() {
|
function insertUserlink() {
|
||||||
insertTextAtCursor('img {\n\t\n}\n', 7)
|
const userlink = document.querySelector('.header-links__entry_user a')
|
||||||
|
const userHypha = userlink.getAttribute('href').substring(7) // no /hypha/
|
||||||
|
textInserter('[[' + userHypha + ']]')()
|
||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
//line assets/assets.qtpl:14
|
//line assets/assets.qtpl:14
|
||||||
|
@ -66,11 +66,13 @@ header { width: 100%; margin-bottom: 1rem; }
|
|||||||
main { grid-column: 1 / span 1; grid-row: 1 / span 2; }
|
main { grid-column: 1 / span 1; grid-row: 1 / span 2; }
|
||||||
.relative-hyphae { grid-column: 2 / span 1; grid-row: 1 / span 1; }
|
.relative-hyphae { grid-column: 2 / span 1; grid-row: 1 / span 1; }
|
||||||
.layout-card { width: 100%; }
|
.layout-card { width: 100%; }
|
||||||
|
.edit-toolbar { margin: 0 0 0 auto; }
|
||||||
|
.edit-toolbar__buttons { display: grid; grid-template-columns: 1fr 1fr; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width: 1250px) {
|
@media screen and (min-width: 1250px) {
|
||||||
.layout { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
|
.layout { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
|
||||||
.layout-card { max-width: 16rem; }
|
.layout-card { max-width: 18rem; }
|
||||||
.main-width { margin: 0 auto; }
|
.main-width { margin: 0 auto; }
|
||||||
.backlinks { grid-column: 1 / span 1; margin-right: 0; }
|
.backlinks { grid-column: 1 / span 1; margin-right: 0; }
|
||||||
main { grid-column: 2 / span 1; }
|
main { grid-column: 2 / span 1; }
|
||||||
@ -93,6 +95,7 @@ textarea {font-size:16px; font-family: 'PT Sans', 'Liberation Sans', sans-serif;
|
|||||||
.edit-form {height:70vh;}
|
.edit-form {height:70vh;}
|
||||||
.edit-form textarea {width:100%;height:95%;}
|
.edit-form textarea {width:100%;height:95%;}
|
||||||
.edit-form__save { font-weight: bold; }
|
.edit-form__save { font-weight: bold; }
|
||||||
|
.edit-toolbar__buttons, .edit-toolbar__ad { margin: .5rem; }
|
||||||
|
|
||||||
.icon {margin-right: .25rem; vertical-align: bottom; }
|
.icon {margin-right: .25rem; vertical-align: bottom; }
|
||||||
|
|
||||||
|
@ -11,34 +11,19 @@ function getSelectedText(el = editTextarea) {
|
|||||||
return text.substring(start, end)
|
return text.substring(start, end)
|
||||||
}
|
}
|
||||||
|
|
||||||
function insertTextAtCursor(text, cursorPosition = null, el = editTextarea) {
|
function textInserter(text, cursorPosition = null, el = editTextarea) {
|
||||||
const [start, end] = [el.selectionStart, el.selectionEnd]
|
return function() {
|
||||||
el.setRangeText(text, start, end, 'select')
|
const [start, end] = [el.selectionStart, el.selectionEnd]
|
||||||
el.focus()
|
el.setRangeText(text, start, end, 'select')
|
||||||
if (cursorPosition == null) {
|
el.focus()
|
||||||
placeCursor(end + text.length)
|
if (cursorPosition == null) {
|
||||||
} else {
|
placeCursor(end + text.length)
|
||||||
placeCursor(end + cursorPosition)
|
} else {
|
||||||
|
placeCursor(end + cursorPosition)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function wrapSelection(prefix, postfix = null, el = editTextarea) {
|
|
||||||
const [start, end] = [el.selectionStart, el.selectionEnd]
|
|
||||||
if (postfix == null) {
|
|
||||||
postfix = prefix
|
|
||||||
}
|
|
||||||
text = getSelectedText(el)
|
|
||||||
result = prefix + text + postfix
|
|
||||||
el.setRangeText(result, start, end, 'select')
|
|
||||||
el.focus()
|
|
||||||
placeCursor(end + (prefix + postfix).length)
|
|
||||||
}
|
|
||||||
|
|
||||||
function insertDate() {
|
|
||||||
let date = new Date().toISOString().split('T')[0]
|
|
||||||
insertTextAtCursor(date)
|
|
||||||
}
|
|
||||||
|
|
||||||
function selectionWrapper(cursorPosition, prefix, postfix = null, el = editTextarea) {
|
function selectionWrapper(cursorPosition, prefix, postfix = null, el = editTextarea) {
|
||||||
return function() {
|
return function() {
|
||||||
const [start, end] = [el.selectionStart, el.selectionEnd]
|
const [start, end] = [el.selectionStart, el.selectionEnd]
|
||||||
@ -59,12 +44,22 @@ const wrapBold = selectionWrapper(2, '**'),
|
|||||||
wrapHighlighted = selectionWrapper(2, '!!'),
|
wrapHighlighted = selectionWrapper(2, '!!'),
|
||||||
wrapLifted = selectionWrapper(1, '^'),
|
wrapLifted = selectionWrapper(1, '^'),
|
||||||
wrapLowered = selectionWrapper(2, ',,'),
|
wrapLowered = selectionWrapper(2, ',,'),
|
||||||
wrapStrikethrough = selectionWrapper(2, '~~')
|
wrapStrikethrough = selectionWrapper(2, '~~'),
|
||||||
|
wrapLink = selectionWrapper(2, '[[', ']]')
|
||||||
|
|
||||||
function insertHorizontalBar() {
|
const insertHorizontalBar = textInserter('----\n'),
|
||||||
insertTextAtCursor('----\n')
|
insertImgBlock = textInserter('img {\n\t\n}\n', 7),
|
||||||
|
insertTableBlock = textInserter('table {\n\t\n}\n', 9),
|
||||||
|
insertRocket = textInserter('=> '),
|
||||||
|
insertXcl = textInserter('<= ')
|
||||||
|
|
||||||
|
function insertDate() {
|
||||||
|
let date = new Date().toISOString().split('T')[0]
|
||||||
|
textInserter(date)()
|
||||||
}
|
}
|
||||||
|
|
||||||
function insertImgBlock() {
|
function insertUserlink() {
|
||||||
insertTextAtCursor('img {\n\t\n}\n', 7)
|
const userlink = document.querySelector('.header-links__entry_user a')
|
||||||
|
const userHypha = userlink.getAttribute('href').substring(7) // no /hypha/
|
||||||
|
textInserter('[[' + userHypha + ']]')()
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
{% import "net/http" %}
|
{% import "net/http" %}
|
||||||
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
||||||
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||||
|
|
||||||
{% func Toolbar() %}
|
{% func Toolbar(u *user.User) %}
|
||||||
<aside class="edit-toolbar layout-card">
|
<aside class="edit-toolbar layout-card">
|
||||||
<h2 class="edit-toolbar__title layout-card__title">Actions</h2>
|
<h2 class="edit-toolbar__title layout-card__title">Markup</h2>
|
||||||
|
<section class="edit-toolbar__buttons">
|
||||||
{% for _, el := range []struct{
|
{% for _, el := range []struct{
|
||||||
class string
|
class string
|
||||||
onclick string
|
onclick string
|
||||||
display string
|
display string
|
||||||
}{
|
}{
|
||||||
|
{"link", "wrapLink()", "[[link]]"},
|
||||||
{"bold", "wrapBold()", "<b>**Bold**</b>"},
|
{"bold", "wrapBold()", "<b>**Bold**</b>"},
|
||||||
{"italic", "wrapItalic()", "<i>//Italic//</i>"},
|
{"italic", "wrapItalic()", "<i>//Italic//</i>"},
|
||||||
{"highlighted", "wrapHighlighted()", "<mark>!!Highlight!!</mark>"},
|
{"highlighted", "wrapHighlighted()", "<mark>!!Highlight!!</mark>"},
|
||||||
@ -16,8 +19,27 @@
|
|||||||
{"lifted", "wrapLifted()", "<sup>^Lifted^</sup>"},
|
{"lifted", "wrapLifted()", "<sup>^Lifted^</sup>"},
|
||||||
{"lowered", "wrapLowered()", "<sub>,,Lowered,,</sub>"},
|
{"lowered", "wrapLowered()", "<sub>,,Lowered,,</sub>"},
|
||||||
{"strikethrough", "wrapStrikethrough()", "<strike>~~Strikethrough~~</strike>"},
|
{"strikethrough", "wrapStrikethrough()", "<strike>~~Strikethrough~~</strike>"},
|
||||||
{"img", "insertImgBlock()", "Image block <code>img {}</code>"},
|
{"rocket", "insertRocket()", "=> rocketlink"},
|
||||||
|
{"xcl", "insertXcl()", "<= transclusion"},
|
||||||
|
{"img", "insertImgBlock()", "<code>img {}</code>"},
|
||||||
|
{"table", "insertTableBlock()", "<code>table {}</code>"},
|
||||||
{"hr", "insertHorizontalBar()", "Horizontal bar"},
|
{"hr", "insertHorizontalBar()", "Horizontal bar"},
|
||||||
|
} %}
|
||||||
|
<button
|
||||||
|
class="edit-toolbar__btn edit-toolbar__{%s el.class %}"
|
||||||
|
onclick="{%s el.onclick %}">
|
||||||
|
{%s= el.display %}
|
||||||
|
</button>
|
||||||
|
{% endfor %}
|
||||||
|
</section>
|
||||||
|
<p class="edit-toolbar__ad"><a href="https://mycorrhiza.lesarbr.es/hypha/mycomarkup">Learn more</a> about mycomarkup</p>
|
||||||
|
<h2 class="edit-toolbar__title layout-card__title">Actions</h2>
|
||||||
|
<section class="edit-toolbar__buttons">
|
||||||
|
{% for _, el := range []struct{
|
||||||
|
class string
|
||||||
|
onclick string
|
||||||
|
display string
|
||||||
|
}{
|
||||||
{"date", "insertDate()", "Insert current date"},
|
{"date", "insertDate()", "Insert current date"},
|
||||||
} %}
|
} %}
|
||||||
<button
|
<button
|
||||||
@ -26,6 +48,14 @@
|
|||||||
{%s= el.display %}
|
{%s= el.display %}
|
||||||
</button>
|
</button>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% if u.Group != "anon" %}
|
||||||
|
<button
|
||||||
|
class="edit-toolbar__btn edit-toolbar__user-link"
|
||||||
|
onclick="insertUserlink()">
|
||||||
|
Link yourself
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
</section>
|
||||||
</aside>
|
</aside>
|
||||||
<script src="/static/toolbar.js"></script>
|
<script src="/static/toolbar.js"></script>
|
||||||
{% endfunc %}
|
{% endfunc %}
|
||||||
@ -45,7 +75,7 @@
|
|||||||
<a href="/page/{%s hyphaName %}" class="edit-form__cancel">Cancel</a>
|
<a href="/page/{%s hyphaName %}" class="edit-form__cancel">Cancel</a>
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</main>
|
||||||
{%s= Toolbar() %}
|
{%s= Toolbar(user.FromRequest(rq)) %}
|
||||||
</div>
|
</div>
|
||||||
{% endfunc %}
|
{% endfunc %}
|
||||||
|
|
||||||
@ -66,6 +96,6 @@
|
|||||||
<p class="warning">Note that the hypha is not saved yet. You can preview the changes ↓</p>
|
<p class="warning">Note that the hypha is not saved yet. You can preview the changes ↓</p>
|
||||||
<article class="edit__preview">{%s= renderedPage %}</article>
|
<article class="edit__preview">{%s= renderedPage %}</article>
|
||||||
</main>
|
</main>
|
||||||
{%s= Toolbar() %}
|
{%s= Toolbar(user.FromRequest(rq)) %}
|
||||||
</div>
|
</div>
|
||||||
{% endfunc %}
|
{% endfunc %}
|
||||||
|
@ -10,32 +10,37 @@ import "net/http"
|
|||||||
//line views/mutators.qtpl:2
|
//line views/mutators.qtpl:2
|
||||||
import "github.com/bouncepaw/mycorrhiza/util"
|
import "github.com/bouncepaw/mycorrhiza/util"
|
||||||
|
|
||||||
//line views/mutators.qtpl:4
|
//line views/mutators.qtpl:3
|
||||||
|
import "github.com/bouncepaw/mycorrhiza/user"
|
||||||
|
|
||||||
|
//line views/mutators.qtpl:5
|
||||||
import (
|
import (
|
||||||
qtio422016 "io"
|
qtio422016 "io"
|
||||||
|
|
||||||
qt422016 "github.com/valyala/quicktemplate"
|
qt422016 "github.com/valyala/quicktemplate"
|
||||||
)
|
)
|
||||||
|
|
||||||
//line views/mutators.qtpl:4
|
//line views/mutators.qtpl:5
|
||||||
var (
|
var (
|
||||||
_ = qtio422016.Copy
|
_ = qtio422016.Copy
|
||||||
_ = qt422016.AcquireByteBuffer
|
_ = qt422016.AcquireByteBuffer
|
||||||
)
|
)
|
||||||
|
|
||||||
//line views/mutators.qtpl:4
|
//line views/mutators.qtpl:5
|
||||||
func StreamToolbar(qw422016 *qt422016.Writer) {
|
func StreamToolbar(qw422016 *qt422016.Writer, u *user.User) {
|
||||||
//line views/mutators.qtpl:4
|
//line views/mutators.qtpl:5
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<aside class="edit-toolbar layout-card">
|
<aside class="edit-toolbar layout-card">
|
||||||
<h2 class="edit-toolbar__title layout-card__title">Actions</h2>
|
<h2 class="edit-toolbar__title layout-card__title">Markup</h2>
|
||||||
|
<section class="edit-toolbar__buttons">
|
||||||
`)
|
`)
|
||||||
//line views/mutators.qtpl:7
|
//line views/mutators.qtpl:9
|
||||||
for _, el := range []struct {
|
for _, el := range []struct {
|
||||||
class string
|
class string
|
||||||
onclick string
|
onclick string
|
||||||
display string
|
display string
|
||||||
}{
|
}{
|
||||||
|
{"link", "wrapLink()", "[[link]]"},
|
||||||
{"bold", "wrapBold()", "<b>**Bold**</b>"},
|
{"bold", "wrapBold()", "<b>**Bold**</b>"},
|
||||||
{"italic", "wrapItalic()", "<i>//Italic//</i>"},
|
{"italic", "wrapItalic()", "<i>//Italic//</i>"},
|
||||||
{"highlighted", "wrapHighlighted()", "<mark>!!Highlight!!</mark>"},
|
{"highlighted", "wrapHighlighted()", "<mark>!!Highlight!!</mark>"},
|
||||||
@ -43,224 +48,279 @@ func StreamToolbar(qw422016 *qt422016.Writer) {
|
|||||||
{"lifted", "wrapLifted()", "<sup>^Lifted^</sup>"},
|
{"lifted", "wrapLifted()", "<sup>^Lifted^</sup>"},
|
||||||
{"lowered", "wrapLowered()", "<sub>,,Lowered,,</sub>"},
|
{"lowered", "wrapLowered()", "<sub>,,Lowered,,</sub>"},
|
||||||
{"strikethrough", "wrapStrikethrough()", "<strike>~~Strikethrough~~</strike>"},
|
{"strikethrough", "wrapStrikethrough()", "<strike>~~Strikethrough~~</strike>"},
|
||||||
{"img", "insertImgBlock()", "Image block <code>img {}</code>"},
|
{"rocket", "insertRocket()", "=> rocketlink"},
|
||||||
|
{"xcl", "insertXcl()", "<= transclusion"},
|
||||||
|
{"img", "insertImgBlock()", "<code>img {}</code>"},
|
||||||
|
{"table", "insertTableBlock()", "<code>table {}</code>"},
|
||||||
{"hr", "insertHorizontalBar()", "Horizontal bar"},
|
{"hr", "insertHorizontalBar()", "Horizontal bar"},
|
||||||
{"date", "insertDate()", "Insert current date"},
|
|
||||||
} {
|
} {
|
||||||
//line views/mutators.qtpl:22
|
//line views/mutators.qtpl:27
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<button
|
<button
|
||||||
class="edit-toolbar__btn edit-toolbar__`)
|
class="edit-toolbar__btn edit-toolbar__`)
|
||||||
//line views/mutators.qtpl:24
|
//line views/mutators.qtpl:29
|
||||||
qw422016.E().S(el.class)
|
qw422016.E().S(el.class)
|
||||||
//line views/mutators.qtpl:24
|
//line views/mutators.qtpl:29
|
||||||
qw422016.N().S(`"
|
qw422016.N().S(`"
|
||||||
onclick="`)
|
onclick="`)
|
||||||
//line views/mutators.qtpl:25
|
//line views/mutators.qtpl:30
|
||||||
qw422016.E().S(el.onclick)
|
qw422016.E().S(el.onclick)
|
||||||
//line views/mutators.qtpl:25
|
//line views/mutators.qtpl:30
|
||||||
qw422016.N().S(`">
|
qw422016.N().S(`">
|
||||||
`)
|
`)
|
||||||
//line views/mutators.qtpl:26
|
//line views/mutators.qtpl:31
|
||||||
qw422016.N().S(el.display)
|
qw422016.N().S(el.display)
|
||||||
//line views/mutators.qtpl:26
|
//line views/mutators.qtpl:31
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</button>
|
</button>
|
||||||
`)
|
`)
|
||||||
//line views/mutators.qtpl:28
|
//line views/mutators.qtpl:33
|
||||||
}
|
}
|
||||||
//line views/mutators.qtpl:28
|
//line views/mutators.qtpl:33
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
|
</section>
|
||||||
|
<p class="edit-toolbar__ad"><a href="https://mycorrhiza.lesarbr.es/hypha/mycomarkup">Learn more</a> about mycomarkup</p>
|
||||||
|
<h2 class="edit-toolbar__title layout-card__title">Actions</h2>
|
||||||
|
<section class="edit-toolbar__buttons">
|
||||||
|
`)
|
||||||
|
//line views/mutators.qtpl:38
|
||||||
|
for _, el := range []struct {
|
||||||
|
class string
|
||||||
|
onclick string
|
||||||
|
display string
|
||||||
|
}{
|
||||||
|
{"date", "insertDate()", "Insert current date"},
|
||||||
|
} {
|
||||||
|
//line views/mutators.qtpl:44
|
||||||
|
qw422016.N().S(`
|
||||||
|
<button
|
||||||
|
class="edit-toolbar__btn edit-toolbar__`)
|
||||||
|
//line views/mutators.qtpl:46
|
||||||
|
qw422016.E().S(el.class)
|
||||||
|
//line views/mutators.qtpl:46
|
||||||
|
qw422016.N().S(`"
|
||||||
|
onclick="`)
|
||||||
|
//line views/mutators.qtpl:47
|
||||||
|
qw422016.E().S(el.onclick)
|
||||||
|
//line views/mutators.qtpl:47
|
||||||
|
qw422016.N().S(`">
|
||||||
|
`)
|
||||||
|
//line views/mutators.qtpl:48
|
||||||
|
qw422016.N().S(el.display)
|
||||||
|
//line views/mutators.qtpl:48
|
||||||
|
qw422016.N().S(`
|
||||||
|
</button>
|
||||||
|
`)
|
||||||
|
//line views/mutators.qtpl:50
|
||||||
|
}
|
||||||
|
//line views/mutators.qtpl:50
|
||||||
|
qw422016.N().S(`
|
||||||
|
`)
|
||||||
|
//line views/mutators.qtpl:51
|
||||||
|
if u.Group != "anon" {
|
||||||
|
//line views/mutators.qtpl:51
|
||||||
|
qw422016.N().S(`
|
||||||
|
<button
|
||||||
|
class="edit-toolbar__btn edit-toolbar__user-link"
|
||||||
|
onclick="insertUserlink()">
|
||||||
|
Link yourself
|
||||||
|
</button>
|
||||||
|
`)
|
||||||
|
//line views/mutators.qtpl:57
|
||||||
|
}
|
||||||
|
//line views/mutators.qtpl:57
|
||||||
|
qw422016.N().S(`
|
||||||
|
</section>
|
||||||
</aside>
|
</aside>
|
||||||
<script src="/static/toolbar.js"></script>
|
<script src="/static/toolbar.js"></script>
|
||||||
`)
|
`)
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
func WriteToolbar(qq422016 qtio422016.Writer) {
|
func WriteToolbar(qq422016 qtio422016.Writer, u *user.User) {
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
StreamToolbar(qw422016)
|
StreamToolbar(qw422016, u)
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
func Toolbar() string {
|
func Toolbar(u *user.User) string {
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
WriteToolbar(qb422016)
|
WriteToolbar(qb422016, u)
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/mutators.qtpl:31
|
//line views/mutators.qtpl:61
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/mutators.qtpl:33
|
//line views/mutators.qtpl:63
|
||||||
func StreamEditHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, textAreaFill, warning string) {
|
func StreamEditHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, textAreaFill, warning string) {
|
||||||
//line views/mutators.qtpl:33
|
//line views/mutators.qtpl:63
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/mutators.qtpl:34
|
//line views/mutators.qtpl:64
|
||||||
qw422016.N().S(NavHTML(rq, hyphaName, "edit"))
|
qw422016.N().S(NavHTML(rq, hyphaName, "edit"))
|
||||||
//line views/mutators.qtpl:34
|
//line views/mutators.qtpl:64
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<main class="main-width edit edit_no-preview">
|
<main class="main-width edit edit_no-preview">
|
||||||
<h1 class="edit__title">Edit `)
|
<h1 class="edit__title">Edit `)
|
||||||
//line views/mutators.qtpl:37
|
//line views/mutators.qtpl:67
|
||||||
qw422016.E().S(util.BeautifulName(hyphaName))
|
qw422016.E().S(util.BeautifulName(hyphaName))
|
||||||
//line views/mutators.qtpl:37
|
//line views/mutators.qtpl:67
|
||||||
qw422016.N().S(`</h1>
|
qw422016.N().S(`</h1>
|
||||||
`)
|
`)
|
||||||
//line views/mutators.qtpl:38
|
//line views/mutators.qtpl:68
|
||||||
qw422016.N().S(warning)
|
qw422016.N().S(warning)
|
||||||
//line views/mutators.qtpl:38
|
//line views/mutators.qtpl:68
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<form method="post" class="edit-form"
|
<form method="post" class="edit-form"
|
||||||
action="/upload-text/`)
|
action="/upload-text/`)
|
||||||
//line views/mutators.qtpl:40
|
//line views/mutators.qtpl:70
|
||||||
qw422016.E().S(hyphaName)
|
qw422016.E().S(hyphaName)
|
||||||
//line views/mutators.qtpl:40
|
//line views/mutators.qtpl:70
|
||||||
qw422016.N().S(`">
|
qw422016.N().S(`">
|
||||||
<textarea name="text" class="edit-form__textarea">`)
|
<textarea name="text" class="edit-form__textarea">`)
|
||||||
//line views/mutators.qtpl:41
|
//line views/mutators.qtpl:71
|
||||||
qw422016.E().S(textAreaFill)
|
qw422016.E().S(textAreaFill)
|
||||||
//line views/mutators.qtpl:41
|
//line views/mutators.qtpl:71
|
||||||
qw422016.N().S(`</textarea>
|
qw422016.N().S(`</textarea>
|
||||||
<br/>
|
<br/>
|
||||||
<input type="submit" name="action" value="Save" class="edit-form__save"/>
|
<input type="submit" name="action" value="Save" class="edit-form__save"/>
|
||||||
<input type="submit" name="action" value="Preview" class="edit-form__preview">
|
<input type="submit" name="action" value="Preview" class="edit-form__preview">
|
||||||
<a href="/page/`)
|
<a href="/page/`)
|
||||||
//line views/mutators.qtpl:45
|
//line views/mutators.qtpl:75
|
||||||
qw422016.E().S(hyphaName)
|
qw422016.E().S(hyphaName)
|
||||||
//line views/mutators.qtpl:45
|
//line views/mutators.qtpl:75
|
||||||
qw422016.N().S(`" class="edit-form__cancel">Cancel</a>
|
qw422016.N().S(`" class="edit-form__cancel">Cancel</a>
|
||||||
</form>
|
</form>
|
||||||
</main>
|
</main>
|
||||||
`)
|
`)
|
||||||
//line views/mutators.qtpl:48
|
//line views/mutators.qtpl:78
|
||||||
qw422016.N().S(Toolbar())
|
qw422016.N().S(Toolbar(user.FromRequest(rq)))
|
||||||
//line views/mutators.qtpl:48
|
//line views/mutators.qtpl:78
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
func WriteEditHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, textAreaFill, warning string) {
|
func WriteEditHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, textAreaFill, warning string) {
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
StreamEditHTML(qw422016, rq, hyphaName, textAreaFill, warning)
|
StreamEditHTML(qw422016, rq, hyphaName, textAreaFill, warning)
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
func EditHTML(rq *http.Request, hyphaName, textAreaFill, warning string) string {
|
func EditHTML(rq *http.Request, hyphaName, textAreaFill, warning string) string {
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
WriteEditHTML(qb422016, rq, hyphaName, textAreaFill, warning)
|
WriteEditHTML(qb422016, rq, hyphaName, textAreaFill, warning)
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/mutators.qtpl:50
|
//line views/mutators.qtpl:80
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/mutators.qtpl:52
|
//line views/mutators.qtpl:82
|
||||||
func StreamPreviewHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, textAreaFill, warning string, renderedPage string) {
|
func StreamPreviewHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, textAreaFill, warning string, renderedPage string) {
|
||||||
//line views/mutators.qtpl:52
|
//line views/mutators.qtpl:82
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
`)
|
`)
|
||||||
//line views/mutators.qtpl:53
|
//line views/mutators.qtpl:83
|
||||||
qw422016.N().S(NavHTML(rq, hyphaName, "edit"))
|
qw422016.N().S(NavHTML(rq, hyphaName, "edit"))
|
||||||
//line views/mutators.qtpl:53
|
//line views/mutators.qtpl:83
|
||||||
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>Edit `)
|
||||||
//line views/mutators.qtpl:56
|
//line views/mutators.qtpl:86
|
||||||
qw422016.E().S(util.BeautifulName(hyphaName))
|
qw422016.E().S(util.BeautifulName(hyphaName))
|
||||||
//line views/mutators.qtpl:56
|
//line views/mutators.qtpl:86
|
||||||
qw422016.N().S(` (preview)</h1>
|
qw422016.N().S(` (preview)</h1>
|
||||||
`)
|
`)
|
||||||
//line views/mutators.qtpl:57
|
//line views/mutators.qtpl:87
|
||||||
qw422016.N().S(warning)
|
qw422016.N().S(warning)
|
||||||
//line views/mutators.qtpl:57
|
//line views/mutators.qtpl:87
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<form method="post" class="edit-form"
|
<form method="post" class="edit-form"
|
||||||
action="/upload-text/`)
|
action="/upload-text/`)
|
||||||
//line views/mutators.qtpl:59
|
//line views/mutators.qtpl:89
|
||||||
qw422016.E().S(hyphaName)
|
qw422016.E().S(hyphaName)
|
||||||
//line views/mutators.qtpl:59
|
//line views/mutators.qtpl:89
|
||||||
qw422016.N().S(`">
|
qw422016.N().S(`">
|
||||||
<textarea class="edit-form__textarea" name="text">`)
|
<textarea class="edit-form__textarea" name="text">`)
|
||||||
//line views/mutators.qtpl:60
|
//line views/mutators.qtpl:90
|
||||||
qw422016.E().S(textAreaFill)
|
qw422016.E().S(textAreaFill)
|
||||||
//line views/mutators.qtpl:60
|
//line views/mutators.qtpl:90
|
||||||
qw422016.N().S(`</textarea>
|
qw422016.N().S(`</textarea>
|
||||||
<br/>
|
<br/>
|
||||||
<input type="submit" name="action" value="Save" class="edit-form__save"/>
|
<input type="submit" name="action" value="Save" class="edit-form__save"/>
|
||||||
<input type="submit" name="action" value="Preview" class="edit-form__preview">
|
<input type="submit" name="action" value="Preview" class="edit-form__preview">
|
||||||
<a href="/page/`)
|
<a href="/page/`)
|
||||||
//line views/mutators.qtpl:64
|
//line views/mutators.qtpl:94
|
||||||
qw422016.E().S(hyphaName)
|
qw422016.E().S(hyphaName)
|
||||||
//line views/mutators.qtpl:64
|
//line views/mutators.qtpl:94
|
||||||
qw422016.N().S(`" class="edit-form__cancel">Cancel</a>
|
qw422016.N().S(`" class="edit-form__cancel">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 is not saved yet. You can preview the changes ↓</p>
|
||||||
<article class="edit__preview">`)
|
<article class="edit__preview">`)
|
||||||
//line views/mutators.qtpl:67
|
//line views/mutators.qtpl:97
|
||||||
qw422016.N().S(renderedPage)
|
qw422016.N().S(renderedPage)
|
||||||
//line views/mutators.qtpl:67
|
//line views/mutators.qtpl:97
|
||||||
qw422016.N().S(`</article>
|
qw422016.N().S(`</article>
|
||||||
</main>
|
</main>
|
||||||
`)
|
`)
|
||||||
//line views/mutators.qtpl:69
|
//line views/mutators.qtpl:99
|
||||||
qw422016.N().S(Toolbar())
|
qw422016.N().S(Toolbar(user.FromRequest(rq)))
|
||||||
//line views/mutators.qtpl:69
|
//line views/mutators.qtpl:99
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</div>
|
</div>
|
||||||
`)
|
`)
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
func WritePreviewHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, textAreaFill, warning string, renderedPage string) {
|
func WritePreviewHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, textAreaFill, warning string, renderedPage string) {
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
StreamPreviewHTML(qw422016, rq, hyphaName, textAreaFill, warning, renderedPage)
|
StreamPreviewHTML(qw422016, rq, hyphaName, textAreaFill, warning, renderedPage)
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
}
|
}
|
||||||
|
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
func PreviewHTML(rq *http.Request, hyphaName, textAreaFill, warning string, renderedPage string) string {
|
func PreviewHTML(rq *http.Request, hyphaName, textAreaFill, warning string, renderedPage string) string {
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
WritePreviewHTML(qb422016, rq, hyphaName, textAreaFill, warning, renderedPage)
|
WritePreviewHTML(qb422016, rq, hyphaName, textAreaFill, warning, renderedPage)
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
return qs422016
|
return qs422016
|
||||||
//line views/mutators.qtpl:71
|
//line views/mutators.qtpl:101
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user