123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- {{ define "admin/custom_bottom_static" }}
- <script>
- tinymce.init({
- selector: 'textarea#editor-text',
- height: 800,
- language: 'ru',
- statusbar: false,
- promotion: false,
- plugins: "code"
- });
- tinymce.init({
- selector: 'textarea#editor-preview',
- height: 200,
- language: 'ru',
- statusbar: false,
- promotion: false,
- plugins: "code"
- });
- </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">
- <h2 class="h2">{{ .title }}</h2>
- </div>
- <form method="post" class="mb-5">
- <div class="row mb-3 mt-3">
- <label class="col-sm-2 col-form-label">Статья активна</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">Название</label>
- <div class="col-sm-10">
- {{ $titleErr := index .errors "ArticleForm.Title" }}
- <input type="text" class="form-control {{ 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">Картинка</label>
- <div class="col-sm-10">
- {{ $imageErr := index .errors "ArticleForm.Image" }}
- <input type="text" class="form-control {{ if $imageErr }}is-invalid{{ end }}" name="title" 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">URL</label>
- <div class="col-sm-10">
- {{ $urlErr := index .errors "ArticleForm.URL" }}
- <input type="text" class="form-control {{ 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">Дата публикации</label>
- <div class="col-sm-10">
- {{ $dateErr := index .errors "ArticleForm.PublishTime" }}
- <input type="date" class="form-control col-auto {{ 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">Краткий текст</label>
- <div class="col-sm-10">
- {{ $ptErr := index .errors "ArticleForm.PreviewText" }}
- <textarea id="editor-preview" class="form-control {{ if $ptErr }}is-invalid{{ end }}" name="preview_text">{{ .form.PreviewText }}</textarea>
- {{ if $ptErr }}
- <div class="invalid-feedback">
- {{ $ptErr }}
- </div>
- {{ end }}
- </div>
- </div>
- <div class="row mb-3 mt-3">
- <label class="col-sm-2 col-form-label">Текст</label>
- <div class="col-sm-10">
- {{ $tErr := index .errors "ArticleForm.Text" }}
- <textarea id="editor-text" class="form-control {{ if $tErr }}is-invalid{{ end }}" name="text">{{ .form.Text }}</textarea>
- {{ if $tErr }}
- <div class="invalid-feedback">
- {{ $tErr }}
- </div>
- {{ end }}
- </div>
- </div>
- <div class="row mb-3 mt-3">
- <label class="col-sm-2 col-form-label">Meta keywords</label>
- <div class="col-sm-10">
- {{ $mkErr := index .errors "ArticleForm.MetaKeywords" }}
- <input type="text" class="form-control {{ 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">Meta description</label>
- <div class="col-sm-10">
- {{ $mdErr := index .errors "ArticleForm.MetaDescription" }}
- <input type="text" class="form-control {{ 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">Теги</label>
- <div class="col-sm-10">
- {{ $tags := .form.Tags }}
- {{ range .tags }}
- <div class="form-check">
- <input class="form-check-input" type="checkbox" name="tag{{ .ID }}" {{ if index $tags .ID }}checked{{ end }}>
- <label class="form-check-label">
- {{ .Tag }}
- </label>
- </div>
- {{ end }}
- </div>
- </div>
- <a href="/admin" class="btn btn-secondary">Назад</a>
- <button type="submit" class="btn btn-primary">Сохранить</button>
- </form>
- </main>
|