aboutsummaryrefslogtreecommitdiff
path: root/views/new-post.handlebars
blob: 203832639749e7b4d3c83152b43eac552a696b69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<div class="container">
  <h1 class="mt-2">{{ title }}</h1>
  <form action="/new-post" method="post" accept-charset="utf-8">
    <div class="mb-3">
      <label for="post_title" class="form-label">Post title:</label>
      <input name="title" type="text" class="form-control" id="post_title"
        value="{{oldForm.values.title}}" required>
    </div>
    <div class="mb-3">
      <label for="post_text" class="form-label">Post text:</label>
      <textarea name="text" class="form-control" id="post_text"></textarea>
      {{#if oldForm.errors.text}}
        <div class="invalid-feedback d-block">{{oldForm.errors.text}}</div>
      {{/if}}
    </div>
    <button type="submit" class="btn">Submit</button>
  </form>
</div>
<script src="https://cdn.ckeditor.com/ckeditor5/27.1.0/classic/ckeditor.js"></script>
<script>
ClassicEditor
  .create(document.querySelector('#post_text'))
  .catch(error => console.error(error));
</script>