blob: 8c3687f1e5b8113e858762328dcdcb1d5dc1ec64 (
plain)
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
|
{% extends "two_column_body.html" %}
{% import "macros.html" as macros %}
<!-- template answer_edit.html -->
{% block title %}{% spaceless %}{% trans %}Edit answer{% endtrans %}{% endspaceless %}{% endblock %}
{% block forestyle %}
<link rel="stylesheet" type="text/css" href="{{"/js/wmd/wmd.css"|media}}" />
{% endblock %}
{% block content %}
<h1 class="section-title">
{% trans %}Edit answer{% endtrans %} [<a href="{{ answer.thread._question_post().get_absolute_url() }}#{{ answer.id }}">{% trans %}back{% endtrans %}</a>]
</h1>
<div id="main-body" class="ask-body">
<form id="fmedit" action="{% url edit_answer answer.id %}" method="post" >{% csrf_token %}
<label for="id_revision" >{% trans %}revision{% endtrans %}:</label> <br/>
{% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul() }}{% endif %}
<div style="vertical-align:middle">
{{ revision_form.revision }} <input type="hidden"
id="select_revision"
name="select_revision"
value="false">
</div>
{{ macros.edit_post(
form,
post_html = revision.text,
editor_type = settings.EDITOR_TYPE
)
}}
{% if settings.WIKI_ON and answer.wiki == False %}
{{ macros.checkbox_in_div(form.wiki) }}
{% endif %}
{% if request.user.is_authenticated() and request.user.can_make_group_private_posts() %}
{{ macros.checkbox_in_div(form.post_privately) }}
{% endif %}
<div class="after-editor">
<input id="edit_post_form_submit_button" type="submit" value="{% trans %}Save edit{% endtrans %}" class="submit" />
<input type="button" value="{% trans %}Cancel{% endtrans %}" class="submit" onclick="history.back(-1);" />
</div>
</form>
</div>
{% endblock %}
{% block sidebar %}
{% include "widgets/answer_edit_tips.html" %}
{% endblock %}
{% block endjs %}
{% include "meta/editor_data.html" %}
<script type='text/javascript' src='{{"/js/editor.js"|media}}'></script>
<script type='text/javascript' src='{{"/js/jquery.validate.min.js"|media}}'></script>
<script type='text/javascript' src='{{"/js/post.js"|media}}'></script>
<script type='text/javascript'>
{% if settings.ENABLE_MATHJAX or settings.MARKUP_CODE_FRIENDLY %}
var codeFriendlyMarkdown = true;
{% else %}
var codeFriendlyMarkdown = false;
{% endif %}
</script>
{% if settings.EDITOR_TYPE == 'markdown' %}
<script type='text/javascript' src='{{"/js/wmd/showdown.js"|media}}'></script>
<script type='text/javascript' src='{{"/js/wmd/wmd.js"|media}}'></script>
{% endif %}
<script type="text/javascript">
$().ready(function(){
$("#nav_questions").attr('className',"on");
$('#editor').TextAreaResizer();
//highlight code synctax when editor has new text
$("#editor").typeWatch({highlight: false, wait: 3000,
captureLength: 5, callback: lanai.highlightSyntax});
//toggle preview of editor
var display = true;
var txt = "{% trans %}hide preview{% endtrans %}";
$('#pre-collapse').text(txt);
$('#pre-collapse').bind('click', function(){
txt = display ? "{% trans %}show preview{% endtrans %}" : "{% trans %}hide preview{% endtrans %}";
display = !display;
$('#previewer').toggle();
$('#pre-collapse').text(txt);
});
setupFormValidation(
$("#fmedit"),
CPValidator.getAnswerFormRules(),
CPValidator.getAnswerFormMessages()
);
$('#id_revision').unbind().change(function(){
$("#select_revision").val('true');
$('#edit_post_form_submit_button').click();
});
lanai.highlightSyntax();
});
</script>
{% endblock %}
<!-- end template answer_edit.html -->
|