- $this->setPageTitle(trans('entities.books_delete_named', ['bookName'=>$book->getShortName()]));
- return view('books.delete', ['book' => $book, 'current' => $book]);
- }
-
- /**
- * Shows the view which allows pages to be re-ordered and sorted.
- * @param string $bookSlug
- * @return \Illuminate\View\View
- * @throws \BookStack\Exceptions\NotFoundException
- */
- public function sort($bookSlug)
- {
- $book = $this->entityRepo->getBySlug('book', $bookSlug);
- $this->checkOwnablePermission('book-update', $book);
-
- $bookChildren = $this->entityRepo->getBookChildren($book, true);
-
- $this->setPageTitle(trans('entities.books_sort_named', ['bookName'=>$book->getShortName()]));
- return view('books.sort', ['book' => $book, 'current' => $book, 'bookChildren' => $bookChildren]);
- }
-
- /**
- * Shows the sort box for a single book.
- * Used via AJAX when loading in extra books to a sort.
- * @param $bookSlug
- * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
- */
- public function getSortItem($bookSlug)
- {
- $book = $this->entityRepo->getBySlug('book', $bookSlug);
- $bookChildren = $this->entityRepo->getBookChildren($book);
- return view('books.sort-box', ['book' => $book, 'bookChildren' => $bookChildren]);
- }
-
- /**
- * Saves an array of sort mapping to pages and chapters.
- * @param Request $request
- * @param string $bookSlug
- * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
- * @throws \BookStack\Exceptions\NotFoundException
- */
- public function saveSort(Request $request, string $bookSlug)
- {
- $book = $this->entityRepo->getBySlug('book', $bookSlug);
- $this->checkOwnablePermission('book-update', $book);
-
- // Return if no map sent
- if (!$request->filled('sort-tree')) {
- return redirect($book->getUrl());
- }