X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/b8f3a2323d03384198863e35d6467a8624a2e31a..f5c1e79ec01e145eb7dfac489e4fa719d069a567:/forum/skins/default/templates/question.html diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html index 0a75aba..9eff07c 100644 --- a/forum/skins/default/templates/question.html +++ b/forum/skins/default/templates/question.html @@ -3,16 +3,21 @@ {% load node_tags %} {% load extra_tags %} {% load extra_filters %} +{% load general_sidebar_tags %} {% load smart_if %} {% load humanize %} {% load i18n %} {% load cache %} +{% block metadescription %}{{ question.meta_description }}{% endblock %} +{% block metakeywords %}{{question.tagname_meta_generator}}{% endblock %} +{% block meta %} + + +{% endblock %} {% block title %}{% spaceless %}{{ question.headline }}{% endspaceless %}{% endblock %} {% block forejs %} - - - - {% if not question.closed %} + {% if not question.nis.closed %} + @@ -22,10 +27,49 @@ $().ready(function(){ $("#nav_questions").attr('className',"on"); var answer_sort_tab = "{{ tab_id }}"; - $("#" + answer_sort_tab).attr('className',"on"); + + if (answer_sort_tab) { + $("#" + answer_sort_tab).attr('className',"on"); + } $('#editor').TextAreaResizer(); + + //toggle preview of editor + var display = true; + var txt = "[{% trans "hide preview" %}]"; + $('#pre-collapse').text(txt); + $('#pre-collapse').bind('click', function(){ + txt = display ? "[{% trans "show preview" %}]" : "[{% trans "hide preview" %}]"; + display = !display; + $('#previewer').toggle(); + $('#pre-collapse').text(txt); + }); }); + + 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($("textarea#editor")[0].value != "") { + return yourWorkWillBeLost(e); + } + + var commentBoxes = $("textarea.commentBox"); + for(var index = 0; index < commentBoxes.length; index++) { + if(commentBoxes[index].value != "") { + return yourWorkWillBeLost(e); + } + } + } + window.addEventListener('beforeunload', beforeUnload, true);