]> git.ipfire.org Git - ipfire.org.git/blob - src/templates/blog/publish.html
CSS: Replace btn-block with buttons wrapped in d-grid
[ipfire.org.git] / src / templates / blog / publish.html
1 {% extends "base.html" %}
2
3 {% block title %}{{ _("Publish %s") % post.title }}{% end block %}
4
5 {% block modal %}
6 <div class="card">
7 <div class="card-body">
8 <h5 class="card-title mb-1">{{ _("Publish Post") }}</h5>
9 <h6 class="card-subtitle text-muted mb-3">{{ post.title }}</h6>
10
11 <form action="" method="POST">
12 {% raw xsrf_form_html() %}
13
14 <input type="hidden" name="when">
15
16 <div class="mb-3">
17 <label class="form-label">{{ _("Time to Publish") }}</label>
18
19 <input type="datetime-local" class="form-control"
20 pattern="[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}" required>
21 </div>
22
23 <div class="d-grid gap-2">
24 <button type="submit" class="btn btn-primary">{{ _("Publish") }}</button>
25 <a class="btn btn-secondary" href="/post/{{ post.slug }}">{{ _("Cancel") }}</a>
26 </div>
27 </form>
28 </div>
29 </div>
30 {% end block %}
31
32 {% block javascript %}
33 <script type="text/javascript">
34 $(document).ready(function() {
35 var when = $("input[name='when']");
36
37 $("input[type='datetime-local']").on("change keyup", function(event) {
38 var value = $(this).val();
39
40 // Parse date and format with timezone
41 if (value) {
42 var date = new Date(value);
43 value = date.toISOString();
44 }
45
46 when.val(value);
47 }).change();
48 });
49 </script>
50 {% end %}