Avoiding the post_bar.tpl after the first post
-
@zethon if you want it to work until core is fixed... replace these two lines https://github.com/NodeBB/NodeBB/blob/master/public/src/client/topic/posts.js#L350-L351
with this...
$('.post-bar-placeholder').replaceWith($('.post-bar').clone());
-
@pichalite said in Avoiding the post_bar.tpl after the first post:
@zethon if you want it to work until core is fixed... replace these two lines https://github.com/NodeBB/NodeBB/blob/master/public/src/client/topic/posts.js#L350-L351
with this...
$('.post-bar-placeholder').replaceWith($('.post-bar').clone());
That did the trick. Thank you!
-
Are the tags hardcoded into the post-bar? I tried removing them from the post_bar.tpl (and added them to the bottom of topic.tpl, right above the include for post_bar.tpl) but they still show at the top post_bar (which is in the place I want it, now).
-
@zethon said in Avoiding the post_bar.tpl after the first post:
Are the tags hardcoded into the post-bar?
Don't think so. Post your tpl code here.
-
@pichalite I've forked the persona theme and am working with my own copy here: https://github.com/zethon/nodebb-theme-persona
You can see post_bar.tpl here: https://github.com/zethon/nodebb-theme-persona/blob/master/templates/partials/post_bar.tpl
I've removed the tags, but they still show. My "OMG" comment to verify that my changes are live appears in the page's source.
-
@zethon they are still showing up because you still have the tags inside the postbar
div
tag.anything included in this div tag gets cloned to the placeholder.
https://github.com/zethon/nodebb-theme-persona/blob/master/templates/topic.tpl#L38 -
Ok, just for my own understanding, the <div class="post-bar"> element has two functions (so to speak):
- first it defines the elements in that div, "post-bar" (ie. any child elements it may have) and then
- second it displays them in the place they're being defined
Then later on if you need to display the items again you can just use: <div class="post-bar-placeholder"></div> instead of duplicating the code.
Does this sound about right?
-
Another interesting quirk I've realized this morning. We use pagination (since most of us can't stand infinite scrolling) and with my changes, the post-bar only shows at the top of the first page. If I navigate to page 2 (or higher) of the same thread, the post-bar only shows on the bottom. Thoughts?
-
@zethon said in Avoiding the post_bar.tpl after the first post:
the post-bar only shows at the top of the first page
that's because the post-bar placeholder duplication is only setup to be at the first post in a topic.
Modify this line https://github.com/NodeBB/NodeBB/blob/master/public/src/client/topic/posts.js#L350 and remove
!!mainPost.length &&
from theif
condition.