1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Vastly improved design and cleaned text input

This commit is contained in:
Dan Brown
2015-07-23 21:55:46 +01:00
parent 2c95528de4
commit ef77c10a70
15 changed files with 206 additions and 140 deletions

View File

@ -53,10 +53,10 @@ class BookRepo
$book->delete();
}
public function getTree($book)
public function getTree($book, $currentPageId = false)
{
$tree = $book->toArray();
$tree['pages'] = $this->pageRepo->getTreeByBookId($book->id);
$tree['pages'] = $this->pageRepo->getTreeByBookId($book->id, $currentPageId);
$tree['hasChildren'] = count($tree['pages']) > 0;
return $tree;
}

View File

@ -102,7 +102,7 @@ class PageRepo
$cPage['current'] = ($currentPageId !== false && $cPage['id'] === $currentPageId);
$cPage['pages'] = [];
foreach($page->children as $key => $childPage) {
$cPage['pages'][$key] = $this->toArrayTree($childPage);
$cPage['pages'][$key] = $this->toArrayTree($childPage, $currentPageId);
}
$cPage['hasChildren'] = count($cPage['pages']) > 0;
return $cPage;