diff --git a/ChangeLog b/ChangeLog index 984d1d2..aed467e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +Version 0.3.6 +Improvements: + +* fix missing changes for sub pages + +Bug fixes: + +* Fix https://github.com/funktechno/kanboard-plugin-wiki/issues/11 + Version 0.3.5 Improvements: diff --git a/Controller/WikiController.php b/Controller/WikiController.php index 5845c1c..8036cab 100755 --- a/Controller/WikiController.php +++ b/Controller/WikiController.php @@ -187,6 +187,20 @@ public function detail_readonly() { ), 'wiki:wiki/sidebar')); } + function getNestedChildren($parent_id, $items) { + $children = []; + + foreach ($items as $item) { + if ($item['parent_id'] === $parent_id) { + $item['children'] = $this->getNestedChildren($item['id'], $items); + array_push($children, $item); + } + } + + return $children; + } + + /** * details for single wiki page */ @@ -197,11 +211,17 @@ public function detail() $wiki_id = $this->request->getIntegerParam('wiki_id'); $wikipages = $this->wiki->getWikipages($project['id']); + $wikiPagesResult = array(); foreach ($wikipages as $page) { if (t($wiki_id) == t($page['id'])) { $wikipage = $page; - break; + } + if(!isset($page['parent_id'])){ + + $page['children'] = $this->getNestedChildren($page['id'], $wikipages); + + array_push($wikiPagesResult, $page); } } @@ -220,7 +240,7 @@ public function detail() 'images' => $this->wikiFile->getAllImages($wiki_id), // 'wikipage' => $this->wiki->getWikipage($wiki_id), 'wikipage' => $wikipage, - 'wikipages' => $wikipages, + 'wikipages' => $wikiPagesResult, ), 'wiki:wiki/sidebar')); // $wikipage= $wikipages->select(1)->eq('id', $wiki_id)->findOne(); diff --git a/Makefile b/Makefile index 123eb44..0d5c879 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ plugin=Wiki -version=0.3.5 +version=0.3.6 all: @ echo "Build archive for plugin ${plugin} version=${version}" @ git archive HEAD --prefix=${plugin}/ --format=zip -o ${plugin}-${version}.zip diff --git a/Plugin.php b/Plugin.php index 52636c2..0b40674 100755 --- a/Plugin.php +++ b/Plugin.php @@ -97,7 +97,7 @@ public function getPluginAuthor() public function getPluginVersion() { - return '0.3.5'; + return '0.3.6'; } public function getPluginHomepage()