]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/BookController.php
Spanish translation
[bookstack] / app / Http / Controllers / BookController.php
index 7a98bd49ec1b67119c7aa151c0cb874964505a94..ea39a771ec048529bab8995f2967306613132108 100644 (file)
@@ -36,11 +36,11 @@ class BookController extends Controller
      */
     public function index()
     {
-        $books = $this->entityRepo->getAllPaginated('book', 20);
+        $books = $this->entityRepo->getAllPaginated('book', 18);
         $recents = $this->signedIn ? $this->entityRepo->getRecentlyViewed('book', 4, 0) : false;
         $popular = $this->entityRepo->getPopular('book', 4, 0);
         $new = $this->entityRepo->getRecentlyCreated('book', 4, 0);
-        $booksViewType = setting()->getUser($this->currentUser, 'books_view_type', 'list');
+        $booksViewType = setting()->getUser($this->currentUser, 'books_view_type', config('app.views.books', 'list'));
         $this->setPageTitle(trans('entities.books'));
         return view('books/index', [
             'books' => $books,
@@ -299,10 +299,7 @@ class BookController extends Controller
     {
         $book = $this->entityRepo->getBySlug('book', $bookSlug);
         $pdfContent = $this->exportService->bookToPdf($book);
-        return response()->make($pdfContent, 200, [
-            'Content-Type'        => 'application/octet-stream',
-            'Content-Disposition' => 'attachment; filename="' . $bookSlug . '.pdf'
-        ]);
+        return $this->downloadResponse($pdfContent, $bookSlug . '.pdf');
     }
 
     /**
@@ -314,10 +311,7 @@ class BookController extends Controller
     {
         $book = $this->entityRepo->getBySlug('book', $bookSlug);
         $htmlContent = $this->exportService->bookToContainedHtml($book);
-        return response()->make($htmlContent, 200, [
-            'Content-Type'        => 'application/octet-stream',
-            'Content-Disposition' => 'attachment; filename="' . $bookSlug . '.html'
-        ]);
+        return $this->downloadResponse($htmlContent, $bookSlug . '.html');
     }
 
     /**
@@ -328,10 +322,7 @@ class BookController extends Controller
     public function exportPlainText($bookSlug)
     {
         $book = $this->entityRepo->getBySlug('book', $bookSlug);
-        $htmlContent = $this->exportService->bookToPlainText($book);
-        return response()->make($htmlContent, 200, [
-            'Content-Type'        => 'application/octet-stream',
-            'Content-Disposition' => 'attachment; filename="' . $bookSlug . '.txt'
-        ]);
+        $textContent = $this->exportService->bookToPlainText($book);
+        return $this->downloadResponse($textContent, $bookSlug . '.txt');
     }
 }