view.blade.php 17 KB

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