X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/a9eef437702d5df7a2f97010e6798c689371808c..508b758ebf7d03317c1f1a14ba6006dd83eedd08:/forum/skins/default/templates/answer_edit.html diff --git a/forum/skins/default/templates/answer_edit.html b/forum/skins/default/templates/answer_edit.html index 2d736f3..9409f0d 100644 --- a/forum/skins/default/templates/answer_edit.html +++ b/forum/skins/default/templates/answer_edit.html @@ -4,9 +4,6 @@ {% load extra_tags %} {% block title %}{% spaceless %}{% trans "Edit answer" %}{% endspaceless %}{% endblock %} {% block forejs %} - - - @@ -15,11 +12,8 @@ $().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" %}"; @@ -31,15 +25,35 @@ $('#pre-collapse').text(txt); }); - setupFormValidation("#fmedit", CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages()); - + $('#id_revision').unbind().change(function(){ $("#select_revision").click(); }); - - lanai.highlightSyntax(); - + + + answer = $("textarea#editor")[0].value; }); + + + function submitClicked(e, f) { + if(!(browserTester('chrome') || browserTester('safari'))) { + $("input.submit")[0].disabled=true; + $("input.submit")[1].disabled=true; + } + window.removeEventListener('beforeunload', beforeUnload, true); + if (f) { + f.submit(); + } + } + + function beforeUnload(e) { + if($("textarea#editor")[0].value != answer) { + return yourWorkWillBeLost(e); + } + } + window.addEventListener('beforeunload', beforeUnload, true); + + var answer = ""; {% endblock %} @@ -49,10 +63,11 @@
-
+ + {% csrf_token %}
{% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %} -
+
{{ revision_form.revision }}
@@ -60,7 +75,14 @@ {{ form.text }}
{% trans "toggle preview" %}
+ title="{% trans "Toggle the real time Markdown editor preview" %}">{% trans "toggle preview" %} + + {% if settings.WIKI_ON %} +
+ {{ form.wiki }} {{ form.wiki.label_tag }} +
+ {% endif %} +
@@ -69,8 +91,16 @@
{{ form.summary.help_text }}
- - + + {% if form.recaptcha %} +
+ {{ form.recaptcha.errors }} + {{ form.recaptcha }} +
+ {% endif %} + + +