21 if (nb_removed == 0) { |
21 if (nb_removed == 0) { |
22 $('#edit_form').submit(); |
22 $('#edit_form').submit(); |
23 } |
23 } |
24 else { |
24 else { |
25 var message = ngettext( |
25 var message = ngettext( |
26 '%(nb_comments)s comment will be removed because the text it applies to has been changed.', |
26 '%(nb_comments)s comment applies to text that was modified.', |
27 '%(nb_comments)s comments will be removed because the text they apply to has been changed.', |
27 '%(nb_comments)s comments apply to text that was modified.', |
28 nb_removed) ; |
28 nb_removed) ; |
29 message += '<br />' ; |
29 message += '<br />' ; |
30 message += gettext( 'Do you want to continue?') ; |
30 message += gettext( 'Should comments be kept with no scope or entirely removed from new version?') ; |
31 message = interpolate(message,{'nb_comments':nb_removed}, true) ; |
31 message = interpolate(message,{'nb_comments':nb_removed}, true) ; |
32 |
32 |
33 $('#check_save_dialog').html(message) ; |
33 $('#remove_scope_choice_dlg').html(message) ; |
34 $('#check_save_dialog').dialog('open') ; |
34 $('#remove_scope_choice_dlg').dialog('open') ; |
35 } |
35 } |
36 } |
36 } |
37 else { |
37 else { |
38 if (nb_removed == 0) { |
38 if (nb_removed == 0) { |
39 $('#edit_form').submit(); |
39 $('#edit_form').submit(); |
40 } |
40 } |
41 else { |
41 else { |
42 var message = ngettext( |
42 var message = ngettext( |
43 '%(nb_comments)s comment will be lost because the text it applies to has been changed.', |
43 '%(nb_comments)s comment applies to text that was modified.', |
44 '%(nb_comments)s comments will be lost because the text they apply to has been changed.', |
44 '%(nb_comments)s comments apply to text that was modified.', |
45 nb_removed) ; |
45 nb_removed) ; |
46 message += '<br />' ; |
46 message += '<br />' ; |
47 message += gettext( '(We suggest you create a new version)') ; |
47 message += gettext( '(We suggest you create a new version)') ; |
48 message += '<br />' ; |
48 message += '<br />' ; |
49 message += gettext( 'Do you want to continue?') ; |
49 message += gettext( 'Should comments be kept with no scope or entirely removed?') ; |
50 message = interpolate(message,{'nb_comments':nb_removed}, true) ; |
50 message = interpolate(message,{'nb_comments':nb_removed}, true) ; |
51 |
51 |
52 $('#check_save_dialog').html(message) ; |
52 $('#remove_scope_choice_dlg').html(message) ; |
53 $('#check_save_dialog').dialog('open') ; |
53 $('#remove_scope_choice_dlg').dialog('open') ; |
54 } |
54 } |
55 } |
55 } |
56 }, |
56 }, |
57 error: function(msg){ |
57 error: function(msg){ |
58 alert("error: " + msg); |
58 alert("error: " + msg); |
59 } |
59 } |
60 }); |
60 }); |
61 } |
61 } |
62 else { |
62 else { |
63 if (!newVersion) { |
63 if (!newVersion) { |
64 var message = gettext("Since you chose not to create a new version all comments will be deleted") ; |
64 var message = gettext("You chose not to create a new version all comments will be deleted") ; |
65 message += '<br />' ; |
65 message += '<br />' ; |
66 message += gettext( 'Do you want to continue?') ; |
66 message += gettext( 'Do you want to continue?') ; |
67 $('#check_save_dialog').html(message) ; |
67 $('#confirm_all_removed').html(message) ; |
68 $('#check_save_dialog').dialog('open') ; |
68 $('#confirm_all_removed').dialog('open') ; |
69 } |
69 } |
70 else { |
70 else { |
71 $('#edit_form').submit(); |
71 $('#edit_form').submit(); |
72 } |
72 } |
73 } |
73 } |
76 $(function() { |
76 $(function() { |
77 var buttons = {}; |
77 var buttons = {}; |
78 buttons[gettext('No')] = function() {$(this).dialog('close');} ; |
78 buttons[gettext('No')] = function() {$(this).dialog('close');} ; |
79 buttons[gettext('Yes')] = function() {$(this).dialog('close');$('#edit_form').submit();} ; |
79 buttons[gettext('Yes')] = function() {$(this).dialog('close');$('#edit_form').submit();} ; |
80 |
80 |
81 $('#check_save_dialog').dialog({ |
81 $('#confirm_all_removed').dialog({ |
82 bgiframe: true, |
82 bgiframe: true, |
83 autoOpen: false, |
83 autoOpen: false, |
84 title :gettext('Warning'), |
84 title :gettext('Warning'), |
85 modal: true, |
85 modal: true, |
86 buttons:buttons |
86 buttons:buttons |
87 }) ; |
87 }) ; |
88 |
88 |
|
89 var buttons0 = {}; |
|
90 buttons0[gettext('Detach')] = function() {$(this).dialog('close');$('#cancel_modified_scopes').val("1");$('#edit_form').submit();} ; |
|
91 buttons0[gettext('Remove')] = function() {$(this).dialog('close');$('#cancel_modified_scopes').val("0");$('#edit_form').submit();} ; |
|
92 buttons0[gettext('Cancel')] = function() {$(this).dialog('close');} ; |
|
93 |
|
94 $('#remove_scope_choice_dlg').dialog({ |
|
95 bgiframe: true, |
|
96 autoOpen: false, |
|
97 title :gettext('Warning'), |
|
98 modal: true, |
|
99 buttons:buttons0 |
|
100 }) ; |
|
101 |
89 $("#save").click(function() { check_save() ;}) ; |
102 $("#save").click(function() { check_save() ;}) ; |
90 }) ; |
103 }) ; |