1 {% extends "base.html" %}
2 <!-- question_edit.html -->
5 {% block title %}{% spaceless %}{% trans "Edit question" %}{% 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">
12 //todo move javascript out
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);
29 //Tags autocomplete action
30 $("#id_tags").autocomplete("{% url "matching_tags" %}", {
34 multipleSeparator: " ",
38 /*formatItem: function(row, i, max) {
39 return row.n + " ("+ row.c +")";
41 formatResult: function(row, i, max){
44 formatItem: function(row, i, max, value) {
45 return row[1] + " (" + row[2] + ")";
48 formatResult: function(row, i, max, value){
54 $('#id_revision').unbind().change(function(){
55 $("#select_revision").click();
58 init = $("textarea#editor")[0].value;
60 title = $("input#id_title")[0].value;
61 body = $("textarea#editor")[0].value;
62 tag = $("input#id_tags")[0].value;
65 function submitClicked(e, f) {
66 if(!(browserTester('chrome') || browserTester('safari'))) {
67 $("input.submit")[0].disabled=true;
68 $("input.submit")[1].disabled=true;
70 window.removeEventListener('beforeunload', beforeUnload, true);
76 function beforeUnload(e) {
77 if($("input#id_title")[0].value != title || $("textarea#editor")[0].value != body || $("input#id_tags")[0].value != tag) {
78 return yourWorkWillBeLost(e);
81 window.addEventListener('beforeunload', beforeUnload, true);
91 <div id="main-bar" class="headNormal">
92 {% block edittype %}{% trans "Edit question" %}{% endblock %} [<a href="{{ question.get_absolute_url }}">{% trans "back" %}</a>]
94 <div id="main-body" class="ask-body">
96 <form id="fmedit" action="" method="post">
98 <label for="id_revision" ><strong>{% trans "revision" %}:</strong></label> <br/>
99 {% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
100 <div style="vertical-align:middle">
101 {{ revision_form.revision }} <input type="submit" style="display:none" id="select_revision" name="select_revision"
102 value="{% trans "select revision"%}">
104 <div class="form-item">
105 <label for="id_title" ><strong>{{ form.title.label_tag }}:</strong></label> <span class="form-error"></span><br/>
106 {{ form.title }} {{ form.title.errors }}
107 <div class="title-desc">
108 {{ form.title.help_text }}
111 <div class="form-item">
112 <div id="wmd-button-bar" class="wmd-panel"></div>
114 <span class="form-error"></span>
115 <div class="preview-toggle">
119 <span id="pre-collapse" title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %}</span>
121 <td style="text-align: right;" id="editor-metrics"></td>
122 {% if settings.WIKI_ON %}
123 <td style="text-align:right;">
124 {{ form.wiki }} <span style="color:#000;cursor:help" title="{{form.wiki.help_text}}">{{ form.wiki.label_tag }} </span>
131 <div id="previewer" class="wmd-preview"></div>
133 <div class="form-item">
134 <strong>{{ form.tags.label_tag }}:</strong> <span class="form-error"></span><br/>
135 {{ form.tags }} {{ form.tags.errors }}
136 <div class="title-desc">
137 {{ form.tags.help_text }}
140 <strong>{{ form.summary.label_tag }}</strong> <br/>
141 {{ form.summary }} {{ form.summary.errors }}
142 <div class="title-desc">
143 {{ form.summary.help_text }}
146 {% if form.recaptcha %}
147 <div class="question-captcha" style="float: left">
148 {{ form.recaptcha.errors }}
151 <div class="clear"></div>
154 <div class="error" ></div>
155 <input type="button" value="{% trans "Save edit" %}" class="submit" onclick="submitClicked(event, this.form)" />
156 <input type="button" value="{% trans "Cancel" %}" class="submit" onclick="submitClicked(event, null); history.back(-1);" />
163 {% include "question_edit_tips.html" %}
168 <!-- end question_edit.html -->