1 {% extends
"base.html" %}
3 {% block title %}{% if page %}{{ _(
"Edit %s") % page.title }}{% else %}{{ _(
"Create A New Page") }}{% end %}{% end block %}
6 {% set help = backend.wiki.get_page(
"/wiki/edit") %}
14 <div class=
"card mb-4">
15 <div class=
"card-body">
16 <h4 class=
"card-title">
17 {% if page %}{{ _(
"Edit %s") % page.title }}{% else %}{{ _(
"Create A New Page") }}{% end %}
20 <form action=
"" method=
"POST">
21 {% raw xsrf_form_html() %}
23 <div class=
"form-group editor">
24 <div class=
"btn-toolbar mb-3" role=
"toolbar">
25 <div class=
"btn-group btn-group-sm mr-2" role=
"group">
26 <button type=
"button" class=
"btn btn-secondary"
27 id=
"bold" title=
"{{ _("Bold
") }} [{{ _("Ctrl
") }}-B]">
28 <i class=
"fas fa-bold"></i>
30 <button type=
"button" class=
"btn btn-secondary"
31 id=
"italic" title=
"{{ _("Italic
") }} [{{ _("Ctrl
") }}-I]">
32 <i class=
"fas fa-italic"></i>
34 <button type=
"button" class=
"btn btn-secondary"
35 id=
"code" title=
"{{ _("Code
") }} [{{ _("Ctrl
") }}-C]">
36 <i class=
"fas fa-code"></i>
40 <div class=
"btn-group btn-group-sm mr-2" role=
"group">
41 <button type=
"button" class=
"btn btn-secondary"
42 id=
"headline-up" title=
"{{ _("Headline one level up
") }}">
43 <i class=
"fas fa-chevron-left"></i>
45 <button type=
"button" class=
"btn btn-secondary"
46 id=
"headline" title=
"{{ _("Headline
") }} [{{ _("Ctrl
") }}-H]">
47 <i class=
"fas fa-heading"></i>
49 <button type=
"button" class=
"btn btn-secondary"
50 id=
"headline-down" title=
"{{ _("Headline one level down
") }}">
51 <i class=
"fas fa-chevron-right"></i>
55 <a class=
"btn btn-sm btn-secondary" href=
"{{ path }}/_files"
56 target=
"_blank" title=
"{{ _("Files
") }}">
57 <i class=
"fas fa-images"></i>
61 <textarea class=
"form-control" rows=
"16" name=
"content" id=
"content" placeholder=
"{{ _("Text
") }}"
62 >{% if page and page.markdown %}{{ page.markdown }}{% end %}
</textarea>
65 <div class=
"form-group row">
66 <label class=
"col-sm-4 col-form-label">{{ _(
"What has changed?") }}
</label>
67 <div class=
"col-sm-8">
68 <input type=
"text" class=
"form-control" name=
"changes" required
>
72 {% if page and not page.is_watched_by(current_user) %}
73 <div class=
"form-group form-check">
74 <div class=
"custom-control custom-checkbox">
75 <input type=
"checkbox" class=
"custom-control-input" name=
"watch" id=
"watch" checked
>
76 <label class=
"custom-control-label" for=
"watch">{{ _(
"Watch this page") }}
</label>
79 <small class=
"form-text text-muted">
80 {{ _(
"Get notified when this page is changed") }}
85 <button type=
"submit" class=
"btn btn-primary btn-block">
86 {% if page %}{{ _(
"Save Page") }}{% else %}{{ _(
"Create Page") }}{% end %}
92 <div id=
"preview" class=
"fade show">
93 <div class=
"d-flex align-items-center mb-4">
94 <h4 class=
"mb-0">{{ _(
"Preview") }}
</h4>
95 <div id=
"spinner" class=
"spinner-border ml-auto" role=
"status" aria-hidden=
"true"></div>
99 <div class=
"card-body mb-0">
100 <div id=
"preview-content" class=
"wiki-content mb-0">
101 {{ _(
"Loading...") }}
108 {% block javascript %}
111 <script src=
"{{ static_url("js/editor.js
") }}"></script>
112 <script type=
"text/javascript">
115 $(document).ready(function() {
116 var preview = $(
"#preview");
119 $(
"#content").on(
"keyup", function(e) {
121 clearTimeout(update);
123 var content = $(this).val();
125 // If the field is all empty, we will hide it
131 // Go into update mode
132 preview.addClass(
"updating");
134 update = setTimeout(function() {
135 var c = $(
"#preview-content");
137 $.post(
"{{ os.path.join(path, "_render
") }}", { content : content },
142 preview.removeClass(
"updating");