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>
36 <div class=
"btn-group btn-group-sm mr-2" role=
"group">
37 <button type=
"button" class=
"btn btn-secondary"
38 id=
"headline-up" title=
"{{ _("Headline one level up
") }}">
39 <i class=
"fas fa-chevron-left"></i>
41 <button type=
"button" class=
"btn btn-secondary"
42 id=
"headline" title=
"{{ _("Headline
") }} [{{ _("Ctrl
") }}-H]">
43 <i class=
"fas fa-heading"></i>
45 <button type=
"button" class=
"btn btn-secondary"
46 id=
"headline-down" title=
"{{ _("Headline one level down
") }}">
47 <i class=
"fas fa-chevron-right"></i>
51 <a class=
"btn btn-sm btn-secondary" href=
"{{ path }}/_files"
52 target=
"_blank" title=
"{{ _("Files
") }}">
53 <i class=
"fas fa-images"></i>
57 <textarea class=
"form-control" rows=
"16" name=
"content" id=
"content" placeholder=
"{{ _("Text
") }}"
58 >{% if page and page.markdown %}{{ page.markdown }}{% end %}
</textarea>
61 <div class=
"form-group row">
62 <label class=
"col-sm-4 col-form-label">{{ _(
"What has changed?") }}
</label>
63 <div class=
"col-sm-8">
64 <input type=
"text" class=
"form-control" name=
"changes" required
>
68 {% if page and not page.is_watched_by(current_user) %}
69 <div class=
"form-group form-check">
70 <div class=
"custom-control custom-checkbox">
71 <input type=
"checkbox" class=
"custom-control-input" name=
"watch" id=
"watch" checked
>
72 <label class=
"custom-control-label" for=
"watch">{{ _(
"Watch this page") }}
</label>
75 <small class=
"form-text text-muted">
76 {{ _(
"Get notified when this page is changed") }}
81 <button type=
"submit" class=
"btn btn-primary btn-block">
82 {% if page %}{{ _(
"Save Page") }}{% else %}{{ _(
"Create Page") }}{% end %}
88 <div id=
"preview" class=
"fade show">
89 <div class=
"d-flex align-items-center mb-4">
90 <h4 class=
"mb-0">{{ _(
"Preview") }}
</h4>
91 <div id=
"spinner" class=
"spinner-border ml-auto" role=
"status" aria-hidden=
"true"></div>
95 <div class=
"card-body mb-0">
96 <div id=
"preview-content" class=
"wiki-content mb-0">
104 {% block javascript %}
107 <script src=
"{{ static_url("js/editor.js
") }}"></script>
108 <script type=
"text/javascript">
111 $(document).ready(function() {
112 var preview = $(
"#preview");
115 $(
"#content").on(
"keyup", function(e) {
117 clearTimeout(update);
119 var content = $(this).val();
121 // If the field is all empty, we will hide it
127 // Go into update mode
128 preview.addClass(
"updating");
130 update = setTimeout(function() {
131 var c = $(
"#preview-content");
133 $.post(
"{{ os.path.join(path, "_render
") }}", { content : content },
138 preview.removeClass(
"updating");