]> BookStack Code Mirror - bookstack/blob - resources/views/comments/comment.blade.php
Dependancies: Updated PHP deps via composer
[bookstack] / resources / views / comments / comment.blade.php
1 <div component="{{ $readOnly ? '' : 'page-comment' }}"
2      option:page-comment:comment-id="{{ $comment->id }}"
3      option:page-comment:comment-local-id="{{ $comment->local_id }}"
4      option:page-comment:comment-parent-id="{{ $comment->parent_id }}"
5      option:page-comment:updated-text="{{ trans('entities.comment_updated_success') }}"
6      option:page-comment:deleted-text="{{ trans('entities.comment_deleted_success') }}"
7      id="comment{{$comment->local_id}}"
8      class="comment-box">
9     <div class="header">
10         <div class="flex-container-row wrap items-center gap-x-xs">
11             @if ($comment->createdBy)
12                 <div>
13                     <img width="50" src="{{ $comment->createdBy->getAvatar(50) }}" class="avatar block mr-xs" alt="{{ $comment->createdBy->name }}">
14                 </div>
15             @endif
16             <div class="meta text-muted flex-container-row wrap items-center flex text-small">
17                 @if ($comment->createdBy)
18                     <a href="{{ $comment->createdBy->getProfileUrl() }}">{{ $comment->createdBy->getShortName(16) }}</a>
19                 @else
20                     {{ trans('common.deleted_user') }}
21                 @endif
22                 <span title="{{ $comment->created_at }}">&nbsp;{{ trans('entities.comment_created', ['createDiff' => $comment->created]) }}</span>
23                 @if($comment->isUpdated())
24                     <span class="mx-xs">&bull;</span>
25                     <span title="{{ trans('entities.comment_updated', ['updateDiff' => $comment->updated_at, 'username' => $comment->updatedBy->name ?? trans('common.deleted_user')]) }}">
26                  {{ trans('entities.comment_updated_indicator') }}
27                     </span>
28                 @endif
29             </div>
30             <div class="right-meta flex-container-row justify-flex-end items-center px-s">
31                 @if(!$readOnly && (userCan('comment-create-all') || userCan('comment-update', $comment) || userCan('comment-delete', $comment)))
32                 <div class="actions mr-s">
33                     @if(userCan('comment-create-all'))
34                         <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>
35                     @endif
36                     @if(userCan('comment-update', $comment))
37                         <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>
38                     @endif
39                     @if(userCan('comment-delete', $comment))
40                         <div component="dropdown" class="dropdown-container">
41                             <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>
42                             <ul refs="dropdown@menu" class="dropdown-menu" role="menu">
43                                 <li class="px-m text-small text-muted pb-s">{{trans('entities.comment_delete_confirm')}}</li>
44                                 <li>
45                                     <button refs="page-comment@delete-button" type="button" class="text-button text-neg icon-item">
46                                         @icon('delete')
47                                         <div>{{ trans('common.delete') }}</div>
48                                     </button>
49                                 </li>
50                             </ul>
51                         </div>
52                     @endif
53                     <span class="text-muted">
54                         &nbsp;&bull;&nbsp;
55                     </span>
56                 </div>
57                 @endif
58                 <div>
59                     <a class="bold text-muted text-small" href="#comment{{$comment->local_id}}">#{{$comment->local_id}}</a>
60                 </div>
61             </div>
62         </div>
63
64     </div>
65
66     <div refs="page-comment@content-container" class="content">
67         @if ($comment->parent_id)
68             <p class="comment-reply">
69                 <a class="text-muted text-small" href="#comment{{ $comment->parent_id }}">@icon('reply'){{ trans('entities.comment_in_reply_to', ['commentId' => '#' . $comment->parent_id]) }}</a>
70             </p>
71         @endif
72         {!! $comment->html  !!}
73     </div>
74
75     @if(!$readOnly && userCan('comment-update', $comment))
76         <form novalidate refs="page-comment@form" hidden class="content pt-s px-s block">
77             <div class="form-group description-input">
78                 <textarea refs="page-comment@input" name="markdown" rows="3" placeholder="{{ trans('entities.comment_placeholder') }}">{{ $comment->text }}</textarea>
79             </div>
80             <div class="form-group text-right">
81                 <button type="button" class="button outline" refs="page-comment@form-cancel">{{ trans('common.cancel') }}</button>
82                 <button type="submit" class="button">{{ trans('entities.comment_save') }}</button>
83             </div>
84         </form>
85     @endif
86
87 </div>