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 <link rel="stylesheet" type="text/css" href="{% media "/media/js/wmd/wmd.css" %}" />
10 <script type="text/javascript">
13 $("#nav_questions").attr('className',"on");
14 $('#editor').TextAreaResizer();
17 //toggle preview of editor
19 var txt = "{% trans "hide preview" %}";
20 $('#pre-collapse').text(txt);
21 $('#pre-collapse').bind('click', function(){
22 txt = display ? "{% trans "show preview" %}" : "{% trans "hide preview" %}";
24 $('#previewer').toggle();
25 $('#pre-collapse').text(txt);
29 $('#id_revision').unbind().change(function(){
30 $("#select_revision").click();
34 answer = $("textarea#editor")[0].value;
38 function submitClicked(e) {
40 $("input.submit")[0].disabled=true;
41 $("input.submit")[1].disabled=true;
43 window.removeEventListener('beforeunload', beforeUnload, true);
46 function beforeUnload(e) {
47 var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
48 if($("textarea#editor")[0].value != answer) {
50 return "You sure you want to leave? Your work will be lost.";
52 yourWorkWillBeLost(e);
57 window.addEventListener('beforeunload', beforeUnload, true);
61 var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
66 <div id="main-bar" class="headNormal">
67 {% trans "Edit answer" %} [<a href="{{ answer.question.get_absolute_url }}#{{ answer.id }}">{% trans "back" %}</a>]
69 <div id="main-body" class="ask-body">
71 <form id="fmedit" action="{% url edit_answer answer.id %}" method="post" >
72 <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br/>
73 {% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
75 {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision" value="{% trans "select revision" %}">
77 <div class="form-item">
78 <div id="wmd-button-bar" class="wmd-panel"></div>
80 <span class="form-error"></span>
81 <div class="preview-toggle"><span id="pre-collapse"
82 title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
83 {% if settings.WIKI_ON %}
84 <div style="float:right;">
85 {{ form.wiki }} <span style="color:#000;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
89 <div id="previewer" class="wmd-preview"></div>
92 <strong>{{ form.summary.label_tag }}</strong> <br/>
93 {{ form.summary }} {{ form.summary.errors }}
94 <div class="title-desc">
95 {{ form.summary.help_text }}
97 <input type="submit" value="{% trans "Save edit" %}" class="submit" onclick="submitClicked(event)" />
98 <input type="button" value="{% trans "Cancel" %}" class="submit" onclick="history.back(-1);submitClicked(event)" />
105 {% include "answer_edit_tips.html" %}
110 <!-- end template answer_edit.html -->