]> git.ipfire.org Git - people/shoehn/ipfire.org.git/blame - templates/admin-planet-compose.html
Fix planet composing form.
[people/shoehn/ipfire.org.git] / templates / admin-planet-compose.html
CommitLineData
feb02477
MT
1{% extends "admin-base.html" %}
2
8876f3df
MT
3{% block body %}
4 <div class="page-header">
5 <h2>{{ _("Compose new entry") }}</h2>
feb02477
MT
6 </div>
7
8876f3df
MT
8 <form class="form-horizontal" action="" method="POST" name="entry">
9 {% raw xsrf_form_html() %}
10
67ab72b8 11 {% if entry %}
8876f3df
MT
12 <input type="hidden" name="id" value="{{ entry.id }}">
13 {% end %}
14
c9275d4e
MT
15 <div class="form-group">
16 <label class="control-label col-sm-2" for="inputTitle">{{ _("Title") }}</label>
17 <div class="col-sm-10">
18 <input class="form-control" type="text" name="title" id="inputTitle"
67ab72b8 19 {% if entry %}value="{{ entry.title }}"{% end %} placeholder="{{ _("Title") }}">
8876f3df
MT
20 </div>
21 </div>
22
c9275d4e
MT
23 <div class="form-group">
24 <div class="col-sm-10 col-sm-offset-2">
25 <textarea class="form-control" name="markdown" rows="12" id="inputMarkdown"
67ab72b8 26 placeholder="{{ _("Content") }}">{% if entry %}{{ entry.markdown }}{% end %}</textarea>
8876f3df
MT
27 </div>
28 </div>
29
30 <hr>
31
c9275d4e
MT
32 <div class="form-group">
33 <label class="control-label col-sm-2" for="inputTags">{{ _("Tags") }}</label>
34 <div class="col-sm-10">
35 <input class="form-control planet-search-autocomplete" type="text"
67ab72b8 36 name="tags" id="inputTags" {% if entry %}value="{{ " ".join(entry.tags) }}"{% end %}
8876f3df
MT
37 placeholder="{{ _("Tags") }}" autocomplete="off">
38 </div>
39 </div>
67ab72b8 40
c9275d4e
MT
41 <div class="form-group">
42 <label class="control-label col-sm-2">{{ _("Status") }}</label>
43 <div class="col-sm-10">
67ab72b8 44 <label class="radio inline">
864437e2 45 <input type="radio" name="status" value="draft" {% if not entry or not entry.is_published() %}checked{% end %}>
67ab72b8
MT
46 {{ _("Draft") }}
47 </label>
48 <label class="radio inline">
864437e2 49 <input type="radio" name="status" value="published" {% if entry and entry.is_published() %}checked{% end %}>
67ab72b8
MT
50 {{ _("Published") }}
51 </label>
52 </div>
53 </div>
54
c9275d4e
MT
55 <hr>
56
57 <div class="col-sm-10 col-sm-offset-2">
8876f3df 58 <button type="submit" class="btn btn-primary">{{ _("Save") }}</button>
c9275d4e
MT
59 <a class="btn btn-default" href="javascript:preview();">{{ _("Preview") }}</a>
60 <a class="btn btn-default" href="/planet">{{ _("Cancel") }}</a>
8876f3df
MT
61 </div>
62 </form>
63
c9275d4e
MT
64 <br class="separator">
65
feb02477 66 <div id="preview"></div>
feb02477 67
feb02477
MT
68 <script type="text/javascript">
69 preview = function() {
8876f3df 70 $.postJSON("/api/planet/render", { text : $("#inputMarkdown").val() },
feb02477 71 function(data) {
0e824faf 72 $("#preview").html(data.html);
feb02477
MT
73 }
74 );
75 }
76 </script>
77{% end block %}