article_edit.html 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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">Статья активна</label>
  31. <div class="col-sm-10">
  32. <div class="form-check form-switch pt-2">
  33. <input class="form-check-input" type="checkbox" name="is_active" {{ if .form.IsActive }}checked{{ end }}>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="row mb-3 mt-3">
  38. <label class="col-sm-2 col-form-label col-form-label-sm">Название</label>
  39. <div class="col-sm-10">
  40. {{ $titleErr := index .errors "ArticleForm.Title" }}
  41. <input type="text" class="form-control form-control-sm {{ if $titleErr }}is-invalid{{ end }}" name="title" value="{{ .form.Title }}">
  42. {{ if $titleErr }}
  43. <div class="invalid-feedback">
  44. {{ $titleErr }}
  45. </div>
  46. {{ end }}
  47. </div>
  48. </div>
  49. <div class="row mb-3 mt-3">
  50. <label class="col-sm-2 col-form-label col-form-label-sm">Картинка</label>
  51. <div class="col-sm-10">
  52. {{ $imageErr := index .errors "ArticleForm.Image" }}
  53. <input type="text" class="form-control form-control-sm {{ if $imageErr }}is-invalid{{ end }}" name="image" value="{{ .form.Image }}">
  54. {{ if $imageErr }}
  55. <div class="invalid-feedback">
  56. {{ $imageErr }}
  57. </div>
  58. {{ end }}
  59. </div>
  60. </div>
  61. <div class="row mb-3 mt-3">
  62. <label class="col-sm-2 col-form-label col-form-label-sm">URL</label>
  63. <div class="col-sm-10">
  64. {{ $urlErr := index .errors "ArticleForm.URL" }}
  65. <input type="text" class="form-control form-control-sm {{ if $urlErr }}is-invalid{{ end }}" name="url" value="{{ .form.URL }}">
  66. {{ if $urlErr }}
  67. <div class="invalid-feedback">
  68. {{ $urlErr }}
  69. </div>
  70. {{ end }}
  71. </div>
  72. </div>
  73. <div class="row mb-3 mt-3">
  74. <label class="col-sm-2 col-form-label col-form-label-sm">Дата публикации</label>
  75. <div class="col-sm-10">
  76. {{ $dateErr := index .errors "ArticleForm.PublishTime" }}
  77. <input type="date" class="form-control form-control-sm {{ if $dateErr }}is-invalid{{ end }}" name="publish_time" value="{{ .form.PublishTime }}">
  78. {{ if $dateErr }}
  79. <div class="invalid-feedback">
  80. {{ $dateErr }}
  81. </div>
  82. {{ end }}
  83. </div>
  84. </div>
  85. <div class="row mb-3 mt-3">
  86. <label class="col-sm-2 col-form-label col-form-label-sm">Краткий текст</label>
  87. <div class="col-sm-10">
  88. {{ $previewErr := index .errors "ArticleForm.PreviewText" }}
  89. <textarea id="editor-preview" class="form-control form-control-sm {{ if $previewErr }}is-invalid{{ end }}" name="preview_text">{{ .form.PreviewText }}</textarea>
  90. {{ if $previewErr }}
  91. <div class="invalid-feedback">
  92. {{ $previewErr }}
  93. </div>
  94. {{ end }}
  95. </div>
  96. </div>
  97. <div class="row mb-3 mt-3">
  98. <label class="col-sm-2 col-form-label col-form-label-sm">Текст</label>
  99. <div class="col-sm-10">
  100. {{ $textErr := index .errors "ArticleForm.Text" }}
  101. <textarea id="editor-text" class="form-control form-control-sm {{ if $textErr }}is-invalid{{ end }}" name="text">{{ .form.Text }}</textarea>
  102. {{ if $textErr }}
  103. <div class="invalid-feedback">
  104. {{ $textErr }}
  105. </div>
  106. {{ end }}
  107. </div>
  108. </div>
  109. <div class="row mb-3 mt-3">
  110. <label class="col-sm-2 col-form-label col-form-label-sm">Meta keywords</label>
  111. <div class="col-sm-10">
  112. {{ $mkErr := index .errors "ArticleForm.MetaKeywords" }}
  113. <input type="text" class="form-control form-control-sm {{ if $mkErr }}is-invalid{{ end }}" name="meta_keywords" value="{{ .form.MetaKeywords }}">
  114. {{ if $mkErr }}
  115. <div class="invalid-feedback">
  116. {{ $mkErr }}
  117. </div>
  118. {{ end }}
  119. </div>
  120. </div>
  121. <div class="row mb-3 mt-3">
  122. <label class="col-sm-2 col-form-label col-form-label-sm">Meta description</label>
  123. <div class="col-sm-10">
  124. {{ $mdErr := index .errors "ArticleForm.MetaDescription" }}
  125. <input type="text" class="form-control form-control-sm {{ if $mdErr }}is-invalid{{ end }}" name="meta_description" value="{{ .form.MetaDescription }}">
  126. {{ if $mdErr }}
  127. <div class="invalid-feedback">
  128. {{ $mdErr }}
  129. </div>
  130. {{ end }}
  131. </div>
  132. </div>
  133. <div class="row mb-3 mt-3 border-bottom">
  134. <label class="col-sm-2 col-form-label col-form-label-sm">Теги</label>
  135. <div class="col-sm-10">
  136. {{ $tags := .form.ActiveTags }}
  137. {{ range .tags }}
  138. <div class="form-check">
  139. <input class="form-check-input" type="checkbox" name="tag" value="{{ .ID }}" {{ if index $tags .ID }}checked{{ end }}>
  140. <label class="form-check-label">
  141. {{ .Tag }}
  142. </label>
  143. </div>
  144. {{ end }}
  145. </div>
  146. </div>
  147. <a href="/admin" class="btn btn-sm btn-secondary">Назад</a>
  148. {{ if .show_apply }}
  149. <button type="submit" class="btn btn-sm btn-primary" name="apply">Применить</button>
  150. {{ end }}
  151. <button type="submit" class="btn btn-sm btn-primary" name="save">Сохранить</button>
  152. </form>
  153. </main>