master
ブランチ master
LittleBeast / view / common / comments.maron
4.2 KB、77行 生 Blame 履歴
1{@ if (isset($comments)) @}
2 <section class="comments" id="comments">
3 <h2>コメント({{ $comments['count'] }})</h2>
4{@ if ($comments['fedi'] !== null) @}
5 <p class="comment-fedi">Fediverse(Mastodon、Misskey等)からもコメント出来ます:{{ $comments['actor'] }}の投稿(<a href="{{ $comments['fedi'] }}">{{ $comments['fedi'] }}</a>)を検索して返信して下さい。</p>
6{@ endif @}
7{@ if (empty($comments['list'])) @}
8 <p class="comment-none">まだコメントはありません。</p>
9{@ endif @}
10{@ foreach ($comments['list'] as $c) @}
11 <article class="comment depth-{{ $c['depth'] }}" id="c-{{ $c['id'] }}">
12{@ if ($c['deleted']) @}
13 <p class="comment-deleted">(このコメントは削除されました)</p>
14{@ else @}
15 <div class="comment-head">
16 <img class="comment-avatar" src="{{ $c['who']['avatar'] }}" alt="" width="32" height="32" loading="lazy" />
17{@ if ($c['who']['url'] !== '') @}
18 <a class="comment-name" href="{{ $c['who']['url'] }}"{{{ $c['who']['remote'] ? ' rel="nofollow ugc noopener"' : '' }}}>{{{ $c['who']['name'] }}}</a>
19{@ else @}
20 <span class="comment-name">{{{ $c['who']['name'] }}}</span>
21{@ endif @}
22{@ if ($c['who']['handle'] !== '') @}
23 <span class="comment-handle">{{ $c['who']['handle'] }}</span>
24{@ endif @}
25 <a class="comment-date" href="#c-{{ $c['id'] }}">{{ $c['at'] }}{{ $c['edited'] ? '(編集済み)' : '' }}</a>
26 </div>
27 <div class="comment-body">{{{ $c['html'] }}}</div>
28 <div class="comment-actions">
29{@ if ($c['canLike']) @}
30 <form method="post" action="/comments/like">
31 <input type="hidden" name="csrf_token" value="{{ $csrf }}" />
32 <input type="hidden" name="thread" value="{{ $comments['thread'] }}" />
33 <input type="hidden" name="id" value="{{ $c['id'] }}" />
34 <button class="comment-like{{ $c['liked'] ? ' on' : '' }}" title="{{ $c['liked'] ? 'いいねを取り消す' : 'いいね' }}">{{ $c['liked'] ? '♥' : '♡' }} {{ $c['likes'] }}</button>
35 </form>
36{@ elif ($c['likes'] > 0) @}
37 <span class="comment-likes">♥ {{ $c['likes'] }}</span>
38{@ endif @}
39{@ if ($c['canDelete']) @}
40 <form method="post" action="/comments/delete">
41 <input type="hidden" name="csrf_token" value="{{ $csrf }}" />
42 <input type="hidden" name="thread" value="{{ $comments['thread'] }}" />
43 <input type="hidden" name="id" value="{{ $c['id'] }}" />
44 <button class="comment-delete">削除</button>
45 </form>
46{@ endif @}
47 </div>
48{@ if ($c['canReply']) @}
49 <details class="comment-reply">
50 <summary>返信</summary>
51 <form class="comment-form" method="post" action="/comments">
52 <input type="hidden" name="csrf_token" value="{{ $csrf }}" />
53 <input type="hidden" name="thread" value="{{ $comments['thread'] }}" />
54 <input type="hidden" name="parent" value="{{ $c['id'] }}" />
55 <textarea name="body" rows="4" maxlength="{{ $comments['maxLength'] }}" required></textarea>
56 <div class="comment-form-bottom"><button>返信する</button></div>
57 </form>
58 </details>
59{@ endif @}
60{@ endif @}
61 </article>
62{@ endforeach @}
63{@ if ($comments['canPost']) @}
64 <form class="comment-form" method="post" action="/comments">
65 <input type="hidden" name="csrf_token" value="{{ $csrf }}" />
66 <input type="hidden" name="thread" value="{{ $comments['thread'] }}" />
67 <textarea name="body" rows="6" maxlength="{{ $comments['maxLength'] }}" placeholder="コメントを入力して下さい" required></textarea>
68 <div class="comment-form-bottom">
69 <span class="comment-help">Markdown:**太字**、*斜体*、~~取り消し線~~、`コード`、```コードブロック```、&gt; 引用、- リスト、[文字](URL)</span>
70 <button>コメントする</button>
71 </div>
72 </form>
73{@ elif (AUTH_ENABLED && !isset($user)) @}
74 <p class="comment-login"><a href="/login">ログイン</a>するとコメント出来ます。</p>
75{@ endif @}
76 </section>
77{@ endif @}