feature: forum replies
feature: blurbs
This commit is contained in:
parent
ab63d4ba8d
commit
591fd38088
14 changed files with 651 additions and 290 deletions
80
public/tabs/blurbs/new_blurb.html
Normal file
80
public/tabs/blurbs/new_blurb.html
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
<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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue