80 lines
1.9 KiB
HTML
80 lines
1.9 KiB
HTML
<div class="new-blurb-container" data-requires-permission="topics.blurbs.create">
|
|
<label>
|
|
<input type="checkbox" collapse-toggle />
|
|
<i class="icon plus" style="display: inline-block; margin-right: 0.5rem"></i>
|
|
<span>New Blurb</span>
|
|
</label>
|
|
<form
|
|
data-smart="true"
|
|
method="POST"
|
|
class="blurb-creation-form collapsible"
|
|
style="
|
|
margin-top: 1rem
|
|
width: 100%;
|
|
transition: all 0.5s;
|
|
"
|
|
on_reply="async (blurb) => { await append_blurbs([blurb]); }"
|
|
on_parsed="async (blurb) => { await render_blurb(blurb); document.getElementById(blurb.id)?.classList.add('sending'); }"
|
|
>
|
|
<input type="hidden" name="type" value="blurb" />
|
|
|
|
<input
|
|
type="hidden"
|
|
name="id"
|
|
generator="(_input, form) => 'TEMP-' + form.__submitted_at.toISOString()"
|
|
reset-on-submit
|
|
/>
|
|
<input
|
|
type="hidden"
|
|
name="meta.temp_id"
|
|
generator="(_input, form) => 'TEMP-' + form.__submitted_at.toISOString()"
|
|
reset-on-submit
|
|
/>
|
|
|
|
<input
|
|
type="hidden"
|
|
name="creator_id"
|
|
generator="() => { return JSON.parse( document.body.dataset.user ?? '{}' ).id; }"
|
|
/>
|
|
|
|
<input
|
|
type="hidden"
|
|
name="timestamps.created"
|
|
generator="(_input, form) => form.__submitted_at.toISOString()"
|
|
reset-on-submit
|
|
/>
|
|
<input
|
|
type="hidden"
|
|
name="timestamps.updated"
|
|
generator="(_input, form) => form.__submitted_at.toISOString()"
|
|
reset-on-submit
|
|
/>
|
|
|
|
<input
|
|
type="hidden"
|
|
name="parent_id"
|
|
generator="(_input, form) => { debugger; const parent_blurb = form.closest( '.blurb-container' ); return parent_blurb?.dataset?.blurb_id; }"
|
|
/>
|
|
|
|
<label>
|
|
<input
|
|
aria-label="Upload and share file"
|
|
type="file"
|
|
multiple
|
|
data-smartforms-save-to-home="true"
|
|
name="data.media"
|
|
reset-on-submit
|
|
/>
|
|
<div class="icon attachment"></div>
|
|
</label>
|
|
<textarea
|
|
type="text"
|
|
name="data.blurb"
|
|
value=""
|
|
maxlength="256"
|
|
placeholder=" ... "
|
|
reset-on-submit
|
|
></textarea>
|
|
<input type="submit" value="Blurb" />
|
|
</form>
|
|
</div>
|