use BookStack\Repos\PageRepo;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Views;
+use GatherContent\Htmldiff\Htmldiff;
class PageController extends Controller
{
$book = $this->bookRepo->getBySlug($bookSlug);
$page = $this->pageRepo->getBySlug($pageSlug, $book->id);
$revision = $this->pageRepo->getRevisionById($revisionId);
+
+ $next = $revision->getNext() ?: $page;
+ $diff = (new Htmldiff)->diff($revision->html, $next->html);
+
$page->fill($revision->toArray());
$this->setPageTitle('Page Revision For ' . $page->getShortName());
- return view('pages/revision', ['page' => $page, 'book' => $book]);
+
+ return view('pages/revision', [
+ 'page' => $page,
+ 'book' => $book,
+ 'diff' => $diff,
+ ]);
}
/**
]);
}
+ /**
+ * Does the action of moving the location of a page
+ * @param $bookSlug
+ * @param $pageSlug
+ * @param Request $request
+ * @return mixed
+ * @throws NotFoundException
+ */
public function move($bookSlug, $pageSlug, Request $request)
{
$book = $this->bookRepo->getBySlug($bookSlug);