article_edit.html 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. {{ define "admin/custom_bottom_static" }}
  2. <script>
  3. tinymce.init({
  4. selector: 'textarea#editor-preview',
  5. height: 300,
  6. language: 'ru',
  7. statusbar: false,
  8. promotion: false,
  9. plugins: "code",
  10. toolbar: 'code | bold italic underline forecolor | copy cut paste'
  11. });
  12. tinymce.init({
  13. selector: 'textarea#editor-text',
  14. height: 1000,
  15. language: 'ru',
  16. menubar: false,
  17. statusbar: false,
  18. promotion: false,
  19. plugins: 'code',
  20. toolbar: 'code | bold italic underline forecolor | copy cut paste | alignleft aligncenter alignjustify alignright | h1 h2 h3 h4 h5 h6'
  21. });
  22. </script>
  23. {{ end }}
  24. <main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
  25. <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 border-bottom">
  26. <h3 class="h3">{{ .title }}</h3>
  27. </div>
  28. <form method="post" class="mb-5">
  29. <div class="row mb-3 mt-3">
  30. <label class="col-sm-2 col-form-label col-form-label-sm">
  31. {{ trans .lang "admin_article_is_active" }}
  32. </label>
  33. <div class="col-sm-10">
  34. <div class="form-check form-switch pt-2">
  35. <input class="form-check-input" type="checkbox" name="is_active" {{ if .form.IsActive }}checked{{ end }}>
  36. </div>
  37. </div>
  38. </div>
  39. <div class="row mb-3 mt-3">
  40. <label class="col-sm-2 col-form-label col-form-label-sm">
  41. {{ trans .lang "admin_article_language" }}
  42. </label>
  43. <div class="col-sm-10">
  44. {{ $sLang := .form.Language }}
  45. {{ $langErr := index .errors "Language" }}
  46. <select name="language" class="form-select form-select-sm">
  47. {{ range .languages }}
  48. <option {{ if eq $sLang . }}selected{{ end }} value="{{ . }}">{{ . }}</option>
  49. {{ end }}
  50. </select>
  51. {{ if $langErr }}
  52. <div class="invalid-feedback">
  53. {{ $langErr }}
  54. </div>
  55. {{ end }}
  56. </div>
  57. </div>
  58. <div class="row mb-3 mt-3">
  59. <label class="col-sm-2 col-form-label col-form-label-sm">
  60. {{ trans .lang "admin_article_title" }}
  61. </label>
  62. <div class="col-sm-10">
  63. {{ $titleErr := index .errors "Title" }}
  64. <input type="text" class="form-control form-control-sm {{ if $titleErr }}is-invalid{{ end }}" name="title" value="{{ .form.Title }}">
  65. {{ if $titleErr }}
  66. <div class="invalid-feedback">
  67. {{ $titleErr }}
  68. </div>
  69. {{ end }}
  70. </div>
  71. </div>
  72. <div class="row mb-3 mt-3">
  73. <label class="col-sm-2 col-form-label col-form-label-sm">
  74. {{ trans .lang "admin_article_image" }}
  75. </label>
  76. <div class="col-sm-10">
  77. {{ $imageErr := index .errors "Image" }}
  78. <input type="text" class="form-control form-control-sm {{ if $imageErr }}is-invalid{{ end }}" name="image" value="{{ .form.Image }}">
  79. {{ if $imageErr }}
  80. <div class="invalid-feedback">
  81. {{ $imageErr }}
  82. </div>
  83. {{ end }}
  84. </div>
  85. </div>
  86. <div class="row mb-3 mt-3">
  87. <label class="col-sm-2 col-form-label col-form-label-sm">
  88. URL
  89. </label>
  90. <div class="col-sm-10">
  91. {{ $urlErr := index .errors "URL" }}
  92. <input type="text" class="form-control form-control-sm {{ if $urlErr }}is-invalid{{ end }}" name="url" value="{{ .form.URL }}">
  93. {{ if $urlErr }}
  94. <div class="invalid-feedback">
  95. {{ $urlErr }}
  96. </div>
  97. {{ end }}
  98. </div>
  99. </div>
  100. <div class="row mb-3 mt-3">
  101. <label class="col-sm-2 col-form-label col-form-label-sm">
  102. {{ trans .lang "admin_article_pub_date" }}
  103. </label>
  104. <div class="col-sm-10">
  105. {{ $dateErr := index .errors "PublishTime" }}
  106. <input type="date" class="form-control form-control-sm {{ if $dateErr }}is-invalid{{ end }}" name="publish_time" value="{{ .form.PublishTime }}">
  107. {{ if $dateErr }}
  108. <div class="invalid-feedback">
  109. {{ $dateErr }}
  110. </div>
  111. {{ end }}
  112. </div>
  113. </div>
  114. <div class="row mb-3 mt-3">
  115. <label class="col-sm-2 col-form-label col-form-label-sm">
  116. {{ trans .lang "admin_preview_text" }}
  117. </label>
  118. <div class="col-sm-10">
  119. {{ $previewErr := index .errors "PreviewText" }}
  120. <textarea id="editor-preview" class="form-control form-control-sm {{ if $previewErr }}is-invalid{{ end }}" name="preview_text">{{ .form.PreviewText }}</textarea>
  121. {{ if $previewErr }}
  122. <div class="invalid-feedback">
  123. {{ $previewErr }}
  124. </div>
  125. {{ end }}
  126. </div>
  127. </div>
  128. <div class="row mb-3 mt-3">
  129. <label class="col-sm-2 col-form-label col-form-label-sm">
  130. {{ trans .lang "admin_text" }}
  131. </label>
  132. <div class="col-sm-10">
  133. {{ $textErr := index .errors "Text" }}
  134. <textarea id="editor-text" class="form-control form-control-sm {{ if $textErr }}is-invalid{{ end }}" name="text">{{ .form.Text }}</textarea>
  135. {{ if $textErr }}
  136. <div class="invalid-feedback">
  137. {{ $textErr }}
  138. </div>
  139. {{ end }}
  140. </div>
  141. </div>
  142. <div class="row mb-3 mt-3">
  143. <label class="col-sm-2 col-form-label col-form-label-sm">
  144. Meta keywords
  145. </label>
  146. <div class="col-sm-10">
  147. {{ $mkErr := index .errors "MetaKeywords" }}
  148. <input type="text" class="form-control form-control-sm {{ if $mkErr }}is-invalid{{ end }}" name="meta_keywords" value="{{ .form.MetaKeywords }}">
  149. {{ if $mkErr }}
  150. <div class="invalid-feedback">
  151. {{ $mkErr }}
  152. </div>
  153. {{ end }}
  154. </div>
  155. </div>
  156. <div class="row mb-3 mt-3">
  157. <label class="col-sm-2 col-form-label col-form-label-sm">
  158. Meta description
  159. </label>
  160. <div class="col-sm-10">
  161. {{ $mdErr := index .errors "MetaDescription" }}
  162. <input type="text" class="form-control form-control-sm {{ if $mdErr }}is-invalid{{ end }}" name="meta_description" value="{{ .form.MetaDescription }}">
  163. {{ if $mdErr }}
  164. <div class="invalid-feedback">
  165. {{ $mdErr }}
  166. </div>
  167. {{ end }}
  168. </div>
  169. </div>
  170. <div class="row mb-3 mt-3 border-bottom">
  171. <label class="col-sm-2 col-form-label col-form-label-sm">
  172. {{ trans .lang "admin_tags" }}
  173. </label>
  174. <div class="col-sm-10">
  175. {{ $tags := .form.ActiveTags }}
  176. {{ range .tags }}
  177. <div class="form-check">
  178. <input class="form-check-input" type="checkbox" name="tag" value="{{ .ID }}" {{ if index $tags .ID }}checked{{ end }}>
  179. <label class="form-check-label">
  180. {{ .Tag }}
  181. </label>
  182. </div>
  183. {{ end }}
  184. </div>
  185. </div>
  186. <a href="/admin" class="btn btn-sm btn-secondary">{{ trans .lang "admin_back" }}</a>
  187. {{ if .show_apply }}
  188. <button type="submit" class="btn btn-sm btn-primary" name="action" value="apply">
  189. {{ trans .lang "admin_apply_btn" }}
  190. </button>
  191. {{ end }}
  192. <button type="submit" class="btn btn-sm btn-primary" name="action" value="save">
  193. {{ trans .lang "admin_save_btn" }}
  194. </button>
  195. </form>
  196. </main>