]>
Commit | Line | Data |
---|---|---|
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 | ||
15 | <div class="control-group"> | |
16 | <label class="control-label" for="inputTitle">{{ _("Title") }}</label> | |
17 | <div class="controls"> | |
18 | <input class="input-block-level" type="text" name="title" id="inputTitle" | |
67ab72b8 | 19 | {% if entry %}value="{{ entry.title }}"{% end %} placeholder="{{ _("Title") }}"> |
8876f3df MT |
20 | </div> |
21 | </div> | |
22 | ||
23 | <div class="control-group"> | |
24 | <div class="controls"> | |
25 | <textarea class="input-block-level" 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 | ||
32 | <div class="control-group"> | |
33 | <label class="control-label" for="inputTags">{{ _("Tags") }}</label> | |
34 | <div class="controls"> | |
35 | <input class="input-block-level 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 MT |
40 | |
41 | <hr> | |
42 | ||
43 | <div class="control-group"> | |
864437e2 | 44 | <label class="control-label">{{ _("Status") }}</label> |
67ab72b8 MT |
45 | <div class="controls"> |
46 | <label class="radio inline"> | |
864437e2 | 47 | <input type="radio" name="status" value="draft" {% if not entry or not entry.is_published() %}checked{% end %}> |
67ab72b8 MT |
48 | {{ _("Draft") }} |
49 | </label> | |
50 | <label class="radio inline"> | |
864437e2 | 51 | <input type="radio" name="status" value="published" {% if entry and entry.is_published() %}checked{% end %}> |
67ab72b8 MT |
52 | {{ _("Published") }} |
53 | </label> | |
54 | </div> | |
55 | </div> | |
56 | ||
8876f3df MT |
57 | <div class="form-actions"> |
58 | <button type="submit" class="btn btn-primary">{{ _("Save") }}</button> | |
59 | <a class="btn" href="javascript:preview();">{{ _("Preview") }}</a> | |
60 | <a class="btn" href="/planet">{{ _("Cancel") }}</a> | |
61 | </div> | |
62 | </form> | |
63 | ||
feb02477 | 64 | <div id="preview"></div> |
feb02477 | 65 | |
feb02477 MT |
66 | <script type="text/javascript"> |
67 | preview = function() { | |
8876f3df | 68 | $.postJSON("/api/planet/render", { text : $("#inputMarkdown").val() }, |
feb02477 | 69 | function(data) { |
0e824faf | 70 | $("#preview").html(data.html); |
feb02477 MT |
71 | } |
72 | ); | |
73 | } | |
74 | </script> | |
75 | {% end block %} |