Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2012-12-09 16:38:52

etc
Developer
Registered: 2010-11-11
Posts: 3,937
Website

Re: [plugin] [ORPHAN] peg_nested_comments

If someone still uses this plugin , here is a working (nested and minimally sanitized) version.

Offline

#32 2015-09-12 16:09:34

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

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.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#33 2015-09-12 16:54:03

etc
Developer
Registered: 2010-11-11
Posts: 3,937
Website

Re: [plugin] [ORPHAN] peg_nested_comments

Thanks, I actually use this condition on my site. :) Will modify the help in the next version.

Offline

#34 2015-09-13 12:41:16

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

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?


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#35 2015-09-13 19:56:30

etc
Developer
Registered: 2010-11-11
Posts: 3,937
Website

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

#36 2015-09-14 14:46:59

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

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.


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#37 2015-09-15 09:11:07

etc
Developer
Registered: 2010-11-11
Posts: 3,937
Website

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

#38 2015-09-15 09:39:14

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

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'       => '&times;',
			'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)


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#39 2015-09-15 19:13:22

NicolasGraph
Plugin Author
From: France
Registered: 2008-07-24
Posts: 860
Website

Re: [plugin] [ORPHAN] peg_nested_comments

Previous post definitely updated… I hope!


Nicolas
Follow me on Twitter and GitHub!
Multiple edits are usually to correct my frenglish…

Offline

#40 2015-09-16 11:10:03

etc
Developer
Registered: 2010-11-11
Posts: 3,937
Website

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

Board footer

Powered by FluxBB