(re) edit : prevent tab change on cancel message + confirm_all_removed_dlg renamed (bug fix)
--- a/src/cm/media/js/site/text_edit.js Sat Feb 13 12:04:27 2010 +0100
+++ b/src/cm/media/js/site/text_edit.js Sat Feb 13 12:50:06 2010 +0100
@@ -8,7 +8,6 @@
if (commentsKept) {
var pre_edit_url = tb_conf['pre_edit_url'] ;
-
$.ajax({
url: pre_edit_url,
type:'POST',
@@ -18,7 +17,7 @@
nb_removed = obj['nb_removed'];
if (newVersion) {
if (nb_removed == 0) {
- $('#edit_form').submit();
+ submit_edit_form();
}
else {
var message = ngettext(
@@ -35,7 +34,7 @@
}
else {
if (nb_removed == 0) {
- $('#edit_form').submit();
+ submit_edit_form();
}
else {
var message = ngettext(
@@ -68,19 +67,23 @@
$('#confirm_all_removed_dlg').dialog('open') ;
}
else {
- $('#edit_form').submit();
+ submit_edit_form() ;
}
}
}
+function submit_edit_form() {
+ needToConfirm = false;
+ $('#edit_form').submit();
+}
+
$(function() {
var buttons = {};
buttons[gettext('No')] = function() {
$(this).dialog('close');
} ;
buttons[gettext('Yes')] = function() {
- needToConfirm = false;
- $(this).dialog('close');$('#edit_form').submit();
+ $(this).dialog('close');submit_edit_form();
} ;
$('#confirm_all_removed_dlg').dialog({
@@ -92,14 +95,8 @@
}) ;
var buttons0 = {};
- buttons0[gettext('Detach')] = function() {
- needToConfirm = false;
- $(this).dialog('close');$('#cancel_modified_scopes').val("1");$('#edit_form').submit();
- } ;
- buttons0[gettext('Remove')] = function() {
- needToConfirm = false;
- $(this).dialog('close');$('#cancel_modified_scopes').val("0");$('#edit_form').submit();
- } ;
+ buttons0[gettext('Detach')] = function() {$(this).dialog('close');$('#cancel_modified_scopes').val("1");submit_edit_form();} ;
+ buttons0[gettext('Remove')] = function() {$(this).dialog('close');$('#cancel_modified_scopes').val("0");submit_edit_form();} ;
buttons0[gettext('Cancel')] = function() {$(this).dialog('close');} ;
$('#remove_scope_choice_dlg').dialog({
--- a/src/cm/templates/site/macros/text_editor.html Sat Feb 13 12:04:27 2010 +0100
+++ b/src/cm/templates/site/macros/text_editor.html Sat Feb 13 12:50:06 2010 +0100
@@ -12,20 +12,25 @@
myHTMLSettings.previewTemplatePath = "{% url text-wysiwyg-preview "html" %}";
myMarkdownSettings.previewParserPath = "{% url text-wysiwyg-preview "markdown" %}";
+ onMarkitupActions = function() {needToConfirm = true ;} ;
+
+ myHTMLSettings.afterInsert = onMarkitupActions ;
+ myMarkdownSettings.afterInsert = onMarkitupActions ;
+
$(document).ready(function() {
- adaptMarkitup = function() {
- $('#id_content').markItUpRemove();
- var newSet = $('#id_format').val();
- switch(newSet) {
- case 'markdown':
- $('#id_content').markItUp(myMarkdownSettings);
- break;
- case 'html':
- $('#id_content').markItUp(myHTMLSettings);
- break;
- }
- return false;
- }
+ adaptMarkitup = function() {
+ $('#id_content').markItUpRemove();
+ var newSet = $('#id_format').val();
+ switch(newSet) {
+ case 'markdown':
+ $('#id_content').markItUp(myMarkdownSettings);
+ break;
+ case 'html':
+ $('#id_content').markItUp(myHTMLSettings);
+ break;
+ }
+ return false;
+ }
adaptMarkitup();