<?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', 20);
$recents = $this->signedIn ? $this->entityRepo->getRecentlyViewed('book', 4, 0) : false;
$popular = $this->entityRepo->getPopular('book', 4, 0);
+ $new = $this->entityRepo->getRecentlyCreated('book', 4, 0);
$this->setPageTitle('Books');
- return view('books/index', ['books' => $books, 'recents' => $recents, 'popular' => $popular]);
+ return view('books/index', [
+ 'books' => $books,
+ 'recents' => $recents,
+ 'popular' => $popular,
+ 'new' => $new
+ ]);
}
/**
$bookChildren = $this->entityRepo->getBookChildren($book);
Views::add($book);
$this->setPageTitle($book->getShortName());
- return view('books/show', ['book' => $book, 'current' => $book, 'bookChildren' => $bookChildren]);
+ return view('books/show', [
+ 'book' => $book,
+ 'current' => $book,
+ 'bookChildren' => $bookChildren,
+ 'activity' => Activity::entityActivity($book, 20, 0)
+ ]);
}
/**
// 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());
}