X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/0cf194935edb17d2c9288e4c4e5344a1775bcb5d..3401cb76521d238ddec0e5daed3f63d6e6dee34f:/forum/skins/default/templates/ask.html diff --git a/forum/skins/default/templates/ask.html b/forum/skins/default/templates/ask.html index 5c12c86..3f74b44 100644 --- a/forum/skins/default/templates/ask.html +++ b/forum/skins/default/templates/ask.html @@ -1,7 +1,6 @@ {% extends "base.html" %} -{% load i18n %} -{% load extra_tags %} +{% load i18n extra_tags extra_filters %} {% block title %}{% spaceless %}{% trans "Ask a question" %}{% endspaceless %}{% endblock %} {% block forejs %} @@ -34,29 +33,51 @@ }); //Tags autocomplete action - $("#id_tags").autocomplete("/matching_tags", { + $("#id_tags").autocomplete("/matching_tags/", { minChars: 1, matchContains: true, max: 20, multiple: true, multipleSeparator: " ", - /*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].split(".")[0] + " (" + row[1].split(".")[1] + ")"; + return row[1] + " (" + row[2] + ")"; }, formatResult: function(row, i, max, value){ - return row[0]; + return row[1]; } }); + }); + function submitClicked(e, f) { + if(!(browserTester('chrome') || browserTester('safari'))) { + $("input.submit")[0].disabled=true; + } + window.removeEventListener('beforeunload', beforeUnload, true); + if (f) { + f.submit(); + } + } + + function beforeUnload(e) { + if($("input#id_title")[0].value != "" || $("textarea#editor")[0].value != "" || $("input#id_tags")[0].value != "") { + return yourWorkWillBeLost(e); + } + } + window.addEventListener('beforeunload', beforeUnload, true); + var related_questions_url = "{% url related_questions %}"; @@ -71,18 +92,20 @@