X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/f72b9230d9bb36b1bd752df22ef9a25136b972d1..9b59b6bb395208c913ce5ce19212dd5341cfa98a:/forum/skins/default/templates/question.html
diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html
index 47e654a..efc5f5e 100644
--- a/forum/skins/default/templates/question.html
+++ b/forum/skins/default/templates/question.html
@@ -3,16 +3,18 @@
{% 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.summary}}{% endblock %}
+{% block metakeywords %}{{question.tagname_meta_generator}}{% endblock %}
{% block title %}{% spaceless %}{{ question.headline }}{% endspaceless %}{% endblock %}
{% block forejs %}
-
-
- {% if not question.closed %}
+
+ {% if not question.nis.closed %}
@@ -22,10 +24,13 @@
$().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" %}]";
@@ -36,7 +41,24 @@
$('#previewer').toggle();
$('#pre-collapse').text(txt);
});
+
});
+
+ function beforeUnload(e) {
+ if($("textarea#editor")[0].value != "") {
+ yourWorkWillBeLost(e);
+ }
+
+ $("textarea.commentBox").each(function() {
+ if(this.value != "") {
+ yourWorkWillBeLost(e);
+ }
+ });
+
+ return false;
+ }
+ window.addEventListener('beforeunload', beforeUnload, true);
+