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/wmd/showdown.js" %}'></script>
8 <script type='text/javascript' src='{% media "/media/js/wmd/wmd.js" %}'></script>
9 <script type='text/javascript' src='{% media "/media/js/html_sanitizer.js" %}'></script>
10 <link rel="stylesheet" type="text/css" href="{% media "/media/js/wmd/wmd.css" %}" />
11 <script type="text/javascript">
14 $("#nav_questions").attr('className',"on");
15 $('#editor').TextAreaResizer();
18 //toggle preview of editor
20 var txt = "{% trans "hide preview" %}";
21 $('#pre-collapse').text(txt);
22 $('#pre-collapse').bind('click', function(){
23 txt = display ? "{% trans "show preview" %}" : "{% trans "hide preview" %}";
25 $('#previewer').toggle();
26 $('#pre-collapse').text(txt);
30 $('#id_revision').unbind().change(function(){
31 $("#select_revision").click();
35 answer = $("textarea#editor")[0].value;
39 function submitClicked(e, f) {
40 if(!(browserTester('chrome') || browserTester('safari'))) {
41 $("input.submit")[0].disabled=true;
42 $("input.submit")[1].disabled=true;
44 window.removeEventListener('beforeunload', beforeUnload, true);
50 function beforeUnload(e) {
51 if($("textarea#editor")[0].value != answer) {
52 return yourWorkWillBeLost(e);
55 window.addEventListener('beforeunload', beforeUnload, true);
62 <div id="main-bar" class="headNormal">
63 {% trans "Edit answer" %} [<a href="{{ answer.question.get_absolute_url }}#{{ answer.id }}">{% trans "back" %}</a>]
65 <div id="main-body" class="ask-body">
67 <form id="fmedit" action="{% url edit_answer answer.id %}" method="post">
69 <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br/>
70 {% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
72 {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision" value="{% trans "select revision" %}">
74 <div class="form-item">
75 <div id="wmd-button-bar" class="wmd-panel"></div>
77 <span class="form-error"></span>
78 <div class="preview-toggle"><span id="pre-collapse"
79 title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
80 <span style="text-align: right; margin-left: 200px;" id="editor-metrics"></span>
81 {% if settings.WIKI_ON %}
82 <div style="float:right;">
83 {{ form.wiki }} <span style="color:#000;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
87 <div id="previewer" class="wmd-preview"></div>
90 <strong>{{ form.summary.label_tag }}</strong> <br/>
91 {{ form.summary }} {{ form.summary.errors }}
92 <div class="title-desc">
93 {{ form.summary.help_text }}
96 {% if form.recaptcha %}
97 <div class="question-captcha">
98 {{ form.recaptcha.errors }}
103 <input type="button" value="{% trans "Save edit" %}" class="submit" onclick="submitClicked(event, this.form)" />
104 <input type="button" value="{% trans "Cancel" %}" class="submit" onclick="submitClicked(event, this.form);history.back(-1);" />
111 {% include "answer_edit_tips.html" %}
116 <!-- end template answer_edit.html -->