1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Extracted some methods into a BookRepo

This commit is contained in:
Dan Brown
2019-09-15 23:28:23 +01:00
parent d28abf24d4
commit 60d0f96cd7
14 changed files with 233 additions and 173 deletions

View File

@ -43,7 +43,7 @@ class PageExportController extends Controller
*/
public function pdf(string $bookSlug, string $pageSlug)
{
$page = $this->pageRepo->getPageBySlug($pageSlug, $bookSlug);
$page = $this->pageRepo->getBySlug($pageSlug, $bookSlug);
$page->html = $this->pageRepo->renderPage($page);
$pdfContent = $this->exportService->pageToPdf($page);
return $this->downloadResponse($pdfContent, $pageSlug . '.pdf');
@ -59,7 +59,7 @@ class PageExportController extends Controller
*/
public function html(string $bookSlug, string $pageSlug)
{
$page = $this->pageRepo->getPageBySlug($pageSlug, $bookSlug);
$page = $this->pageRepo->getBySlug($pageSlug, $bookSlug);
$page->html = $this->pageRepo->renderPage($page);
$containedHtml = $this->exportService->pageToContainedHtml($page);
return $this->downloadResponse($containedHtml, $pageSlug . '.html');
@ -74,7 +74,7 @@ class PageExportController extends Controller
*/
public function plainText(string $bookSlug, string $pageSlug)
{
$page = $this->pageRepo->getPageBySlug($pageSlug, $bookSlug);
$page = $this->pageRepo->getBySlug($pageSlug, $bookSlug);
$pageText = $this->exportService->pageToPlainText($page);
return $this->downloadResponse($pageText, $pageSlug . '.txt');
}