123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- {{ define "admin/custom_bottom_static" }}
- <script>
- tinymce.init({
- selector: 'textarea#editor-preview',
- height: 300,
- language: 'ru',
- statusbar: false,
- promotion: false,
- plugins: "code",
- toolbar: 'code | bold italic underline forecolor | copy cut paste'
- });
- tinymce.init({
- selector: 'textarea#editor-text',
- height: 1000,
- language: 'ru',
- menubar: false,
- statusbar: false,
- promotion: false,
- plugins: 'code',
- toolbar: 'code | bold italic underline forecolor | copy cut paste | alignleft aligncenter alignjustify alignright | h1 h2 h3 h4 h5 h6'
- });
- </script>
- {{ end }}
- <main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
- <div class="d-flex justify-content-between flex-wrap flex-md-nowrap align-items-center pt-3 pb-2 border-bottom">
- <h3 class="h3">{{ .title }}</h3>
- </div>
- <form method="post" class="mb-5">
- <div class="row mb-3 mt-3">
- <label class="col-sm-2 col-form-label col-form-label-sm">Статья активна</label>
- <div class="col-sm-10">
- <div class="form-check form-switch pt-2">
- <input class="form-check-input" type="checkbox" name="is_active" {{ if .form.IsActive }}checked{{ end }}>
- </div>
- </div>
- </div>
- <div class="row mb-3 mt-3">
- <label class="col-sm-2 col-form-label col-form-label-sm">Название</label>
- <div class="col-sm-10">
- {{ $titleErr := index .errors "ArticleForm.Title" }}
- <input type="text" class="form-control form-control-sm {{ if $titleErr }}is-invalid{{ end }}" name="title" value="{{ .form.Title }}">
- {{ if $titleErr }}
- <div class="invalid-feedback">
- {{ $titleErr }}
- </div>
- {{ end }}
- </div>
- </div>
- <div class="row mb-3 mt-3">
- <label class="col-sm-2 col-form-label col-form-label-sm">Картинка</label>
- <div class="col-sm-10">
- {{ $imageErr := index .errors "ArticleForm.Image" }}
- <input type="text" class="form-control form-control-sm {{ if $imageErr }}is-invalid{{ end }}" name="image" value="{{ .form.Image }}">
- {{ if $imageErr }}
- <div class="invalid-feedback">
- {{ $imageErr }}
- </div>
- {{ end }}
- </div>
- </div>
- <div class="row mb-3 mt-3">
- <label class="col-sm-2 col-form-label col-form-label-sm">URL</label>
- <div class="col-sm-10">
- {{ $urlErr := index .errors "ArticleForm.URL" }}
- <input type="text" class="form-control form-control-sm {{ if $urlErr }}is-invalid{{ end }}" name="url" value="{{ .form.URL }}">
- {{ if $urlErr }}
- <div class="invalid-feedback">
- {{ $urlErr }}
- </div>
- {{ end }}
- </div>
- </div>
- <div class="row mb-3 mt-3">
- <label class="col-sm-2 col-form-label col-form-label-sm">Дата публикации</label>
- <div class="col-sm-10">
- {{ $dateErr := index .errors "ArticleForm.PublishTime" }}
- <input type="date" class="form-control form-control-sm {{ if $dateErr }}is-invalid{{ end }}" name="publish_time" value="{{ .form.PublishTime }}">
- {{ if $dateErr }}
- <div class="invalid-feedback">
- {{ $dateErr }}
- </div>
- {{ end }}
- </div>
- </div>
- <div class="row mb-3 mt-3">
- <label class="col-sm-2 col-form-label col-form-label-sm">Краткий текст</label>
- <div class="col-sm-10">
- {{ $previewErr := index .errors "ArticleForm.PreviewText" }}
- <textarea id="editor-preview" class="form-control form-control-sm {{ if $previewErr }}is-invalid{{ end }}" name="preview_text">{{ .form.PreviewText }}</textarea>
- {{ if $previewErr }}
- <div class="invalid-feedback">
- {{ $previewErr }}
- </div>
- {{ end }}
- </div>
- </div>
- <div class="row mb-3 mt-3">
- <label class="col-sm-2 col-form-label col-form-label-sm">Текст</label>
- <div class="col-sm-10">
- {{ $textErr := index .errors "ArticleForm.Text" }}
- <textarea id="editor-text" class="form-control form-control-sm {{ if $textErr }}is-invalid{{ end }}" name="text">{{ .form.Text }}</textarea>
- {{ if $textErr }}
- <div class="invalid-feedback">
- {{ $textErr }}
- </div>
- {{ end }}
- </div>
- </div>
- <div class="row mb-3 mt-3">
- <label class="col-sm-2 col-form-label col-form-label-sm">Meta keywords</label>
- <div class="col-sm-10">
- {{ $mkErr := index .errors "ArticleForm.MetaKeywords" }}
- <input type="text" class="form-control form-control-sm {{ if $mkErr }}is-invalid{{ end }}" name="meta_keywords" value="{{ .form.MetaKeywords }}">
- {{ if $mkErr }}
- <div class="invalid-feedback">
- {{ $mkErr }}
- </div>
- {{ end }}
- </div>
- </div>
- <div class="row mb-3 mt-3">
- <label class="col-sm-2 col-form-label col-form-label-sm">Meta description</label>
- <div class="col-sm-10">
- {{ $mdErr := index .errors "ArticleForm.MetaDescription" }}
- <input type="text" class="form-control form-control-sm {{ if $mdErr }}is-invalid{{ end }}" name="meta_description" value="{{ .form.MetaDescription }}">
- {{ if $mdErr }}
- <div class="invalid-feedback">
- {{ $mdErr }}
- </div>
- {{ end }}
- </div>
- </div>
- <div class="row mb-3 mt-3 border-bottom">
- <label class="col-sm-2 col-form-label col-form-label-sm">Теги</label>
- <div class="col-sm-10">
- {{ $tags := .form.ActiveTags }}
- {{ range .tags }}
- <div class="form-check">
- <input class="form-check-input" type="checkbox" name="tag" value="{{ .ID }}" {{ if index $tags .ID }}checked{{ end }}>
- <label class="form-check-label">
- {{ .Tag }}
- </label>
- </div>
- {{ end }}
- </div>
- </div>
- <a href="/admin" class="btn btn-sm btn-secondary">Назад</a>
- {{ if .show_apply }}
- <button type="submit" class="btn btn-sm btn-primary" name="action" value="apply">Применить</button>
- {{ end }}
- <button type="submit" class="btn btn-sm btn-primary" name="action" value="save">Сохранить</button>
- </form>
- </main>
|