X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/a9eef437702d5df7a2f97010e6798c689371808c..508b758ebf7d03317c1f1a14ba6006dd83eedd08:/forum/skins/default/templates/question_edit.html?ds=sidebyside diff --git a/forum/skins/default/templates/question_edit.html b/forum/skins/default/templates/question_edit.html index fe71184..4ee8060 100644 --- a/forum/skins/default/templates/question_edit.html +++ b/forum/skins/default/templates/question_edit.html @@ -4,9 +4,6 @@ {% load extra_tags %} {% block title %}{% spaceless %}{% trans "Edit question" %}{% endspaceless %}{% endblock %} {% block forejs %} - - - @@ -16,10 +13,7 @@ $("#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" %}]"; @@ -32,8 +26,7 @@ }); //Tags autocomplete action - var tags = {{ tags|safe }}; - $("#id_tags").autocomplete(tags, { + $("#id_tags").autocomplete("{% url matching_tags %}", { matchContains: true, max: 20, multiple: true, @@ -41,33 +34,66 @@ highlightItem: true, scroll: true, scrollHeight: 300, - formatItem: function(row, i, max) { + /*formatItem: function(row, i, max) { return row.n + " ("+ row.c +")"; }, formatResult: function(row, i, max){ return row.n; + }*/ + formatItem: function(row, i, max, value) { + return row[1] + " (" + row[2] + ")"; + }, + + formatResult: function(row, i, max, value){ + return row[1]; } - }); - - setupFormValidation("#fmedit", CPValidator.getQuestionFormRules(), CPValidator.getQuestionFormMessages()); - + }); + $('#id_revision').unbind().change(function(){ $("#select_revision").click(); }); - lanai.highlightSyntax(); - + + init = $("textarea#editor")[0].value; + + title = $("input#id_title")[0].value; + body = $("textarea#editor")[0].value; + tag = $("input#id_tags")[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($("input#id_title")[0].value != title || $("textarea#editor")[0].value != body || $("input#id_tags")[0].value != tag) { + return yourWorkWillBeLost(e); + } + } + window.addEventListener('beforeunload', beforeUnload, true); + + var init = ""; + var title = ""; + var body = ""; + var tag = ""; {% endblock %} {% block content %}
- {% trans "Edit question" %} [{% trans "back" %}] + {% block edittype %}{% trans "Edit question" %}{% endblock %} [{% trans "back" %}]
-
+ + {% csrf_token %}
{% if revision_form.revision.errors %}{{ revision_form.revision.errors.as_ul }}{% endif %}
@@ -91,6 +117,7 @@ {% trans "toggle preview" %} + {% if settings.WIKI_ON %} {{ form.wiki }} {{ form.wiki.label_tag }} @@ -114,9 +141,18 @@
{{ form.summary.help_text }}
+ + {% if form.recaptcha %} +
+ {{ form.recaptcha.errors }} + {{ form.recaptcha }} +
+
+ {% endif %} +
- - + +