Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Offline
Re: [plugin] [ORPHAN] peg_nested_comments
etc wrote #268587:
If someone still uses this plugin , here is a working (nested and minimally sanitized) version.
I like it, thanks.
Maybe you could complete the third point of the plugin help by suggesting the add of <txp:if_comments></txp:if_comments> around <txp:peg_reply_to /> to show this field only if it’s indeed possible to reply to a comment.
Offline
Re: [plugin] [ORPHAN] peg_nested_comments
Thanks, I actually use this condition on my site. :) Will modify the help in the next version.
Offline
Re: [plugin] [ORPHAN] peg_nested_comments
etc wrote #294753:
Thanks, I actually use this condition on my site. :) Will modify the help in the next version.
As the #peg_replyto_backlink and #peg_replyto_new links are displayed on replying only, wouldn’t it be good to make the whole <txp:peg_reply_to /> field work that way to avoid any misundertanding about this inactive field in the comment form when the user is not replying?
Offline
Re: [plugin] [ORPHAN] peg_nested_comments
You are probably right, but I’m bad at UX and prefer to leave it with users. It’s only Javascript in this part, if you suggest a tweak that makes it work more nicely, I will gladly incorporate it.
Offline
Re: [plugin] [ORPHAN] peg_nested_comments
etc wrote #294784:
You are probably right, but I’m bad at UX and prefer to leave it with users. It’s only Javascript in this part, if you suggest a tweak that makes it work more nicely, I will gladly incorporate it.
Ok, i’ll give it a try.
Offline
Re: [plugin] [ORPHAN] peg_nested_comments
NicolasGraph wrote #294798:
Ok, i’ll give it a try.
Feel free to change the entire “Reply to” block if it helps, it was just a rapid bricolage for my own use. We can totally hide the input field and replace it with something less disturbing, for example.
Offline
Re: [plugin] [ORPHAN] peg_nested_comments
etc wrote #294823:
Feel free to change the entire “Reply to” block if it helps, it was just a rapid bricolage for my own use. We can totally hide the input field and replace it with something less disturbing, for example.
Ok, I’ve done my own quick bricolage for now:
// adds an invisible value to the reply form
// telling us what comment is being replied to
// pretty much swiped from cha_comment_reply
function peg_reply_to($atts) {
extract(lAtts(array(
'back' => '#',
'label' => 'Replying to',
'close' => '×',
'size' => 25
),$atts));
$reply_to = htmlspecialchars(ps('peg_replyto'));
$reply_to_input = htmlspecialchars(ps('peg_replyto_input'));
return
'<span id="peg_replyto_wrap" style="'.($reply_to?'':'display:none').'">'.n.
'<label for="peg_replyto_input" id="peg_replyto_label">'.$label.'</label><input type="text" name="peg_replyto_input" id="peg_replyto_input" value="'.$reply_to_input.'" readonly="readonly" size="'.$size.'" /><input type="hidden" name="peg_replyto" id="peg_replyto" value="'.$reply_to.'" />'.n.
($back ? '<a id="peg_replyto_backlink" href='.($reply_to?"#c$reply_to":"#").'>'.$back.'</a>' : '').n.
($close ? '<a id="peg_replyto_closelink" href="#peg_replyto_input" title="Empty" onclick="return peg_selectComment(null,null,null,this);">'.$close.'</a>' : '').'</span>'.n.
'<script type="text/javascript">
function peg_selectComment(discussid,name,title,target) {
var pegSelect = document.getElementById("peg_replyto");
var pegSelectWrap = document.getElementById("peg_replyto_wrap");
var pegSelectInput = document.getElementById("peg_replyto_input");
var pegSelectBack = document.getElementById("peg_replyto_backlink");
if(pegSelect) pegSelect.value = discussid;
if(pegSelectWrap) {
pegSelectWrap.setAttribute("style", discussid?"":"display:none");
}
if(pegSelectInput) {
pegSelectInput.value = (name?name:"");
pegSelectInput.title = (title?title:"");
}
if(pegSelectBack) {
pegSelectBack.href = (discussid?"#c"+discussid:null);
pegSelectBack.title = (discussid?discussid:"");
}
return !!discussid;
}
</script>';
}
Instead of hidding the peg_replyto_dock, I use display:none on a wrapper span which hide the whole block and collapse it space when the user is not replying.
I also removed the peg_replyto_dock span, added a label with its own attribute and changed the new attribute to close. That’s it I think.
On simple comment:

On replying (using custom attributes values):

Last edited by NicolasGraph (2015-09-15 20:01:02)
Offline
Offline
Re: [plugin] [ORPHAN] peg_nested_comments
Thanks Nicolas, it’s fine with me, but display:none could provoke a jump in some layouts. We could probably somehow delegate it to user CSS ?
Offline
Re: [plugin] [ORPHAN] peg_nested_comments
Oh yes, we could just switch between two classes and let the user choose if he wants to hide the block and how, or if he wants to play with its opacity or whatever… CSS exemples can be include in plugin help.
Offline
Re: [plugin] [ORPHAN] peg_nested_comments
NicolasGraph wrote #294868:
Oh yes, we could just switch between two classes and let the user choose if he wants to hide the block and how, or if he wants to play with its opacity or whatever… CSS exemples can be include in plugin help.
Yes, I like it! What if we put it on Github, so you will be able to modify it directly? It’s rather disappointing to wait for someone when you have inspiration.
Offline
Offline
Re: [plugin] [ORPHAN] peg_nested_comments
Ok, created a repository for it. What is your github username?
Offline
Re: [plugin] [ORPHAN] peg_nested_comments
etc wrote #294878:
Ok, created a repository for it. What is your github username?
It’s the sams as here: NicolasGraph
Offline