forked from andyburke/autonomous.contact
feature: first pass on replies
refactor: move more smarts in the smartforms around
This commit is contained in:
parent
e1bb07a138
commit
ab63d4ba8d
6 changed files with 343 additions and 181 deletions
82
public/tabs/forum/new_post.html
Normal file
82
public/tabs/forum/new_post.html
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
<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;
|
||||
"
|
||||
on_reply="(post) => { append_posts([post]); }"
|
||||
on_parsed="(post) => { render_post(post); document.getElementById('post-' + post.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
|
||||
/>
|
||||
|
||||
<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_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"
|
||||
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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue