edit.blade.php 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. @extends('desktop.layouts.app')
  2. @section('content')
  3. <div id="boardEdit" class="container">
  4. <h4>{{ $board->name }} 글 수정</h4>
  5. <hr/>
  6. @if($boardMeta->write_header_content)
  7. <div class="head">
  8. {!! $boardMeta->write_header_content !!}
  9. </div>
  10. @endif
  11. {{-- 게시글 수정 --}}
  12. <div class="body">
  13. <form name="f_post_edit" id="fPostEdit" method="post" action="{{ $updateURL }}" enctype="multipart/form-data" accept-charset="UTF-8" autocomplete="off" rel="nofollow">
  14. @csrf
  15. @method('PUT')
  16. <input type="hidden" name="code" value="{{ $board->code }}"/>
  17. <input type="hidden" name="bid" value="{{ $post->board_id }}" />
  18. <input type="hidden" name="pid" value="{{ $post->id }}" />
  19. <input type="hidden" name="subject_min_length" id="subjectMinLength" value="{{ $boardMeta->post_subject_min_length }}"/>
  20. <input type="hidden" name="subject_max_length" id="subjectMaxLength" value="{{ $boardMeta->post_subject_max_length }}"/>
  21. <input type="hidden" name="content_min_length" id="contentMinLength" value="{{ $boardMeta->post_content_min_length }}"/>
  22. <input type="hidden" name="content_max_length" id="contentMaxLength" value="{{ $boardMeta->post_content_max_length }}"/>
  23. <input type="hidden" name="upload_file_max_size" id="uploadFileMaxSize" value="{{ $boardMeta->upload_file_max_size }}"/>
  24. <input type="hidden" name="passwd" value="{{ request()->input('passwd') }}"/>
  25. <table class="table table-borderless">
  26. <colgroup>
  27. <col width="150px">
  28. <col width="*">
  29. </colgroup>
  30. {{-- 추가기능 --}}
  31. @if((IS_ADMIN || !$boardMeta->use_personal))
  32. <tr>
  33. <th>
  34. <label>추가 기능</label>
  35. </th>
  36. <td colspan="3">
  37. @admin
  38. @if(!$boardMeta->use_personal) {{-- 1:1 게시판 전체공지는 제외 --}}
  39. <div class="form-check form-check-inline">
  40. <input type="checkbox" name="is_speaker" id="isSpeaker" class="form-check-input " value="1" @if(old('is_speaker', $post->is_speaker) == '1') checked @endif />
  41. <label for="isSpeaker" class="form-check-label">전체공지</label>
  42. </div>
  43. @endif
  44. <div class="form-check form-check-inline">
  45. <input type="checkbox" name="is_notice" id="isNotice" class="form-check-input" value="1" @if(old('is_notice', $post->is_notice) == '1') checked @endif />
  46. <label for="isNotice" class="form-check-label">공지</label>
  47. </div>
  48. @endadmin
  49. @if($boardMeta->use_post_secret == '1')
  50. <div class="form-check form-check-inline">
  51. <input type="checkbox" name="is_secret" id="isSecret" class="form-check-input" value="1" @if($boardMeta->use_post_secret_selected || old('is_secret', $post->is_secret) == '1') checked @endif />
  52. <label for="isSecret" class="form-check-label">비밀글</label>
  53. </div>
  54. @endif
  55. </td>
  56. </tr>
  57. @endif
  58. {{-- 분류 --}}
  59. @if($boardMeta->use_category && $category)
  60. <tr>
  61. <th>
  62. <label for="category">{{ ($boardMeta->use_personal ? '문의 유형' : '분류') }}</label>
  63. </th>
  64. <td colspan="3">
  65. <select name="category" id="category" class="form-select w-auto" data-category-required="{{ $boardMeta->use_category_required }}">
  66. <option value="">분류를 선택하세요.</option>
  67. @php
  68. $traverse = function ($categories) use (&$traverse, $post) {
  69. foreach($categories as $row) {
  70. $tab = ($row->depth > 0 ? '└' : '') . str_repeat('─', ($row->depth > 0 ? $row->depth - 1 : 0));
  71. $checked = (old('category', $post->board_category_id) == $row->board_category_id ? 'selected' : '');
  72. @endphp
  73. <option value="{{ $row->board_category_id }}" data-depth="{{ $row->depth }}" {{ $checked }}>{{$tab . ' ' . $row->name}}</option>
  74. @php
  75. $traverse($row->children);
  76. }
  77. };
  78. $traverse($category->list);
  79. @endphp
  80. </select>
  81. </td>
  82. </tr>
  83. @endif
  84. {{-- 익명 게시판 --}}
  85. @guest
  86. <tr>
  87. <th>
  88. <label for="username">이름</label>
  89. </th>
  90. <td>
  91. <input type="text" name="username" id="username" class="form-control" value="{{ old('username', $post->username) }}"/>
  92. </td>
  93. <th class="text-center"><label for="password">비밀번호</label></th>
  94. <td>
  95. <input type="password" name="password" id="password" class="form-control" value=""/>
  96. </td>
  97. </tr>
  98. @endguest
  99. {{-- 제목 --}}
  100. <tr>
  101. <th>
  102. <label for="subject">제목</label>
  103. </th>
  104. <td colspan="3">
  105. <input type="text" name="subject" id="subject" class="form-control" required placeholder="{{ $boardMeta->post_default_subject }}" value="{{ old('subject', $post->subject) }}"/>
  106. </td>
  107. </tr>
  108. {{-- 내용 --}}
  109. <tr>
  110. <th class="align-top">
  111. <label for="content">내용</label>
  112. </th>
  113. <td colspan="4">
  114. {!! htmlEditor('content', old('content', $post->content), 'form-control dhtml-editor', $boardMeta->use_post_dhtml, false, $boardMeta->post_default_content, 8, 'content'); !!}
  115. </td>
  116. </tr>
  117. {{-- Tags --}}
  118. @if($boardMeta->use_post_tag)
  119. <tr>
  120. <th>
  121. <label for="tags">Tag</label>
  122. </th>
  123. <td colspan="3">
  124. <input type="text" name="tags" id="tags" class="form-control" value="{{ old('tags', join(', ', array_column($post->tags->toArray() ?? [], 'tag'))) }}" placeholder="콤마(,)로 구분해 입력하세요. (최대 10개)"/>
  125. </td>
  126. </tr>
  127. @endif
  128. {{-- Links --}}
  129. @for ($i = 0; $i < ($boardMeta->link_num ?? 0); $i++)
  130. @php
  131. $linked = $post->links->get($i);
  132. if($linked) {
  133. $key = $linked->id;
  134. $link = $linked->url;
  135. }else{
  136. $key = ($i + 1);
  137. $link = (old("link")[$i] ?? null);
  138. }
  139. @endphp
  140. <tr>
  141. <th>
  142. <label for="links_{{ $key }}">Link #{{ ($i + 1) }}</label>
  143. </th>
  144. <td colspan="3">
  145. <input type="text" name="links[{{ $key }}]" id="links_{{ $key }}" class="form-control form-control-url" value="{{ old('links.' . $key, $link) }}" />
  146. </td>
  147. </tr>
  148. @endfor
  149. {{-- Files --}}
  150. @if($boardMeta->use_upload_file)
  151. @for ($i = 0; $i < ($boardMeta->upload_file_num ?? 0); $i++)
  152. <tr>
  153. <th>
  154. <label for="files_{{ $i }}">File #{{ $i + 1 }}</label>
  155. </th>
  156. <td colspan="3">
  157. @if($file = $post->files->get($i))
  158. @if($file->is_image)
  159. <i class="far fa-image"></i>
  160. @else
  161. <i class="fas fa-file"></i>
  162. @endif
  163. <a href="{{ $file->file_url }}" download="{{ $file->origin_name }}" class="btn btn-link ps-0">{{ $file->origin_name }}</a>
  164. <div class="form-check form-check-inline align-middle">
  165. <input type="checkbox" name="file_is_delete[{{ $file->id }}]" id="fileIsDelete_{{ $file->id }}" class="form-check-input" value="1"/>
  166. <label for="fileIsDelete_{{ $file->id }}" class="form-check-label">삭제</label>
  167. </div>
  168. @else
  169. <input type="file" name="files[{{ $i }}]" id="files_{{ $i }}" class="form-control-file"
  170. @if($boardMeta->upload_only_img_file) accept="image/gif, image/jpeg, image/png"
  171. @elseif($boardMeta->upload_file_extension) accept="{{ $boardMeta->upload_file_extension }}" @endif
  172. />
  173. <small class="form-text text-muted">
  174. <span>0</span> / {{ $boardMeta->upload_file_max_size }}MB
  175. </small>
  176. @endif
  177. </td>
  178. </tr>
  179. @endfor
  180. @endif
  181. {{-- Captcha --}}
  182. @if($boardMeta->use_post_captcha)
  183. <tr>
  184. <th>
  185. <label for="captcha">자동등록방지</label>
  186. </th>
  187. <td>
  188. <div class="captcha">
  189. {!! captcha_image_html('PostEditCaptcha') !!}
  190. <input type="text" name="captcha" id="captcha" class="form-control mt-2" placeholder="자동등록방지 문자를 입력하십시오."/>
  191. </div>
  192. </td>
  193. </tr>
  194. @endif
  195. </table>
  196. </form>
  197. </div>
  198. <hr/>
  199. <div class="foot">
  200. <div class="row">
  201. <div class="col align-self-center">
  202. <a href="{{ $provisionURL }}" target="_blank">이용약관</a> 및 <a href="{{ $boardRuleURL }}" target="_blank">게시판 규칙</a>에 위배되는 경우, 이용에 제한을 받을 수 있습니다.
  203. </div>
  204. <div class="col-auto text-end">
  205. <button type="button" id="btnPostSubmit" class="btn btn-primary" data-form="fPostEdit">작성</button>
  206. <a href="{{ $listURL }}" class="btn btn-default">취소</a>
  207. </div>
  208. </div>
  209. </div>
  210. </div>
  211. @endsection
  212. @push('styles')
  213. <link rel="stylesheet" href="{{ asset('css/mobile/board/write.css') }}"/>
  214. @if($boardMeta->use_post_captcha)
  215. <link rel="stylesheet" href="{{ captcha_layout_stylesheet_url() }}"/>
  216. @endif
  217. @endpush
  218. @push('scripts')
  219. <script src="{{ asset('/plugin/editor/tinymce/tinymce.min.js') }}" defer></script>
  220. <script src="{{ asset('/plugin/editor/tinymce/config.js') }}" defer></script>
  221. <script src="{{ asset('js/board/post.js') }}" defer></script>
  222. @endpush