1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-09 10:22:51 +03:00

Comments: Moved to tab UI, Converted tabs component to ts

This commit is contained in:
Dan Brown
2025-04-30 17:42:09 +01:00
parent 099f6104d0
commit e7dcc2dcdf
8 changed files with 117 additions and 55 deletions

View File

@@ -1,49 +1,73 @@
<section component="page-comments"
<section components="page-comments tabs"
option:page-comments:page-id="{{ $page->id }}"
option:page-comments:created-text="{{ trans('entities.comment_created_success') }}"
option:page-comments:count-text="{{ trans('entities.comment_count') }}"
option:page-comments:count-text="{{ trans('entities.comment_thread_count') }}"
option:page-comments:archived-count-text="{{ trans('entities.comment_archived_count') }}"
option:page-comments:wysiwyg-language="{{ $locale->htmlLang() }}"
option:page-comments:wysiwyg-text-direction="{{ $locale->htmlDirection() }}"
class="comments-list"
class="comments-list tab-container"
aria-label="{{ trans('entities.comments') }}">
<div refs="page-comments@comment-count-bar" class="grid half left-focus v-center no-row-gap">
<h5 refs="page-comments@comments-title">{{ trans_choice('entities.comment_count', $commentTree->count(), ['count' => $commentTree->count()]) }}</h5>
<div refs="page-comments@comment-count-bar" class="flex-container-row items-center">
<div role="tablist" class="flex">
<button type="button"
role="tab"
id="comment-tab-active"
aria-controls="comment-tab-panel-active"
refs="page-comments@active-tab"
aria-selected="true">{{ trans_choice('entities.comment_thread_count', $commentTree->activeThreadCount()) }}</button>
<button type="button"
role="tab"
id="comment-tab-archived"
aria-controls="comment-tab-panel-archived"
refs="page-comments@archived-tab"
aria-selected="false">{{ trans_choice('entities.comment_archived_count', count($commentTree->getArchived())) }}</button>
</div>
@if ($commentTree->empty() && userCan('comment-create-all'))
<div class="text-m-right" refs="page-comments@add-button-container">
<div class="ml-m" refs="page-comments@add-button-container">
<button type="button"
refs="page-comments@add-comment-button"
class="button outline">{{ trans('entities.comment_add') }}</button>
class="button outline mb-m">{{ trans('entities.comment_add') }}</button>
</div>
@endif
</div>
<div refs="page-comments@comment-container" class="comment-container">
@foreach($commentTree->getActive() as $branch)
@include('comments.comment-branch', ['branch' => $branch, 'readOnly' => false])
@endforeach
<div id="comment-tab-panel-active"
tabindex="0"
role="tabpanel"
aria-labelledby="comment-tab-active"
class="comment-container">
<div refs="page-comments@comment-container">
@foreach($commentTree->getActive() as $branch)
@include('comments.comment-branch', ['branch' => $branch, 'readOnly' => false])
@endforeach
</div>
<p class="text-center text-muted italic empty-state">{{ trans('entities.comment_none') }}</p>
@if(userCan('comment-create-all'))
@include('comments.create')
@if (!$commentTree->empty())
<div refs="page-comments@addButtonContainer" class="flex-container-row">
<button type="button"
refs="page-comments@add-comment-button"
class="button outline ml-auto">{{ trans('entities.comment_add') }}</button>
</div>
@endif
@endif
</div>
@if(userCan('comment-create-all'))
@include('comments.create')
@if (!$commentTree->empty())
<div refs="page-comments@addButtonContainer" class="flex-container-row">
<button type="button"
refs="page-comments@show-archived-button"
class="text-button hover-underline">{{ trans_choice('entities.comment_archived', count($commentTree->getArchived())) }}</button>
<button type="button"
refs="page-comments@add-comment-button"
class="button outline ml-auto">{{ trans('entities.comment_add') }}</button>
</div>
@endif
@endif
<div refs="page-comments@archive-container" class="comment-container">
<div refs="page-comments@archive-container"
id="comment-tab-panel-archived"
tabindex="0"
role="tabpanel"
aria-labelledby="comment-tab-archived"
hidden="hidden"
class="comment-container">
@foreach($commentTree->getArchived() as $branch)
@include('comments.comment-branch', ['branch' => $branch, 'readOnly' => false])
@endforeach
<p class="text-center text-muted italic empty-state">{{ trans('entities.comment_none') }}</p>
</div>
@if(userCan('comment-create-all') || $commentTree->canUpdateAny())

View File

@@ -28,12 +28,6 @@
@include('entities.sibling-navigation', ['next' => $next, 'previous' => $previous])
@if ($commentTree->enabled())
@if(($previous || $next))
<div class="px-xl print-hidden">
<hr class="darker">
</div>
@endif
<div class="comments-container mb-l print-hidden">
@include('comments.comments', ['commentTree' => $commentTree, 'page' => $page])
<div class="clearfix"></div>