mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-25 17:23:00 +00:00
Fix comment replies on the server-side
This commit is contained in:
parent
1b22deea54
commit
d3d56bdaa7
3 changed files with 9 additions and 9 deletions
|
@ -2189,7 +2189,7 @@ register_module([
|
||||||
$comments_html .= "<form class='comment-reply-form' method='post' action='?action=comment&page=" . rawurlencode($env->page) . "'>\n" .
|
$comments_html .= "<form class='comment-reply-form' method='post' action='?action=comment&page=" . rawurlencode($env->page) . "'>\n" .
|
||||||
"<h3>Post a Comment</h3>\n" .
|
"<h3>Post a Comment</h3>\n" .
|
||||||
"\t<textarea name='message' placeholder='Type your comment here. You can use the same syntax you use when writing pages.'></textarea>\n" .
|
"\t<textarea name='message' placeholder='Type your comment here. You can use the same syntax you use when writing pages.'></textarea>\n" .
|
||||||
"\t<input type='hidden' name='reply-to' />\n" .
|
"\t<input type='hidden' name='replyto' />\n" .
|
||||||
"\t<input type='submit' value='Post Comment' />\n" .
|
"\t<input type='submit' value='Post Comment' />\n" .
|
||||||
"</form>\n";
|
"</form>\n";
|
||||||
}
|
}
|
||||||
|
@ -2197,7 +2197,7 @@ register_module([
|
||||||
$comments_html .= "<form class='comment-reply-form disabled no-login'>\n" .
|
$comments_html .= "<form class='comment-reply-form disabled no-login'>\n" .
|
||||||
"\t<textarea disabled name='message' placeholder='Type your comment here. You can use the same syntax you use when writing pages.'></textarea>\n" .
|
"\t<textarea disabled name='message' placeholder='Type your comment here. You can use the same syntax you use when writing pages.'></textarea>\n" .
|
||||||
"\t<p><a href='?action=login&returnto=" . rawurlencode("?action=view&page=" . rawurlencode($env->page)) . "'>Login</a> to post a comment.</p>\n" .
|
"\t<p><a href='?action=login&returnto=" . rawurlencode("?action=view&page=" . rawurlencode($env->page)) . "'>Login</a> to post a comment.</p>\n" .
|
||||||
"\t<input type='hidden' name='reply-to' />\n" .
|
"\t<input type='hidden' name='replyto' />\n" .
|
||||||
"\t<input disabled type='submit' value='Post Comment' />\n" .
|
"\t<input disabled type='submit' value='Post Comment' />\n" .
|
||||||
"</form>\n";
|
"</form>\n";
|
||||||
}
|
}
|
||||||
|
@ -2227,7 +2227,7 @@ function display_reply_form(event)
|
||||||
var replyForm = document.querySelector(".comment-reply-form").cloneNode(true);
|
var replyForm = document.querySelector(".comment-reply-form").cloneNode(true);
|
||||||
replyForm.classList.add("nested");
|
replyForm.classList.add("nested");
|
||||||
// Set the comment we're replying to
|
// Set the comment we're replying to
|
||||||
replyForm.querySelector("[name=reply-to]").value = event.target.parentElement.parentElement.dataset.commentId;
|
replyForm.querySelector("[name=replyto]").value = event.target.parentElement.parentElement.dataset.commentId;
|
||||||
// Display the newly-cloned commenting form
|
// Display the newly-cloned commenting form
|
||||||
event.target.parentElement.parentElement.querySelector(".reply-box-container").appendChild(replyForm);
|
event.target.parentElement.parentElement.querySelector(".reply-box-container").appendChild(replyForm);
|
||||||
}
|
}
|
||||||
|
@ -2354,7 +2354,7 @@ function render_comments($comments_data, $depth = 0)
|
||||||
$result .= "\t\t<a class='permalink-button' href='#comment-$comment->id' title='Permalink to this comment'>🔗</a>\n";
|
$result .= "\t\t<a class='permalink-button' href='#comment-$comment->id' title='Permalink to this comment'>🔗</a>\n";
|
||||||
$result .= "\t\t<time datetime='" . date("c", strtotime($comment->timestamp)) . "' title='The time this comment was posted'>🕗 " . date("l jS \of F Y \a\\t h:ia T", strtotime($comment->timestamp)) . "</time>\n";
|
$result .= "\t\t<time datetime='" . date("c", strtotime($comment->timestamp)) . "' title='The time this comment was posted'>🕗 " . date("l jS \of F Y \a\\t h:ia T", strtotime($comment->timestamp)) . "</time>\n";
|
||||||
$result .= "\t</p>\n";
|
$result .= "\t</p>\n";
|
||||||
$result .= "\t" . render_comments($comment->replies) . "\n";
|
$result .= "\t" . render_comments($comment->replies, $depth + 1) . "\n";
|
||||||
$result .= "\t</div>";
|
$result .= "\t</div>";
|
||||||
}
|
}
|
||||||
$result .= "</div>";
|
$result .= "</div>";
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
"author": "Starbeamrainbowlabs",
|
"author": "Starbeamrainbowlabs",
|
||||||
"description": "Adds threaded comments to the bottom of every page.",
|
"description": "Adds threaded comments to the bottom of every page.",
|
||||||
"id": "feature-comments",
|
"id": "feature-comments",
|
||||||
"lastupdate": 1494689720,
|
"lastupdate": 1494689964,
|
||||||
"optional": false
|
"optional": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -134,7 +134,7 @@ register_module([
|
||||||
$comments_html .= "<form class='comment-reply-form' method='post' action='?action=comment&page=" . rawurlencode($env->page) . "'>\n" .
|
$comments_html .= "<form class='comment-reply-form' method='post' action='?action=comment&page=" . rawurlencode($env->page) . "'>\n" .
|
||||||
"<h3>Post a Comment</h3>\n" .
|
"<h3>Post a Comment</h3>\n" .
|
||||||
"\t<textarea name='message' placeholder='Type your comment here. You can use the same syntax you use when writing pages.'></textarea>\n" .
|
"\t<textarea name='message' placeholder='Type your comment here. You can use the same syntax you use when writing pages.'></textarea>\n" .
|
||||||
"\t<input type='hidden' name='reply-to' />\n" .
|
"\t<input type='hidden' name='replyto' />\n" .
|
||||||
"\t<input type='submit' value='Post Comment' />\n" .
|
"\t<input type='submit' value='Post Comment' />\n" .
|
||||||
"</form>\n";
|
"</form>\n";
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ register_module([
|
||||||
$comments_html .= "<form class='comment-reply-form disabled no-login'>\n" .
|
$comments_html .= "<form class='comment-reply-form disabled no-login'>\n" .
|
||||||
"\t<textarea disabled name='message' placeholder='Type your comment here. You can use the same syntax you use when writing pages.'></textarea>\n" .
|
"\t<textarea disabled name='message' placeholder='Type your comment here. You can use the same syntax you use when writing pages.'></textarea>\n" .
|
||||||
"\t<p><a href='?action=login&returnto=" . rawurlencode("?action=view&page=" . rawurlencode($env->page)) . "'>Login</a> to post a comment.</p>\n" .
|
"\t<p><a href='?action=login&returnto=" . rawurlencode("?action=view&page=" . rawurlencode($env->page)) . "'>Login</a> to post a comment.</p>\n" .
|
||||||
"\t<input type='hidden' name='reply-to' />\n" .
|
"\t<input type='hidden' name='replyto' />\n" .
|
||||||
"\t<input disabled type='submit' value='Post Comment' />\n" .
|
"\t<input disabled type='submit' value='Post Comment' />\n" .
|
||||||
"</form>\n";
|
"</form>\n";
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ function display_reply_form(event)
|
||||||
var replyForm = document.querySelector(".comment-reply-form").cloneNode(true);
|
var replyForm = document.querySelector(".comment-reply-form").cloneNode(true);
|
||||||
replyForm.classList.add("nested");
|
replyForm.classList.add("nested");
|
||||||
// Set the comment we're replying to
|
// Set the comment we're replying to
|
||||||
replyForm.querySelector("[name=reply-to]").value = event.target.parentElement.parentElement.dataset.commentId;
|
replyForm.querySelector("[name=replyto]").value = event.target.parentElement.parentElement.dataset.commentId;
|
||||||
// Display the newly-cloned commenting form
|
// Display the newly-cloned commenting form
|
||||||
event.target.parentElement.parentElement.querySelector(".reply-box-container").appendChild(replyForm);
|
event.target.parentElement.parentElement.querySelector(".reply-box-container").appendChild(replyForm);
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ function render_comments($comments_data, $depth = 0)
|
||||||
$result .= "\t\t<a class='permalink-button' href='#comment-$comment->id' title='Permalink to this comment'>🔗</a>\n";
|
$result .= "\t\t<a class='permalink-button' href='#comment-$comment->id' title='Permalink to this comment'>🔗</a>\n";
|
||||||
$result .= "\t\t<time datetime='" . date("c", strtotime($comment->timestamp)) . "' title='The time this comment was posted'>🕗 " . date("l jS \of F Y \a\\t h:ia T", strtotime($comment->timestamp)) . "</time>\n";
|
$result .= "\t\t<time datetime='" . date("c", strtotime($comment->timestamp)) . "' title='The time this comment was posted'>🕗 " . date("l jS \of F Y \a\\t h:ia T", strtotime($comment->timestamp)) . "</time>\n";
|
||||||
$result .= "\t</p>\n";
|
$result .= "\t</p>\n";
|
||||||
$result .= "\t" . render_comments($comment->replies) . "\n";
|
$result .= "\t" . render_comments($comment->replies, $depth + 1) . "\n";
|
||||||
$result .= "\t</div>";
|
$result .= "\t</div>";
|
||||||
}
|
}
|
||||||
$result .= "</div>";
|
$result .= "</div>";
|
||||||
|
|
Loading…
Reference in a new issue