autonomous.contact/public/tabs/forum/new_post.html

91 lines
2.2 KiB
HTML
Raw Normal View History

<div class="new-post-container">
<label>
<input type="checkbox" collapse-toggle />
<i class="icon plus" style="display: inline-block; margin-right: 0.5rem"></i>
<span>New Post</span>
</label>
<form
data-smart="true"
data-requires-permission="topics.posts.create"
method="POST"
class="post-creation-form collapsible"
style="
margin-top: 1rem
width: 100%;
transition: all 0.5s;
"
url="/api/topics/${ document.body.dataset.topic }/events"
on_reply="async (event) => { await document.getElementById( 'posts-list' ).__render(event); document.getElementById(event.id)?.classList.remove('sending'); }"
on_parsed="async (event) => { await document.getElementById( 'posts-list' ).__render(event); document.getElementById(event.id)?.classList.add('sending'); }"
>
<input type="hidden" name="type" value="post" />
<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
/>
2025-09-21 18:29:37 -07:00
<input
type="hidden"
name="creator_id"
generator="() => { return APP.user?.id; }"
2025-09-21 18:29:37 -07:00
/>
<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) => { const parent_post = form.closest( '.post-container' ); return parent_post?.dataset?.post_id; }"
/>
<input
class="new-post-subject"
type="text"
name="data.subject"
value=""
placeholder="Post subject..."
style="margin-bottom: 1rem"
reset-on-submit
/>
<label>
<input
aria-label="Upload and share file"
type="file"
multiple
data-smartforms-save-to-home="true"
2025-09-21 18:29:37 -07:00
name="data.media"
reset-on-submit
/>
<div class="icon attachment"></div>
</label>
<textarea
type="text"
name="data.content"
value=""
placeholder=" ... "
reset-on-submit
></textarea>
<input type="submit" value="Post" />
</form>
</div>