<?php namespace BookStack\Http\Controllers;
use Activity;
+use BookStack\Book;
use BookStack\Repos\EntityRepo;
use BookStack\Repos\UserRepo;
use BookStack\Services\ExportService;
*/
public function index()
{
- $books = $this->entityRepo->getAllPaginated('book', 10);
+ $books = $this->entityRepo->getAllPaginated('book', 16);
$recents = $this->signedIn ? $this->entityRepo->getRecentlyViewed('book', 4, 0) : false;
- $popular = $this->entityRepo->getPopular('book', 4, 0);
+ $popular = $this->entityRepo->getPopular('book', 3, 0);
+ $display = $this->currentUser->display;
$this->setPageTitle('Books');
- return view('books/index', ['books' => $books, 'recents' => $recents, 'popular' => $popular]);
+ return view('books/index', ['books' => $books, 'recents' => $recents, 'popular' => $popular, 'display' => $display]); //added displaly to access user display
}
/**
// Add activity for books
foreach ($sortedBooks as $bookId) {
+ /** @var Book $updatedBook */
$updatedBook = $this->entityRepo->getById('book', $bookId);
+ $this->entityRepo->buildJointPermissionsForBook($updatedBook);
Activity::add($updatedBook, 'book_sort', $updatedBook->id);
}
- // Update permissions on changed models
- if (count($updatedModels) === 0) $this->entityRepo->buildJointPermissions($updatedModels);
-
return redirect($book->getUrl());
}