write.blade.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. @extends('desktop.layouts.app')
  2. @section('content')
  3. <div id="boardWrite" 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_write" id="fPostWrite" method="post" action="{{ $storeURL }}" enctype="multipart/form-data" accept-charset="UTF-8" autocomplete="off" rel="nofollow">
  14. @csrf
  15. <input type="hidden" name="code" value="{{ $board->code }}"/>
  16. <input type="hidden" name="bid" value="{{ $board->id }}" />
  17. <input type="hidden" name="pid" value="" />
  18. <input type="hidden" name="subject_min_length" id="subjectMinLength" value="{{ $boardMeta->post_subject_min_length }}"/>
  19. <input type="hidden" name="subject_max_length" id="subjectMaxLength" value="{{ $boardMeta->post_subject_max_length }}"/>
  20. <input type="hidden" name="content_min_length" id="contentMinLength" value="{{ $boardMeta->post_content_min_length }}"/>
  21. <input type="hidden" name="content_max_length" id="contentMaxLength" value="{{ $boardMeta->post_content_max_length }}"/>
  22. <input type="hidden" name="upload_file_max_size" id="uploadFileMaxSize" value="{{ $boardMeta->upload_file_max_size }}"/>
  23. <table class="table table-borderless">
  24. <colgroup>
  25. <col width="150px">
  26. <col width="*">
  27. </colgroup>
  28. {{-- 추가기능 --}}
  29. @if((IS_ADMIN || !$boardMeta->use_personal))
  30. <tr>
  31. <th>
  32. <label>추가 기능</label>
  33. </th>
  34. <td colspan="3">
  35. @admin
  36. @if(!$boardMeta->use_personal) {{-- 1:1 게시판 전체공지는 제외 --}}
  37. <div class="form-check form-check-inline">
  38. <input type="checkbox" name="is_speaker" id="isSpeaker" class="form-check-input " value="1" @if(old('is_speaker') == '1') checked @endif />
  39. <label for="isSpeaker" class="form-check-label">전체공지</label>
  40. </div>
  41. @endif
  42. <div class="form-check form-check-inline">
  43. <input type="checkbox" name="is_notice" id="isNotice" class="form-check-input" value="1" @if(old('is_notice') == '1') checked @endif />
  44. <label for="isNotice" class="form-check-label">공지</label>
  45. </div>
  46. @endadmin
  47. @if($boardMeta->use_post_secret == '1')
  48. <div class="form-check form-check-inline">
  49. <input type="checkbox" name="is_secret" id="isSecret" class="form-check-input" value="1" @if(old('is_secret', $boardMeta->use_post_secret_selected) == '1') checked @endif />
  50. <label for="isSecret" class="form-check-label">비밀글</label>
  51. </div>
  52. @endif
  53. </td>
  54. </tr>
  55. @endif
  56. {{-- 분류 --}}
  57. @if($boardMeta->use_category && $category)
  58. <tr>
  59. <th>
  60. <label for="category">{{ ($boardMeta->use_personal ? '문의 유형' : '분류') }}</label>
  61. </th>
  62. <td colspan="3">
  63. <select name="category" id="category" class="form-select w-auto" data-category-required="{{ $boardMeta->use_category_required }}">
  64. <option value="">분류를 선택하세요.</option>
  65. @php
  66. $traverse = function ($categories) use (&$traverse) {
  67. foreach($categories as $row) {
  68. $tab = ($row->depth > 0 ? '└' : '') . str_repeat('─', ($row->depth > 0 ? $row->depth - 1 : 0));
  69. $checked = (old('category') == $row->board_category_id ? 'selected' : '');
  70. @endphp
  71. <option value="{{ $row->board_category_id }}" data-depth="{{ $row->depth }}" {{ $checked }}>{{$tab . ' ' . $row->name}}</option>
  72. @php
  73. $traverse($row->children);
  74. }
  75. };
  76. $traverse($category->list);
  77. @endphp
  78. </select>
  79. </td>
  80. </tr>
  81. @endif
  82. {{-- 익명 게시판 --}}
  83. @guest
  84. <tr>
  85. <th>
  86. <label for="username">작성자</label>
  87. </th>
  88. <td>
  89. <input type="text" name="username" id="username" class="form-control" value="{{ old('username') }}"/>
  90. </td>
  91. <th class="text-center">
  92. <label for="password">비밀번호</label>
  93. </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') }}"/>
  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'), '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') }}" placeholder="콤마(,)로 구분해 입력하세요. (최대 10개)"/>
  125. </td>
  126. </tr>
  127. @endif
  128. {{-- Links --}}
  129. @for ($i = 1; $i <= ($boardMeta->link_num ?? 0); $i++)
  130. <tr>
  131. <th>
  132. <label for="links_{{ $i }}">Link #{{ $i }}</label>
  133. </th>
  134. <td colspan="3">
  135. <input type="text" name="links[{{ $i }}]" id="links_{{ $i }}" value="{{ old('links.' . $i) }}" class="form-control form-control-url" />
  136. </td>
  137. </tr>
  138. @endfor
  139. {{-- Files --}}
  140. @if($boardMeta->use_upload_file)
  141. @for ($i = 1; $i <= ($boardMeta->upload_file_num ?? 0); $i++)
  142. <tr>
  143. <th>
  144. <label for="files_{{ $i }}">File #{{ $i }}</label>
  145. </th>
  146. <td colspan="3">
  147. <input type="file" name="files[{{ $i }}]" id="files_{{ $i }}" class="form-control-file"
  148. @if($boardMeta->upload_only_img_file) accept="image/gif, image/jpeg, image/png"
  149. @elseif($boardMeta->upload_file_extension) accept="{{ $boardMeta->upload_file_extension }}" @endif
  150. />
  151. <small class="form-text text-muted">
  152. <span>0</span> @if($boardMeta->upload_file_max_size) / {{ $boardMeta->upload_file_max_size ?? 0 }}MB @endif
  153. </small>
  154. </td>
  155. </tr>
  156. @endfor
  157. @endif
  158. {{-- Captcha --}}
  159. @if($boardMeta->use_post_captcha)
  160. <tr>
  161. <th>
  162. <label for="captcha">자동등록방지</label>
  163. </th>
  164. <td>
  165. <div class="captcha">
  166. {!! captcha_image_html('PostWriteCaptcha') !!}
  167. <input type="text" name="captcha" id="captcha" class="form-control" placeholder="자동등록방지 문자를 입력하십시오."/>
  168. </div>
  169. </td>
  170. </tr>
  171. @endif
  172. </table>
  173. </form>
  174. </div>
  175. <hr/>
  176. <div class="foot">
  177. <div class="row">
  178. <div class="col align-self-center">
  179. <a href="{{ $provisionURL }}" target="_blank">이용약관</a> 및 <a href="{{ $boardRuleURL }}" target="_blank">게시판 규칙</a>에 위배되는 경우, 이용에 제한을 받을 수 있습니다.
  180. </div>
  181. <div class="col-auto text-end">
  182. <button type="button" id="btnPostSubmit" class="btn btn-primary" data-form="fPostWrite">작성</button>
  183. <a href="{{ $listURL }}" class="btn btn-default">취소</a>
  184. </div>
  185. </div>
  186. </div>
  187. </div>
  188. @endsection
  189. @push('styles')
  190. <link rel="stylesheet" href="{{ asset('css/desktop/board/write.css') }}"/>
  191. @if($boardMeta->use_post_captcha)
  192. <link rel="stylesheet" href="{{ captcha_layout_stylesheet_url() }}"/>
  193. @endif
  194. @endpush
  195. @push('scripts')
  196. <script src="{{ asset('/plugin/editor/tinymce/tinymce.min.js') }}" defer></script>
  197. <script src="{{ asset('/plugin/editor/tinymce/config.js') }}" defer></script>
  198. <script src="{{ asset('js/board/post.js') }}" defer></script>
  199. @endpush