1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-10-31 21:33:00 +00:00

sort the sidebar alphabetically. Fixes #17.

This commit is contained in:
Starbeamrainbowlabs 2015-08-05 13:12:25 +01:00
parent 7b26a06d52
commit 87b3bd7d81
3 changed files with 15 additions and 7 deletions

View file

@ -875,8 +875,12 @@ register_module([
// Show the sidebar // Show the sidebar
$exec_start = microtime(true); $exec_start = microtime(true);
// Sort the pageindex
$sorted_pageindex = get_object_vars($pageindex);
ksort($sorted_pageindex, SORT_NATURAL);
$sidebar_contents = ""; $sidebar_contents = "";
$sidebar_contents .= render_sidebar($pageindex); $sidebar_contents .= render_sidebar($sorted_pageindex);
$parts["{body}"] = "<aside class='sidebar'> $parts["{body}"] = "<aside class='sidebar'>
$sidebar_contents $sidebar_contents
@ -894,9 +898,9 @@ register_module([
]); ]);
/* /*
* @summary Renders the sidebar for the given pageindex. * @summary Renders the sidebar for a given pageindex.
* *
* @param $pageindex {array} - The pageindex to renderthe sidebar for * @param $pageindex {array} - The pageindex to render the sidebar for
* @param $root_pagename {string} - The pagename that should be considered the root of the rendering. You don't usually need to use this, it is used by the algorithm itself since it is recursive. * @param $root_pagename {string} - The pagename that should be considered the root of the rendering. You don't usually need to use this, it is used by the algorithm itself since it is recursive.
* *
* @returns {string} A HTML rendering of the sidebar for the given pageindex * @returns {string} A HTML rendering of the sidebar for the given pageindex

View file

@ -13,7 +13,7 @@
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Adds a sidebar to the left hand side of every page. Add '$settings->sidebar_show = true;' to your configuration, or append '&sidebar=yes' to the url to enable. Adding to the url sets a cookie to remember your setting.", "description": "Adds a sidebar to the left hand side of every page. Add '$settings->sidebar_show = true;' to your configuration, or append '&sidebar=yes' to the url to enable. Adding to the url sets a cookie to remember your setting.",
"id": "extra-sidebar", "id": "extra-sidebar",
"lastupdate": 1438775454 "lastupdate": 1438776654
}, },
{ {
"name": "Credits", "name": "Credits",

View file

@ -42,8 +42,12 @@ register_module([
// Show the sidebar // Show the sidebar
$exec_start = microtime(true); $exec_start = microtime(true);
// Sort the pageindex
$sorted_pageindex = get_object_vars($pageindex);
ksort($sorted_pageindex, SORT_NATURAL);
$sidebar_contents = ""; $sidebar_contents = "";
$sidebar_contents .= render_sidebar($pageindex); $sidebar_contents .= render_sidebar($sorted_pageindex);
$parts["{body}"] = "<aside class='sidebar'> $parts["{body}"] = "<aside class='sidebar'>
$sidebar_contents $sidebar_contents
@ -61,9 +65,9 @@ register_module([
]); ]);
/* /*
* @summary Renders the sidebar for the given pageindex. * @summary Renders the sidebar for a given pageindex.
* *
* @param $pageindex {array} - The pageindex to renderthe sidebar for * @param $pageindex {array} - The pageindex to render the sidebar for
* @param $root_pagename {string} - The pagename that should be considered the root of the rendering. You don't usually need to use this, it is used by the algorithm itself since it is recursive. * @param $root_pagename {string} - The pagename that should be considered the root of the rendering. You don't usually need to use this, it is used by the algorithm itself since it is recursive.
* *
* @returns {string} A HTML rendering of the sidebar for the given pageindex * @returns {string} A HTML rendering of the sidebar for the given pageindex