1 {% extends "base.html" %}
2 <!-- template answer_edit.html -->
5 {% block title %}{% spaceless %}{% trans "Edit answer" %}{% endspaceless %}{% endblock %}
7 <script type='text/javascript' src='{% media "/media/js/com.cnprog.editor.js" %}'></script>
8 <script type='text/javascript' src='{% media "/media/js/com.cnprog.post.js" %}'></script>
9 <script type='text/javascript' src='{% media "/media/js/jquery.validate.pack.js" %}'></script>
10 <script type='text/javascript' src='{% media "/media/js/wmd/showdown.js" %}'></script>
11 <script type='text/javascript' src='{% media "/media/js/wmd/wmd.js" %}'></script>
12 <link rel="stylesheet" type="text/css" href="{% media "/media/js/wmd/wmd.css" %}" />
13 <script type="text/javascript">
16 $("#nav_questions").attr('className',"on");
17 $('#editor').TextAreaResizer();
19 //highlight code synctax when editor has new text
20 $("#editor").typeWatch({highlight: false, wait: 3000,
21 captureLength: 5, callback: lanai.highlightSyntax});
23 //toggle preview of editor
25 var txt = "{% trans "hide preview" %}";
26 $('#pre-collapse').text(txt);
27 $('#pre-collapse').bind('click', function(){
28 txt = display ? "{% trans "show preview" %}" : "{% trans "hide preview" %}";
30 $('#previewer').toggle();
31 $('#pre-collapse').text(txt);
34 setupFormValidation("#fmedit", CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages());
36 $('#id_revision').unbind().change(function(){
37 $("#select_revision").click();
40 lanai.highlightSyntax();
47 <div id="main-bar" class="headNormal">
48 {% trans "Edit answer" %} [<a href="{{ answer.question.get_absolute_url }}#{{ answer.id }}">{% trans "back" %}</a>]
50 <div id="main-body" class="ask-body">
52 <form id="fmedit" action="{% url edit_answer answer.id %}" method="post" >
53 <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br/>
54 {% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
55 <div style="vertical-align:middle">
56 {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision" value="{% trans "select revision" %}">
58 <div class="form-item">
59 <div id="wmd-button-bar" class="wmd-panel"></div>
61 <span class="form-error"></span>
62 <div class="preview-toggle"><span id="pre-collapse"
63 title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span></div>
64 <div id="previewer" class="wmd-preview"></div>
67 <strong>{{ form.summary.label_tag }}</strong> <br/>
68 {{ form.summary }} {{ form.summary.errors }}
69 <div class="title-desc">
70 {{ form.summary.help_text }}
72 <input type="submit" value="{% trans "Save edit" %}" class="submit" />
73 <input type="button" value="{% trans "Cancel" %}" class="submit" onclick="history.back(-1);" />
80 {% include "answer_edit_tips.html" %}
85 <!-- end template answer_edit.html -->