]> 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 1e5a4231cb98b83fa34accbc5af5eb65d59b2eed..a5f0168a5c8a95a5f4db3b695992703712928e91 100644 (file)
@@ -1,40 +1,80 @@
-{{--TODO--}}
-<div page-comments page-id="{{ $page->id }}" class="comments-list">
-  <h5 comments-title class="float left">{{ trans_choice('entities.comment_count', count($page->comments), ['count' => count($page->comments)]) }}</h5>
+<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 class="comment-container" comment-container>
-        @foreach($page->comments as $comment)
-            @include('comments.comment', ['comment' => $comment])
-        @endforeach
+    <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>
 
-    @if(userCan('comment-create-all'))
-
-        <div class="comment-box" comment-box style="display:none;">
-            <div class="header">@icon('comment') {{ trans('entities.comment_new') }}</div>
-            <div comment-form-reply-to class="reply-row primary-background-light text-muted" style="display: none;">
-                <button class="text-button float right" action="remove-reply-to">{{ trans('common.remove') }}</button>
-                {!! trans('entities.comment_in_reply_to', ['commentId' => '<a href=""></a>']) !!}
-            </div>
-            <div class="content" comment-form-container>
-                <form novalidate>
-                    <div class="form-group">
-                        <textarea name="markdown" rows="3" v-model="comment.text" placeholder="{{ trans('entities.comment_placeholder') }}"></textarea>
-                    </div>
-                    <div class="form-group text-right">
-                        <button type="button" class="button outline" action="hideForm">{{ trans('common.cancel') }}</button>
-                        <button type="submit" class="button pos">{{ trans('entities.comment_save') }}</button>
-                    </div>
-                    <div class="form-group loading" style="display: none;">
-                        @include('partials.loading-icon', ['text' => trans('entities.comment_saving')])
-                    </div>
-                </form>
-            </div>
+    <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>
 
-        <div class="form-group" comment-add-button>
-            <button type="button" action="addComment" class="button outline float right">{{ trans('entities.comment_add') }}</button>
-        </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 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
 
-</div>
\ No newline at end of file
+</section>
\ No newline at end of file