namespace BookStack\Http\Controllers;
-use BookStack\Entities\Book;
-use BookStack\Entities\Managers\BookContents;
+use BookStack\Actions\ActivityType;
+use BookStack\Entities\Models\Book;
use BookStack\Entities\Repos\BookRepo;
+use BookStack\Entities\Tools\BookContents;
use BookStack\Exceptions\SortOperationException;
use BookStack\Facades\Activity;
use Illuminate\Http\Request;
class BookSortController extends Controller
{
-
protected $bookRepo;
- /**
- * BookSortController constructor.
- * @param $bookRepo
- */
public function __construct(BookRepo $bookRepo)
{
$this->bookRepo = $bookRepo;
- parent::__construct();
}
/**
$bookChildren = (new BookContents($book))->getTree(false);
$this->setPageTitle(trans('entities.books_sort_named', ['bookName'=>$book->getShortName()]));
+
return view('books.sort', ['book' => $book, 'current' => $book, 'bookChildren' => $bookChildren]);
}
{
$book = $this->bookRepo->getBySlug($bookSlug);
$bookChildren = (new BookContents($book))->getTree();
- return view('books.sort-box', ['book' => $book, 'bookChildren' => $bookChildren]);
+
+ return view('books.parts.sort-box', ['book' => $book, 'bookChildren' => $bookChildren]);
}
/**
// Rebuild permissions and add activity for involved books.
$booksInvolved->each(function (Book $book) {
- Activity::add($book, 'book_sort', $book->id);
+ Activity::add(ActivityType::BOOK_SORT, $book);
});
return redirect($book->getUrl());