/
edit.html
99 lines (96 loc) · 4.53 KB
/
edit.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
{# vim: set ts=2 et sts=2 sw=2: #}
{% extends "wiki/base.html" %}
{% from "layout/errorlist.html" import errorlist %}
{% from "wiki/includes/sidebar_modules.html" import document_tools with context %}
{% from "includes/common_macros.html" import content_editor with context %}
{% from "wiki/includes/document_macros.html" import edit_messages, submit_revision %}
{% from "wiki/includes/document_macros.html" import document_lock_warning with context %}
{% set title = _('Edit Article | {document}')|f(document=document.title) %}
{# TODO: Change KB url to landing page when we have one #}
{% set crumbs = [(document.get_absolute_url(), document.title),
(None, _('Edit Article'))] %}
{% set classes = 'edit' %}
{% set styles = ('wiki', 'jqueryui/jqueryui') %}
{% set scripts = ('wiki', 'wiki.diff', 'wiki.editor', 'libs/jqueryui') %}
{% block content %}
<div class="grid_9">
{{ edit_messages(document, show_revision_warning) }}
{{ document_lock_warning() }}
<article id="edit-document" {% if locked %}class="locked"{% endif %} data-slug="{{ document.slug }}">
<h1>{{ _('<em>Editing</em> {title}')|fe(title=document.title) }}</h1>
{% if document_form %}
<div id="document-form">
<details class="h2"{% if disclose_description %} open="open"{% endif %}>
<summary>{{ _('Edit Description') }}</summary>
{{ errorlist(document_form) }}
<form action="" method="post" data-json-url="{{ url('wiki.json') }}" data-document-id="{{ document.id }}">
{{ csrf() }}
<ul>
{% for field in document_form.visible_fields() if
(field.name != 'is_localizable' or not document.translations.exists()) %}
<li{% if field.name == 'needs_change_comment' %} class="comment"{% endif %}>
{{ field|label_with_help }}{{ field }}
</li>
{% endfor %}
</ul>
{% if document.translations.exists() %}
{{ document_form.is_localizable.as_hidden()|safe }}
{% endif %}
<input type="hidden" name="form" value="doc" />
<div class="submit">
<button class="btn btn-important" type="submit">{{ _('Save description') }}</button>
</div>
</form>
</details>
</div>
{% endif %}
{% if revision_form %}
<div id="revision-form">
<details class="h2" open="open">
<summary>{{ _('Edit Content') }}</summary>
<p>
{% trans url=url('wiki.document', 'support-document-guide') %}For help with writing articles, check out the
<a href="{{ url }}">Support Document Guide</a>.{% endtrans %}
</p>
{{ errorlist(revision_form) }}
<form action="" method="post">
{{ csrf() }}
<ul>
{% for field in revision_form.visible_fields() %}
<li>
{% if field.name not in ['comment', 'content'] %}
{% if not field.name == 'keywords' or document.allows(user, 'edit_keywords') %}
{{ field|label_with_help }}{{ field|safe }}
{% endif %}
{% elif field.name == 'content' %}
{{ revision_form.content.label_tag()|safe }}
{{ content_editor(revision_form.content) }}
{% endif %}
{% if field.name == 'summary' %}
<p><span id="remaining-characters">{{ field.field.max_length }}</span> {{_('characters remaining.') }}</p>
{% endif %}
</li>
{% endfor %}
</ul>
{{ revision_form.hidden_fields()|join|safe }}
<input type="hidden" name="form" value="rev" />
{{ submit_revision(revision_form, include_diff=True) }}
<div id="preview"></div>
<div id="preview-diff">
<div class="from">{{ revision_form.content.value() }}</div>
<div class="to"></div>
<div class="output"></div>
</div>
<div class="submit" id="preview-bottom">
{{ submit_revision(revision_form, buttons_only=True, include_diff=True) }}
</div>
</form>
</details>
</div>
{% endif %}
</article>
</div>
{% endblock %}
{% block side_top %}
{{ document_tools(document, document.parent, user, 'edit', settings) }}
{% endblock %}