write.blade.php 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. @extends('mobile.layouts.app')
  2. @section('content')
  3. <div id="boardWrite" class="container">
  4. <h5>{{ $board->name }} 글쓰기</h5>
  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="50%"/>
  26. <col width="50%"/>
  27. </colgroup>
  28. {{-- 추가기능 --}}
  29. @if((IS_ADMIN || !$boardMeta->use_personal))
  30. <tr>
  31. <td colspan="2">
  32. <label class="form-label">추가 기능</label>
  33. <div>
  34. @admin
  35. @if(!$boardMeta->use_personal) {{-- 1:1 게시판 전체공지는 제외 --}}
  36. <div class="form-check form-check-inline">
  37. <input type="checkbox" name="is_speaker" id="isSpeaker" class="form-check-input " value="1" @if(old('is_speaker') == '1') checked @endif />
  38. <label for="isSpeaker" class="form-check-label">전체공지</label>
  39. </div>
  40. @endif
  41. <div class="form-check form-check-inline">
  42. <input type="checkbox" name="is_notice" id="isNotice" class="form-check-input" value="1" @if(old('is_notice') == '1') checked @endif />
  43. <label for="isNotice" class="form-check-label">공지</label>
  44. </div>
  45. @endadmin
  46. @if($boardMeta->use_post_secret == '1')
  47. <div class="form-check form-check-inline">
  48. <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 />
  49. <label for="isSecret" class="form-check-label">비밀글</label>
  50. </div>
  51. @endif
  52. </div>
  53. </td>
  54. </tr>
  55. @endif
  56. {{-- 분류 --}}
  57. @if($boardMeta->use_category && $category)
  58. <tr>
  59. <td colspan="2">
  60. <label for="category" class="form-label">{{ ($boardMeta->use_personal ? '문의 유형' : '분류') }}</label>
  61. <select name="category" id="category" class="form-select">
  62. <option value="">분류를 선택하세요.</option>
  63. @php
  64. $traverse = function ($categories) use (&$traverse) {
  65. foreach($categories as $row) {
  66. $tab = ($row->depth > 0 ? '└' : '') . str_repeat('─', ($row->depth > 0 ? $row->depth - 1 : 0));
  67. $checked = (old('category') == $row->board_category_id ? 'selected' : '');
  68. @endphp
  69. <option value="{{ $row->board_category_id }}" data-depth="{{ $row->depth }}" {{ $checked }}>{{$tab . ' ' . $row->name}}</option>
  70. @php
  71. $traverse($row->children);
  72. }
  73. };
  74. $traverse($category->list);
  75. @endphp
  76. </select>
  77. </td>
  78. </tr>
  79. @endif
  80. {{-- 익명 게시판 --}}
  81. @guest
  82. <tr>
  83. <td>
  84. <label for="username" class="form-label">작성자</label>
  85. <input type="text" name="username" id="username" class="form-control" value="{{ old('username') }}"/>
  86. </td>
  87. <td>
  88. <label for="password" class="form-label">비밀번호</label>
  89. <input type="password" name="password" id="password" class="form-control" value=""/>
  90. </td>
  91. </tr>
  92. @endguest
  93. {{-- 제목 --}}
  94. <tr>
  95. <td colspan="2">
  96. <label for="subject" class="form-label">제목</label>
  97. <input type="text" name="subject" id="subject" class="form-control" required placeholder="{{ $boardMeta->post_default_subject }}" value="{{ old('subject') }}"/>
  98. </td>
  99. </tr>
  100. {{-- 내용 --}}
  101. <tr>
  102. <td colspan="2">
  103. <label for="content" class="form-label">내용</label>
  104. {!! htmlEditor('content', old('content'), 'form-control dhtml-editor', $boardMeta->use_post_dhtml, false, $boardMeta->post_default_content, 8, 'content'); !!}
  105. </td>
  106. </tr>
  107. {{-- Tags --}}
  108. @if($boardMeta->use_post_tag)
  109. <tr>
  110. <td colspan="2">
  111. <label for="tags" class="form-label">Tag</label>
  112. <input type="text" name="tags" id="tags" class="form-control" value="{{ old('tags') }}" placeholder="콤마(,)로 구분해 입력하세요. (최대 10개)"/>
  113. </td>
  114. </tr>
  115. @endif
  116. {{-- Links --}}
  117. @for ($i = 1; $i <= ($boardMeta->link_num ?? 0); $i++)
  118. <tr>
  119. <td colspan="2">
  120. <label for="links_{{ $i }}" class="form-label">Link #{{ $i }}</label>
  121. <input type="text" name="links[{{ $i }}]" id="links_{{ $i }}" value="{{ old('links.' . $i) }}" class="form-control form-control-url" />
  122. </td>
  123. </tr>
  124. @endfor
  125. {{-- Files --}}
  126. @if($boardMeta->use_upload_file)
  127. @for ($i = 1; $i <= ($boardMeta->upload_file_num ?? 0); $i++)
  128. <tr>
  129. <td colspan="2">
  130. <label for="files_{{ $i }}" class="form-label w-100">File #{{ $i }}</label>
  131. <input type="file" name="files[{{ $i }}]" id="files_{{ $i }}" class="form-control-file"
  132. @if($boardMeta->upload_only_img_file) accept="image/gif, image/jpeg, image/png"
  133. @elseif($boardMeta->upload_file_extension) accept="{{ $boardMeta->upload_file_extension }}" @endif
  134. />
  135. <small class="form-text text-muted">
  136. <span>0</span> @if($boardMeta->upload_file_max_size) / {{ $boardMeta->upload_file_max_size ?? 0 }}MB @endif
  137. </small>
  138. </td>
  139. </tr>
  140. @endfor
  141. @endif
  142. {{-- Captcha --}}
  143. @if($boardMeta->use_post_captcha)
  144. <tr>
  145. <td>
  146. <label for="captcha" class="form-label">자동등록방지</label>
  147. <div class="captcha">
  148. {!! captcha_image_html('PostWriteCaptcha') !!}
  149. <input type="text" name="captcha" id="captcha" class="form-control" placeholder="자동등록방지 문자를 입력하십시오."/>
  150. </div>
  151. </td>
  152. </tr>
  153. @endif
  154. </table>
  155. </form>
  156. </div>
  157. <hr/>
  158. <div class="foot">
  159. <div class="row">
  160. <div class="col align-self-center">
  161. <a href="{{ $provisionURL }}" target="_blank">이용약관</a> 및 <a href="{{ $boardRuleURL }}" target="_blank">게시판 규칙</a>에 위배되는 경우, 이용에 제한을 받을 수 있습니다.
  162. </div>
  163. <div class="col-auto text-end">
  164. <button type="button" id="btnPostSubmit" class="btn btn-primary" data-form="fPostWrite">작성</button>
  165. <a href="{{ $listURL }}" class="btn btn-default">취소</a>
  166. </div>
  167. </div>
  168. </div>
  169. </div>
  170. @endsection
  171. @push('styles')
  172. <link rel="stylesheet" href="{{ asset('css/mobile/board/write.css') }}"/>
  173. @if($boardMeta->use_post_captcha)
  174. <link rel="stylesheet" href="{{ captcha_layout_stylesheet_url() }}"/>
  175. @endif
  176. @endpush
  177. @push('scripts')
  178. <script src="{{ asset('/plugin/editor/tinymce/tinymce.min.js') }}" defer></script>
  179. <script src="{{ asset('/plugin/editor/tinymce/config.js') }}" defer></script>
  180. <script src="{{ asset('js/board/post.js') }}" defer></script>
  181. @endpush