]> BookStack Code Mirror - bookstack/blobdiff - resources/views/comments/comments.blade.php
ZIP Imports: Added API examples, finished testing
[bookstack] / resources / views / comments / comments.blade.php
index ffa75cfed227638fc72e1615c32803134994045e..a5f0168a5c8a95a5f4db3b695992703712928e91 100644 (file)
@@ -1,18 +1,80 @@
-<script type="text/ng-template" id="comment-list-item.html">
-    @include('comments/list-item')
-</script>
-<script type="text/ng-template" id="comment-reply.html">
-    @include('comments/comment-reply', ['pageId' => $pageId])
-</script>
-<div ng-controller="CommentListController as vm" ng-init="pageId = <?= $page->id ?>" class="comments-list" ng-cloak>
-<h3>@{{vm.totalCommentsStr}}</h3>
-<hr>
-    <div class="comment-box" ng-repeat="comment in vm.comments track by comment.id">
-        <div ng-include src="'comment-list-item.html'">
+<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_thread_count') }}"
+         option:page-comments:archived-count-text="{{ trans('entities.comment_archived_count') }}"
+         option:page-comments:wysiwyg-text-direction="{{ $locale->htmlDirection() }}"
+         class="comments-list tab-container"
+         aria-label="{{ trans('entities.comments') }}">
 
+    <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 refs="page-comments@add-button-container" class="ml-m flex-container-row" >
+                <button type="button"
+                        refs="page-comments@add-comment-button"
+                        class="button outline mb-m ml-auto">{{ trans('entities.comment_add') }}</button>
+            </div>
+        @endif
     </div>
-    <div ng-if="::vm.canComment()">
-        @include('comments/comment-reply', ['pageId' => $pageId])
+
+    <div id="comment-tab-panel-active"
+         refs="page-comments@active-container"
+         tabindex="0"
+         role="tabpanel"
+         aria-labelledby="comment-tab-active"
+         class="comment-container no-outline">
+        <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="ml-m flex-container-row">
+                    <button type="button"
+                            refs="page-comments@add-comment-button"
+                            class="button outline mb-m ml-auto">{{ trans('entities.comment_add') }}</button>
+                </div>
+            @endif
+        @endif
     </div>
-</div>
\ No newline at end of file
+
+    <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 no-outline">
+        @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())
+        @push('body-end')
+            @include('form.editor-translations')
+            @include('entities.selector-popup')
+        @endpush
+    @endif
+
+</section>
\ No newline at end of file