mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-10-01 01:36:00 -04:00
Added code in the settings to disable comments. Based on that hiding the comments section on the page display.
This commit is contained in:
parent
0b967d84ad
commit
6bb7b5465f
@ -161,13 +161,19 @@ class PageController extends Controller
|
|||||||
$page->html = $this->entityRepo->renderPage($page);
|
$page->html = $this->entityRepo->renderPage($page);
|
||||||
$sidebarTree = $this->entityRepo->getBookChildren($page->book);
|
$sidebarTree = $this->entityRepo->getBookChildren($page->book);
|
||||||
$pageNav = $this->entityRepo->getPageNav($page->html);
|
$pageNav = $this->entityRepo->getPageNav($page->html);
|
||||||
|
|
||||||
|
// check if the comment's are enabled
|
||||||
|
$areCommentsEnabled = !setting('app-disable-comments');
|
||||||
|
if ($areCommentsEnabled) {
|
||||||
$page->load(['comments.createdBy']);
|
$page->load(['comments.createdBy']);
|
||||||
|
}
|
||||||
|
|
||||||
Views::add($page);
|
Views::add($page);
|
||||||
$this->setPageTitle($page->getShortName());
|
$this->setPageTitle($page->getShortName());
|
||||||
return view('pages/show', [
|
return view('pages/show', [
|
||||||
'page' => $page,'book' => $page->book,
|
'page' => $page,'book' => $page->book,
|
||||||
'current' => $page, 'sidebarTree' => $sidebarTree,
|
'current' => $page, 'sidebarTree' => $sidebarTree,
|
||||||
|
'commentsEnabled' => $areCommentsEnabled,
|
||||||
'pageNav' => $pageNav]);
|
'pageNav' => $pageNav]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,10 +148,11 @@
|
|||||||
@include('pages/page-display')
|
@include('pages/page-display')
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@if ($commentsEnabled)
|
||||||
<div class="container small nopad">
|
<div class="container small nopad">
|
||||||
@include('comments/comments', ['page' => $page])
|
@include('comments/comments', ['page' => $page])
|
||||||
</div>
|
</div>
|
||||||
|
@endif
|
||||||
@stop
|
@stop
|
||||||
|
|
||||||
@section('scripts')
|
@section('scripts')
|
||||||
|
@ -38,6 +38,11 @@
|
|||||||
<p class="small">{{ trans('settings.app_secure_images_desc') }}</p>
|
<p class="small">{{ trans('settings.app_secure_images_desc') }}</p>
|
||||||
@include('components.toggle-switch', ['name' => 'setting-app-secure-images', 'value' => setting('app-secure-images')])
|
@include('components.toggle-switch', ['name' => 'setting-app-secure-images', 'value' => setting('app-secure-images')])
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label>{{ trans('settings.app_disable_comments') }}</label>
|
||||||
|
<p class="small">{{ trans('settings.app_disable_comments_desc') }}</p>
|
||||||
|
@include('components.toggle-switch', ['name' => 'setting-app-disable-comments', 'value' => setting('app-disable-comments')])
|
||||||
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="setting-app-editor">{{ trans('settings.app_editor') }}</label>
|
<label for="setting-app-editor">{{ trans('settings.app_editor') }}</label>
|
||||||
<p class="small">{{ trans('settings.app_editor_desc') }}</p>
|
<p class="small">{{ trans('settings.app_editor_desc') }}</p>
|
||||||
|
Loading…
Reference in New Issue
Block a user