Skip to content

Commit

Permalink
Correct rendering of recent changes list. Fixes #106.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrl committed Sep 11, 2016
1 parent 5eb8b7f commit 7e1c343
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 7 additions & 3 deletions build/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -1961,10 +1961,10 @@ function render_recent_changes($recent_changes)
for($i = 0; $i < $rchange_count; $i++)
{
$rchange = $recent_changes[$i];

if($last_time !== date("dmY", $rchange->timestamp))
$content .= "<li class='header'><h2>" . date("jS F", $rchange->timestamp) . "</h2></li>\n";


$rchange_results = [];
for($s = $i; $s < $rchange_count; $s++)
{
Expand All @@ -1974,9 +1974,13 @@ function render_recent_changes($recent_changes)
$rchange_results[$s] = render_recent_change($recent_changes[$s]);
$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);
// If the change count is greater than 1, then we should enclose it
// in a <details /> tag.
if(count($rchange_results) > 1)
{
reset($rchange_results);
Expand All @@ -1994,7 +1998,7 @@ function render_recent_changes($recent_changes)
}
$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>";

$content .= "$next_entry\n";
Expand Down
2 changes: 1 addition & 1 deletion module_index.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"author": "Starbeamrainbowlabs",
"description": "Adds recent changes. Access through the 'recent-changes' action.",
"id": "feature-recent-changes",
"lastupdate": 1472387876,
"lastupdate": 1473616598,
"optional": false
},
{
Expand Down
10 changes: 7 additions & 3 deletions modules/feature-recent-changes.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,10 @@ function render_recent_changes($recent_changes)
for($i = 0; $i < $rchange_count; $i++)
{
$rchange = $recent_changes[$i];

if($last_time !== date("dmY", $rchange->timestamp))
$content .= "<li class='header'><h2>" . date("jS F", $rchange->timestamp) . "</h2></li>\n";


$rchange_results = [];
for($s = $i; $s < $rchange_count; $s++)
{
Expand All @@ -149,9 +149,13 @@ function render_recent_changes($recent_changes)
$rchange_results[$s] = render_recent_change($recent_changes[$s]);
$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);
// If the change count is greater than 1, then we should enclose it
// in a <details /> tag.
if(count($rchange_results) > 1)
{
reset($rchange_results);
Expand All @@ -169,7 +173,7 @@ function render_recent_changes($recent_changes)
}
$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>";

$content .= "$next_entry\n";
Expand Down

0 comments on commit 7e1c343

Please sign in to comment.