]> BookStack Code Mirror - bookstack/blob - resources/views/comments/comment.blade.php
Comments: Added reference marker to comments
[bookstack] / resources / views / comments / comment.blade.php
1 @php
2     $commentHtml = $comment->safeHtml();
3 @endphp
4 <div component="{{ $readOnly ? '' : 'page-comment' }}"
5      option:page-comment:comment-id="{{ $comment->id }}"
6      option:page-comment:comment-local-id="{{ $comment->local_id }}"
7      option:page-comment:comment-content-ref="{{ $comment->content_ref }}"
8      option:page-comment:updated-text="{{ trans('entities.comment_updated_success') }}"
9      option:page-comment:deleted-text="{{ trans('entities.comment_deleted_success') }}"
10      option:page-comment:view-comment-text="{{ trans('entities.comment_view') }}"
11      option:page-comment:jump-to-thread-text="{{ trans('entities.comment_jump_to_thread') }}"
12      option:page-comment:close-text="{{ trans('common.close') }}"
13      option:page-comment:wysiwyg-language="{{ $locale->htmlLang() }}"
14      option:page-comment:wysiwyg-text-direction="{{ $locale->htmlDirection() }}"
15      id="comment{{$comment->local_id}}"
16      class="comment-box">
17     <div class="header">
18         <div class="flex-container-row wrap items-center gap-x-xs">
19             @if ($comment->createdBy)
20                 <div>
21                     <img width="50" src="{{ $comment->createdBy->getAvatar(50) }}" class="avatar block mr-xs" alt="{{ $comment->createdBy->name }}">
22                 </div>
23             @endif
24             <div class="meta text-muted flex-container-row wrap items-center flex text-small">
25                 @if ($comment->createdBy)
26                     <a href="{{ $comment->createdBy->getProfileUrl() }}">{{ $comment->createdBy->getShortName(16) }}</a>
27                 @else
28                     {{ trans('common.deleted_user') }}
29                 @endif
30                 <span title="{{ $comment->created_at }}">&nbsp;{{ trans('entities.comment_created', ['createDiff' => $comment->created_at->diffForHumans() ]) }}</span>
31                 @if($comment->isUpdated())
32                     <span class="mx-xs">&bull;</span>
33                     <span title="{{ trans('entities.comment_updated', ['updateDiff' => $comment->updated_at, 'username' => $comment->updatedBy->name ?? trans('common.deleted_user')]) }}">
34                  {{ trans('entities.comment_updated_indicator') }}
35                     </span>
36                 @endif
37             </div>
38             <div class="right-meta flex-container-row justify-flex-end items-center px-s">
39                 @if(!$readOnly && (userCan('comment-create-all') || userCan('comment-update', $comment) || userCan('comment-delete', $comment)))
40                 <div class="actions mr-s">
41                     @if(userCan('comment-create-all'))
42                         <button refs="page-comment@reply-button" type="button" class="text-button text-muted hover-underline text-small p-xs">@icon('reply') {{ trans('common.reply') }}</button>
43                     @endif
44                     @if(userCan('comment-update', $comment))
45                         <button refs="page-comment@edit-button" type="button" class="text-button text-muted hover-underline text-small p-xs">@icon('edit') {{ trans('common.edit') }}</button>
46                     @endif
47                     @if(userCan('comment-delete', $comment))
48                         <div component="dropdown" class="dropdown-container">
49                             <button type="button" refs="dropdown@toggle" aria-haspopup="true" aria-expanded="false" class="text-button text-muted hover-underline text-small p-xs">@icon('delete') {{ trans('common.delete') }}</button>
50                             <ul refs="dropdown@menu" class="dropdown-menu" role="menu">
51                                 <li class="px-m text-small text-muted pb-s">{{trans('entities.comment_delete_confirm')}}</li>
52                                 <li>
53                                     <button refs="page-comment@delete-button" type="button" class="text-button text-neg icon-item">
54                                         @icon('delete')
55                                         <div>{{ trans('common.delete') }}</div>
56                                     </button>
57                                 </li>
58                             </ul>
59                         </div>
60                     @endif
61                     <span class="text-muted">
62                         &nbsp;&bull;&nbsp;
63                     </span>
64                 </div>
65                 @endif
66                 <div>
67                     <a class="bold text-muted text-small" href="#comment{{$comment->local_id}}">#{{$comment->local_id}}</a>
68                 </div>
69             </div>
70         </div>
71
72     </div>
73
74     <div refs="page-comment@content-container" class="content">
75         @if ($comment->parent_id)
76             <p class="comment-reply">
77                 <a class="text-muted text-small" href="#comment{{ $comment->parent_id }}">@icon('reply'){{ trans('entities.comment_in_reply_to', ['commentId' => '#' . $comment->parent_id]) }}</a>
78             </p>
79         @endif
80         @if($comment->content_ref)
81             <div class="comment-reference-indicator-wrap">
82                 <a href="#" refs="page-comment@content-ref">@icon('bookmark')Reference <span>- Outdated</span></a>
83             </div>
84         @endif
85         {!! $commentHtml  !!}
86     </div>
87
88     @if(!$readOnly && userCan('comment-update', $comment))
89         <form novalidate refs="page-comment@form" hidden class="content pt-s px-s block">
90             <div class="form-group description-input">
91                 <textarea refs="page-comment@input" name="html" rows="3" placeholder="{{ trans('entities.comment_placeholder') }}">{{ $commentHtml }}</textarea>
92             </div>
93             <div class="form-group text-right">
94                 <button type="button" class="button outline" refs="page-comment@form-cancel">{{ trans('common.cancel') }}</button>
95                 <button type="submit" class="button">{{ trans('entities.comment_save') }}</button>
96             </div>
97         </form>
98     @endif
99
100 </div>