$this->checkOwnablePermission('page-view', $page);
- $pageContent = $this->entityRepo->renderPage($page);
+ $page->html = $this->entityRepo->renderPage($page);
$sidebarTree = $this->entityRepo->getBookChildren($page->book);
- $pageNav = $this->entityRepo->getPageNav($pageContent);
+ $pageNav = $this->entityRepo->getPageNav($page->html);
$page->load(['comments.createdBy']);
Views::add($page);
public function exportPdf($bookSlug, $pageSlug)
{
$page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
+ $page->html = $this->entityRepo->renderPage($page);
$pdfContent = $this->exportService->pageToPdf($page);
return response()->make($pdfContent, 200, [
'Content-Type' => 'application/octet-stream',
public function exportHtml($bookSlug, $pageSlug)
{
$page = $this->entityRepo->getBySlug('page', $pageSlug, $bookSlug);
+ $page->html = $this->entityRepo->renderPage($page);
$containedHtml = $this->exportService->pageToContainedHtml($page);
return response()->make($containedHtml, 200, [
'Content-Type' => 'application/octet-stream',
$pageContent->assertSee('Well This is a second block of content');
}
+ public function test_saving_page_with_includes()
+ {
+ $page = Page::first();
+ $secondPage = Page::all()->get(2);
+ $this->asEditor();
+ $page->html = "<p>{{@$secondPage->id}}</p>";
+
+ $resp = $this->put($page->getUrl(), ['name' => $page->name, 'html' => $page->html, 'summary' => '']);
+
+ $resp->assertStatus(302);
+
+ $page = Page::find($page->id);
+ $this->assertContains("{{@$secondPage->id}}", $page->html);
+ }
+
public function test_page_revision_views_viewable()
{
$this->asEditor();