1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-25 17:23:00 +00:00

Correct rendering of recent changes list. Fixes #106.

This commit is contained in:
Starbeamrainbowlabs 2016-09-11 18:57:33 +01:00
parent 5eb8b7f6b4
commit 7e1c343c7f
3 changed files with 15 additions and 7 deletions

View file

@ -1961,10 +1961,10 @@ function render_recent_changes($recent_changes)
for($i = 0; $i < $rchange_count; $i++) for($i = 0; $i < $rchange_count; $i++)
{ {
$rchange = $recent_changes[$i]; $rchange = $recent_changes[$i];
if($last_time !== date("dmY", $rchange->timestamp)) if($last_time !== date("dmY", $rchange->timestamp))
$content .= "<li class='header'><h2>" . date("jS F", $rchange->timestamp) . "</h2></li>\n"; $content .= "<li class='header'><h2>" . date("jS F", $rchange->timestamp) . "</h2></li>\n";
$rchange_results = []; $rchange_results = [];
for($s = $i; $s < $rchange_count; $s++) for($s = $i; $s < $rchange_count; $s++)
{ {
@ -1974,9 +1974,13 @@ function render_recent_changes($recent_changes)
$rchange_results[$s] = render_recent_change($recent_changes[$s]); $rchange_results[$s] = render_recent_change($recent_changes[$s]);
$i++; $i++;
} }
//$content .= render_recent_change($rchange); // Take one from i to account for when we tick over to the next
// iteration of the main loop
$i -= 1;
$next_entry = implode("\n", $rchange_results); $next_entry = implode("\n", $rchange_results);
// If the change count is greater than 1, then we should enclose it
// in a <details /> tag.
if(count($rchange_results) > 1) if(count($rchange_results) > 1)
{ {
reset($rchange_results); reset($rchange_results);
@ -1994,7 +1998,7 @@ function render_recent_changes($recent_changes)
} }
$userDisplayHtml = render_editor(implode(", ", $users)); $userDisplayHtml = render_editor(implode(", ", $users));
// TODO: COllect up and render a list of participating users // TODO: Collect up and render a list of participating users
$next_entry = "<li><details><summary>$pageDisplayHtml $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>"; $next_entry = "<li><details><summary>$pageDisplayHtml $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>";
$content .= "$next_entry\n"; $content .= "$next_entry\n";

View file

@ -50,7 +50,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds recent changes. Access through the 'recent-changes' action.", "description": "Adds recent changes. Access through the 'recent-changes' action.",
"id": "feature-recent-changes", "id": "feature-recent-changes",
"lastupdate": 1472387876, "lastupdate": 1473616598,
"optional": false "optional": false
}, },
{ {

View file

@ -136,10 +136,10 @@ function render_recent_changes($recent_changes)
for($i = 0; $i < $rchange_count; $i++) for($i = 0; $i < $rchange_count; $i++)
{ {
$rchange = $recent_changes[$i]; $rchange = $recent_changes[$i];
if($last_time !== date("dmY", $rchange->timestamp)) if($last_time !== date("dmY", $rchange->timestamp))
$content .= "<li class='header'><h2>" . date("jS F", $rchange->timestamp) . "</h2></li>\n"; $content .= "<li class='header'><h2>" . date("jS F", $rchange->timestamp) . "</h2></li>\n";
$rchange_results = []; $rchange_results = [];
for($s = $i; $s < $rchange_count; $s++) for($s = $i; $s < $rchange_count; $s++)
{ {
@ -149,9 +149,13 @@ function render_recent_changes($recent_changes)
$rchange_results[$s] = render_recent_change($recent_changes[$s]); $rchange_results[$s] = render_recent_change($recent_changes[$s]);
$i++; $i++;
} }
//$content .= render_recent_change($rchange); // Take one from i to account for when we tick over to the next
// iteration of the main loop
$i -= 1;
$next_entry = implode("\n", $rchange_results); $next_entry = implode("\n", $rchange_results);
// If the change count is greater than 1, then we should enclose it
// in a <details /> tag.
if(count($rchange_results) > 1) if(count($rchange_results) > 1)
{ {
reset($rchange_results); reset($rchange_results);
@ -169,7 +173,7 @@ function render_recent_changes($recent_changes)
} }
$userDisplayHtml = render_editor(implode(", ", $users)); $userDisplayHtml = render_editor(implode(", ", $users));
// TODO: COllect up and render a list of participating users // TODO: Collect up and render a list of participating users
$next_entry = "<li><details><summary>$pageDisplayHtml $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>"; $next_entry = "<li><details><summary>$pageDisplayHtml $userDisplayHtml $timeDisplayHtml</summary><ul class='page-list'>$next_entry</ul></details></li>";
$content .= "$next_entry\n"; $content .= "$next_entry\n";