AndrewSimm
Well-known member
I am working on a news mod for my site, where I promote a thread to the main page. Once on the main page you click a link to view the news (thread). The news is the first post in a thread (my mod won't let you promote any others). Under this post I am using the post macro to render out the other post (comments). Everything works fine, except when I reply I have to refresh the page to see. I just need to figure out how to get AJAX working with this.
HTML:
<xf:if is="$canInlineMod">
<xf:js src="xf/inline_mod.js" min="1" />
</xf:if>
<xf:foreach loop="$posts" value="$post">
<div class="block post-block" data-xf-init="{{ $canInlineMod ? 'inline-mod' : '' }}" data-type="post" data-href="{{ link('inline-mod') }}">
<div class="block-container">
<div class="block-body">
<xf:macro template="post_macros" name="post" arg-post="{$post}" arg-thread="{$thread}" />
</div>
</div>
</div>
</xf:foreach>
<xf:if is="$thread.canReply()">
<xf:form action="{{ link('threads/add-reply', $thread) }}"
ajax="true"
draft="{{ link('threads/draft', $thread) }}"
class="block js-quickReply"
data-xf-init="attachment-manager quick-reply{{ $xf.visitor.isShownCaptcha() ? ' guest-captcha' : '' }}"
data-message-container="< :prev | .js-replyNewMessageContainer"
data-preview-url="{{ link('threads/reply-preview', $thread, {'quick_reply': 1}) }}">
<xf:js src="xf/message.js" min="1" />
<xf:set var="$lastPost" value="{$posts|last}" />
<div class="block-container">
<div class="block-body">
<xf:macro template="quick_reply_macros" name="body"
arg-message="{$thread.draft_reply.message}"
arg-attachmentData="{$attachmentData}"
arg-forceHash="{$thread.draft_reply.attachment_hash}"
arg-messageSelector=".js-post"
arg-multiQuoteHref="{{ link('threads/multi-quote', $thread) }}"
arg-multiQuoteStorageKey="multiQuoteThread"
arg-lastDate="{$lastPost.post_date}"
arg-lastKnownDate="{$thread.last_post_date}" />
</div>
</div>
</xf:form>
</xf:if>