From: court Date: Thu, 19 Aug 2010 21:21:49 +0000 (+0000) Subject: hopefully this will clear up all issues concerning the adding/editing of answers... X-Git-Tag: live~574 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/3d2eba570bc4586884cc112b1920a4273b4d11c1 hopefully this will clear up all issues concerning the adding/editing of answers, question and comments. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@560 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/skins/default/media/js/osqa.main.js b/forum/skins/default/media/js/osqa.main.js index 4b07d9b..677b365 100644 --- a/forum/skins/default/media/js/osqa.main.js +++ b/forum/skins/default/media/js/osqa.main.js @@ -1059,7 +1059,7 @@ $(document).ready( function(){ function yourWorkWillBeLost(e) { if(!e) e = window.event; e.cancelBubble = true; - e.returnValue = 'You sure you want to leave? Your work will be lost.'; + e.returnValue = 'If you leave your work will be lost.'; if (e.stopPropagation) { e.stopPropagation(); diff --git a/forum/skins/default/media/js/wmd/wmd.css b/forum/skins/default/media/js/wmd/wmd.css index 057eefd..c71ba6e 100644 --- a/forum/skins/default/media/js/wmd/wmd.css +++ b/forum/skins/default/media/js/wmd/wmd.css @@ -58,8 +58,6 @@ body position: absolute; background-color:#aaaaaa; - /*border-color:#aaaaaa; - border-style:solid;*/ display: inline-block; list-style: none; } diff --git a/forum/skins/default/media/style/style.css b/forum/skins/default/media/style/style.css index 9b844c5..61b8281 100644 --- a/forum/skins/default/media/style/style.css +++ b/forum/skins/default/media/style/style.css @@ -1812,3 +1812,9 @@ div.subscription_tags a:hover { color: #FFFFFF; } +div.wmd-button { + color:white; +} +div.wmd-button-bar { + float:left; +} \ No newline at end of file diff --git a/forum/skins/default/templates/answer_edit.html b/forum/skins/default/templates/answer_edit.html index 66712ac..d7423af 100644 --- a/forum/skins/default/templates/answer_edit.html +++ b/forum/skins/default/templates/answer_edit.html @@ -12,7 +12,8 @@ $().ready(function(){ $("#nav_questions").attr('className',"on"); $('#editor').TextAreaResizer(); - + + //toggle preview of editor var display = true; var txt = "{% trans "hide preview" %}"; @@ -24,20 +25,40 @@ $('#pre-collapse').text(txt); }); - + $('#id_revision').unbind().change(function(){ $("#select_revision").click(); }); + + + answer = $("textarea#editor")[0].value; }); - function beforeUnload(e) { - if($("textarea#editor")[0].value != "") { - yourWorkWillBeLost(e); + + function submitClicked(e) { + if(!is_chrome) { + $("input.submit")[0].disabled=true; + $("input.submit")[1].disabled=true; } + window.removeEventListener('beforeunload', beforeUnload, true); + } - return false; + function beforeUnload(e) { + var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; + if($("textarea#editor")[0].value != answer) { + if(is_chrome) { + return "You sure you want to leave? Your work will be lost."; + } else { + yourWorkWillBeLost(e); + } + return false; + } } window.addEventListener('beforeunload', beforeUnload, true); + + + var answer = ""; + var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; {% endblock %} @@ -73,8 +94,8 @@
{{ form.summary.help_text }}
- - + + diff --git a/forum/skins/default/templates/ask.html b/forum/skins/default/templates/ask.html index 6be8f59..c65bf9f 100644 --- a/forum/skins/default/templates/ask.html +++ b/forum/skins/default/templates/ask.html @@ -58,23 +58,27 @@ } }); + }); + function submitClicked(e) { + if(!is_chrome)$("input.submit")[0].disabled=true; + window.removeEventListener('beforeunload', beforeUnload, true); + } + function beforeUnload(e) { if($("input#id_title")[0].value != "" || $("textarea#editor")[0].value != "" || $("input#id_tags")[0].value != "") { - yourWorkWillBeLost(e); + if(is_chrome) { + return "You sure you want to leave? Your work will be lost."; + } else { + yourWorkWillBeLost(e); + } } return false; } window.addEventListener('beforeunload', beforeUnload, true); - function submitClicked() { - window.removeEventListener('beforeunload', beforeUnload, true); - $("input.submit").each(function() { - this.disabled=true; - }); - } - + var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; var related_questions_url = "{% url related_questions %}"; @@ -140,10 +144,10 @@

{{ form.tags.help_text }}

- {% if not request.user.is_authenticated %} - + {% if not request.user.is_authenticated %} + {% else %} - + {% endif %} diff --git a/forum/skins/default/templates/question.html b/forum/skins/default/templates/question.html index a9a1706..7afcf40 100644 --- a/forum/skins/default/templates/question.html +++ b/forum/skins/default/templates/question.html @@ -41,32 +41,41 @@ $('#previewer').toggle(); $('#pre-collapse').text(txt); }); - }); + function submitClicked(e) { + if(!is_chrome)$("input.submit")[0].disabled=true; + window.removeEventListener('beforeunload', beforeUnload, true); + } + function beforeUnload(e) { + var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; + if($("textarea#editor")[0].value != "") { - yourWorkWillBeLost(e); + if(is_chrome) { + return "You sure you want to leave? Your work will be lost."; + } else { + yourWorkWillBeLost(e); + } + return false; } - $("textarea.commentBox").each(function() { - if(this.value != "") { - yourWorkWillBeLost(e); - } - }); - - return false; + var commentBoxes = $("textarea.commentBox"); + for(var index = 0; index < commentBoxes.length; index++) { + if(commentBoxes[index].value != "") { + if(is_chrome) { + return "You sure you want to leave? Your work will be lost."; + } else { + yourWorkWillBeLost(e); + } + return false; + } + } } window.addEventListener('beforeunload', beforeUnload, true); - function submitClicked() { - window.removeEventListener('beforeunload', beforeUnload, true); - $("input.submit").each(function() { - this.disabled=true; - }); - } - - + var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1; +