view.blade.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. @extends('desktop.layouts.app')
  2. @section('content')
  3. <div id="boardView" class="container">
  4. <div class="head">
  5. <h4>{{ $board->name }}</h4>
  6. </div>
  7. <div class="body">
  8. <table class="table table-borderless">
  9. <colgroup>
  10. @if($boardMeta->show_user_thumb_in_post)
  11. <col width="82px"/>
  12. @endif
  13. <col width="*"/>
  14. <col width="*"/>
  15. </colgroup>
  16. <thead>
  17. <tr>
  18. <th colspan="3">
  19. <h4>
  20. @if($post->is_notice || $post->is_speaker) [공지] @endif
  21. @if($post->is_secret) <i class="fas fa-lock me-1"></i> @endif
  22. {{ $post->subject }}
  23. </h4>
  24. </th>
  25. </tr>
  26. <tr>
  27. <th rowspan="2" @if(!$boardMeta->show_user_thumb_in_post) class="w-0 p-0" @endif>
  28. @if($boardMeta->show_user_thumb_in_post)
  29. <img src="{{ $post->user->thumb }}" class="profile" width="82" height="82" alt="{{ $post->username }}" onerror="this.src='{{ NO_IMAGE_THUMB_SRC }}'"/>
  30. @endif
  31. </th>
  32. <td>
  33. <strong>{{ $post->username }}</strong> @if($boardMeta->use_post_user_regdate && $post->user->createdAt)<small>{{ $post->user->createdAt }}</small>@endif
  34. </td>
  35. <td>{{ $post->createdAt }}</td>
  36. </tr>
  37. <tr>
  38. <td>
  39. <ul>
  40. <li><span>조회 <var id="txtPostHitCnt">{{ $post->hit }}</var></span></li>
  41. @if(($boardMeta->use_comment) && $post->use_comment)
  42. <li><span>댓글 <var id="txtPostCommentCnt">{{ $post->comment_rows }}</var></span></li>
  43. @endif
  44. @if($boardMeta->use_post_like)
  45. <li><span>좋아요 <var id="txtPostLikeCnt">{{ $post->like }}</var></span></li>
  46. @endif
  47. @if($boardMeta->use_post_dislike)
  48. <li><span>싫어요 <var id="txtPostDislikeCnt">{{ $post->dislike }}</var></span></li>
  49. @endif
  50. @if($boardMeta->show_post_ip || IS_ADMIN)
  51. <li><span>{!! $post->ipAddress !!}</span></li>
  52. @endif
  53. </ul>
  54. </td>
  55. <td>
  56. <ul>
  57. @if($boardMeta->use_url_qrcode)
  58. <li>
  59. <span>
  60. <i class="fa fa-qrcode"></i>
  61. <a href="{{ $post->viewURL }}" id="btnPostQRCode" data-title="{{ $post->subject }}">QR</a>
  62. </span>
  63. </li>
  64. @endif
  65. @if($boardMeta->use_print)
  66. <li>
  67. <span>
  68. <i class="fa fa-print"></i>
  69. <a href="{{ $post->viewURL }}" id="btnPostPrint">인쇄</a>
  70. </span>
  71. </li>
  72. @endif
  73. @if($boardMeta->use_copy_post_url)
  74. <li>
  75. <span>
  76. <i class="fa fa-link"></i>
  77. <a href="{{ $post->viewURL }}" id="btnPostCopy">주소</a>
  78. </span>
  79. </li>
  80. @endif
  81. @if($boardMeta->use_sns)
  82. <li>
  83. <span>
  84. <i class="fa-solid fa-share-nodes"></i>
  85. <a href="{{ $post->viewURL }}" class="dropdown-toggle" aria-expanded="false" data-bs-toggle="dropdown" data-bs-offset="0,10">공유</a>
  86. <div class="dropdown dropdown-menu-end">
  87. <ol class="dropdown-menu">
  88. <li class="dropdown-item btn-post-sns" data-target="1"><i class="fa-brands fa-facebook"></i> Facebook</li>
  89. <li class="dropdown-item btn-post-sns" data-target="2"><i class="fa-brands fa-twitter"></i> Twitter</li>
  90. <li class="dropdown-item btn-post-sns" data-target="3"><i class="fa-brands fa-reddit"></i> Reddit</li>
  91. </ol>
  92. </div>
  93. </span>
  94. </li>
  95. @endif
  96. </ul>
  97. </td>
  98. </tr>
  99. </thead>
  100. <tbody>
  101. @if($post->files->count() > 0 || $post->links->count() > 0)
  102. <tr>
  103. <td colspan="3">
  104. <ol>
  105. {{-- Links --}}
  106. @if($post->links->count() > 0)
  107. @foreach($post->links as $link)
  108. <li>
  109. <a href="{{ $link->url }}" class="btn-site-url" title="{{ $link->url }}" data-lid="{{ $link->id }}" target="_blank" rel="external">
  110. <i class="fas fa-external-link-alt"></i> {{ $link->url }}
  111. </a>
  112. @if($boardMeta->use_attached_url_qrcode)
  113. <a href="{{ $link->url }}" class="btn-qr-code border-start ps-2 ms-1" data-title="{{ $link->url }}">
  114. <i class="fa fa-qrcode"></i>
  115. </a>
  116. @endif
  117. </li>
  118. @endforeach
  119. @endif
  120. {{-- Files --}}
  121. @if($post->files->count() > 0)
  122. @foreach($post->files as $file)
  123. <li>
  124. <a href="#" class="btn-file-download" title="{{ $file->origin_name }}" data-fid="{{ $file->id }}" target="_self" rel="tag">
  125. <i class="fas fa-save"></i> {{ $file->origin_name }} ({{ byteFormat($file->file_size, 2) }})
  126. </a>
  127. </li>
  128. @endforeach
  129. @endif
  130. </ol>
  131. </td>
  132. </tr>
  133. @endif
  134. <tr>
  135. <td colspan="3">
  136. <blockquote>
  137. {!! $post->content !!}
  138. </blockquote>
  139. </td>
  140. </tr>
  141. </tbody>
  142. <tfoot>
  143. <tr>
  144. <td colspan="3">
  145. @if($boardMeta->use_post_like)
  146. <button type="button" id="btnPostLike" class="btn btn-dark" value="1" data-active="{{ $post->isLike ? 1 : 0 }}" data-rows="{{ $post->like }}">
  147. @if($post->isLike)
  148. <i class="fas fa-thumbs-up"></i>
  149. @else
  150. <i class="far fa-thumbs-up"></i>
  151. @endif
  152. <span>{{ $post->like }}</span>
  153. </button>
  154. @endif
  155. @if($boardMeta->use_post_dislike)
  156. <button type="button" id="btnPostDislike" class="btn btn-dark" value="2" data-active="{{ $post->isDislike ? 1 : 0 }}" data-rows="{{ $post->dislike }}">
  157. @if($post->isDislike)
  158. <i class="fas fa-thumbs-down"></i>
  159. @else
  160. <i class="far fa-thumbs-down"></i>
  161. @endif
  162. <span>{{ $post->dislike }}</span>
  163. </button>
  164. @endif
  165. </td>
  166. </tr>
  167. <tr>
  168. <td colspan="3">
  169. @if($post->tags->count() > 0)
  170. <i class="fas fa-tags"></i>
  171. {{ join(', ', array_column($post->tags->toArray() ?? [], 'tag')) }}
  172. @endif
  173. </td>
  174. </tr>
  175. </tfoot>
  176. </table>
  177. <nav>
  178. <div class="row">
  179. <div class="col">
  180. <a href="{{ $listURL }}" class="btn btn-dark">목록</a>
  181. @if($boardMeta->use_prev_next_post)
  182. @if($post->beforePostID)
  183. <a href="{{ $post->beforeViewURL }}" class="btn btn-dark">이전글</a>
  184. @endif
  185. @if($post->nextPostID)
  186. <a href="{{ $post->nextViewURL }}" class="btn btn-dark">다음글</a>
  187. @endif
  188. @endif
  189. </div>
  190. <div class="col text-end">
  191. <!-- 관리 -->
  192. @auth
  193. @if($boardMeta->use_bookmark)
  194. <button type="button" name="btn_post_bookmark" id="btnPostBookmark" class="btn btn-dark @if($post->isBookmark) active @endif">즐겨찾기</button>
  195. @endif
  196. @endauth
  197. @if($boardMeta->use_blame)
  198. <button type="button" name="btn_post_blame" id="btnPostBlame" class="btn btn-dark" data-bs-toggle="modal" data-bs-target="#postBlameModal">신고</button>
  199. @endif
  200. @can('update', [$post, $boardMeta])
  201. <button type="button" name="btn_post_edit" id="btnPostEdit" class="btn btn-primary">수정</button>
  202. @endcan
  203. @can('delete', [$post, $boardMeta])
  204. <button type="button" name="btn_post_delete" id="btnPostDelete" class="btn btn-danger">삭제</button>
  205. @endcan
  206. </div>
  207. </div>
  208. </nav>
  209. </div>
  210. @if($boardMeta->use_comment && $post->use_comment)
  211. <div class="foot">
  212. <table class="table table-borderless">
  213. <thead>
  214. <tr>
  215. <th>
  216. <div class="row">
  217. <div class="col align-self-end">
  218. <h5>
  219. 댓글 <span id="txtCommentRows">{{ $post->comment_rows }}</span>개
  220. </h5>
  221. </div>
  222. <div class="col-auto">
  223. @if($post->comment_rows > 0)
  224. <select id="commentSort" class="form-select w-auto">
  225. <option value="1">등록순</option>
  226. <option value="2">최신순</option>
  227. <option value="3">공감순</option>
  228. <option value="4">댓글순</option>
  229. </select>
  230. @endif
  231. </div>
  232. </div>
  233. </th>
  234. </tr>
  235. </thead>
  236. <tbody>
  237. <tr>
  238. <td>
  239. <!-- 댓글 목록 -->
  240. <div id="commentList"></div>
  241. <!-- 댓글 작성 -->
  242. <div id="commentWrite">
  243. @include('desktop.board.comment.write')
  244. </div>
  245. </td>
  246. </tr>
  247. </tbody>
  248. </table>
  249. </div>
  250. @endif
  251. @if($boardMeta->use_url_qrcode || $boardMeta->use_attached_url_qrcode)
  252. {{-- QR 코드 --}}
  253. <div id="modalQRCode" class="modal" tabindex="-1" role="dialog">
  254. <div class="modal-dialog modal-sm modal-dialog-centered" role="document">
  255. <div class="modal-content">
  256. <div class="modal-header bg-dark text-white">
  257. <h5 class="modal-title">게시글 QR</h5>
  258. <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
  259. </div>
  260. <div class="modal-body text-center"></div>
  261. <div class="modal-footer justify-content-center">
  262. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
  263. </div>
  264. </div>
  265. </div>
  266. </div>
  267. @endif
  268. @if($boardMeta->use_blame)
  269. {{-- 신고하기 --}}
  270. <div class="modal fade" id="postBlameModal" tabindex="-1" aria-labelledby="postBlameModalLabel" aria-hidden="true">
  271. <div class="modal-dialog modal-dialog-centered">
  272. <div class="modal-content">
  273. <div class="modal-header bg-dark text-white">
  274. <h5 class="modal-title" id="postBlameModalLabel">게시글 신고하기</h5>
  275. <button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button>
  276. </div>
  277. <div class="modal-body">
  278. <form name="f_post_blame" id="fPostBlame" class="f-post-blame">
  279. <div class="mb-3">
  280. <label for="type" class="form-label">신고 유형</label>
  281. <select name="type" class="form-select">
  282. <option value="">신고 유형을 선택해주세요.</option>
  283. @foreach(MAP_BLAME_TYPE as $k => $v)
  284. <option value="{{ $k }}">{{ $v }}</option>
  285. @endforeach
  286. </select>
  287. </div>
  288. <div class="mb-3">
  289. <label for="reason" class="form-label">신고 내용</label>
  290. <textarea name="reason" class="form-control" rows="4" minlength="1" maxlength="1000" placeholder="신고 내용을 상세하게 입력해주세요."></textarea>
  291. </div>
  292. </form>
  293. </div>
  294. <div class="modal-footer justify-content-center">
  295. <button type="submit" class="btn btn-primary" form="fPostBlame">확인</button>
  296. <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">취소</button>
  297. </div>
  298. </div>
  299. </div>
  300. </div>
  301. @endif
  302. <form name="f_post_view" id="fPostView" accept-charset="UTF-8" autocomplete="off" rel="nofollow">
  303. @csrf
  304. <input type="hidden" name="code" value="{{ $board->code }}"/>
  305. <input type="hidden" name="bid" value="{{ $post->board_id }}"/>
  306. <input type="hidden" name="pid" value="{{ $post->id }}"/>
  307. <input type="hidden" name="uid" value="{{ $post->user_id }}"/>
  308. <input type="hidden" name="list_url" value="{{ $listURL }}"/>
  309. <input type="hidden" name="edit_url" value="{{ $editURL }}"/>
  310. <input type="hidden" name="delete_url" value="{{ $deleteURL }}"/>
  311. </form>
  312. {{-- 최근 읽기 목록 --}}
  313. @include('desktop.board.component.latest')
  314. </div>
  315. @endsection
  316. @push('styles')
  317. <link rel="stylesheet" href="{{ asset('css/desktop/board/view.css') }}"/>
  318. @endpush
  319. @push('scripts')
  320. <script src="{{ asset('/plugin/editor/tinymce/tinymce.min.js') }}" defer></script>
  321. <script src="{{ asset('/plugin/editor/tinymce/config.js') }}" defer></script>
  322. <script src="{{ asset('js/board/post.js') }}" defer></script>
  323. <script src="{{ asset('js/board/comment.js') }}" defer></script>
  324. <script>
  325. window.addEventListener('DOMContentLoaded', function () {
  326. Comment.init({
  327. code: "{{ $board->code }}",
  328. bid: {{ $post->board_id }},
  329. pid: {{ $post->id }}
  330. });
  331. Comment.list({{ $page }}, {{ $id }});
  332. Prism.highlightAll();
  333. });
  334. </script>
  335. @endpush