comparison messages/static/js/tabbed_messages.js @ 698:efb525863a75

jQuery UI Tabs were changed quite a bit, which broke private messages. Here is a fix. Upgrade notes are found here: http://jqueryui.com/upgrade-guide/1.9/#tabs
author Brian Neal <bgneal@gmail.com>
date Mon, 09 Sep 2013 20:30:13 -0500
parents ad69236e8501
children c09ed90c891b
comparison
equal deleted inserted replaced
694:d84aaf239182 698:efb525863a75
10 } 10 }
11 } 11 }
12 })); 12 }));
13 13
14 $tabs = $('#tabs').tabs({ 14 $tabs = $('#tabs').tabs({
15 selected: initialTab, 15 active: initialTab,
16 select: function(event, ui) { 16 activate: function(event, ui) {
17 $(ui.panel).html(''); 17 $(ui.panel).html('');
18 }, 18 },
19 load: function(event, ui) { 19 load: function(event, ui) {
20 selectedTab = ui; 20 selectedTab = ui;
21 if (ui.index == 1 && receiver && !doReply) 21 if (doReply && ui.tab.index() == 1)
22 {
23 $('#id_receiver').val(receiver);
24 receiver = '';
25 }
26 else if (doReply && ui.index == 1)
27 { 22 {
28 doReply = false; 23 doReply = false;
29 var msg = msgCache[$msgDialog.msgId]; 24 var msg = msgCache[$msgDialog.msgId];
30 $('#id_receiver').val(msg.sender); 25 $('#id_receiver').val(msg.sender);
31 $('#id_subject').val(msg.re_subject); 26 $('#id_subject').val(msg.re_subject);
32 $('#id_message').val(msg.re_content); 27 $('#id_message').val(msg.re_content);
33 $('#msg_compose_form').append('<input type="hidden" name="reply_to" value="' + 28 $('#msg_compose_form').append('<input type="hidden" name="reply_to" value="' +
34 $msgDialog.msgId + '" />'); 29 $msgDialog.msgId + '" />');
35 } 30 }
36 }, 31 },
37 ajaxOptions: { 32 beforeLoad: function(event, ui) {
38 error: function(xhr, status, index, anchor) { 33 ui.jqXHR.error(function(xhr, status, index, anchor) {
39 $(anchor.hash).html( 34 $(anchor.hash).html(
40 "Oops, we couldn't load this tab. We'll try to fix this as soon as possible."); 35 "Oops, we couldn't load this tab. We'll try to fix this as soon as possible.");
41 } 36 });
42 } 37 }
43 }); 38 });
44 $msgDialog = $('#msgDialog').dialog({ 39 $msgDialog = $('#msgDialog').dialog({
45 autoOpen: false, 40 autoOpen: false,
46 width: 460, 41 width: 460,
51 { 46 {
52 text: "Reply", 47 text: "Reply",
53 click: function() { 48 click: function() {
54 doReply = true; 49 doReply = true;
55 $(this).dialog('close'); 50 $(this).dialog('close');
56 $tabs.tabs("select", 1); 51 $tabs.tabs("option", "active", 1);
57 } 52 }
58 }, 53 },
59 { 54 {
60 text: "Close", 55 text: "Close",
61 click: function() { 56 click: function() {
181 url: '/messages/bulk/', 176 url: '/messages/bulk/',
182 type: 'POST', 177 type: 'POST',
183 data: $(form).serialize(), 178 data: $(form).serialize(),
184 dataType: 'text', 179 dataType: 'text',
185 success: function (data, textStatus) { 180 success: function (data, textStatus) {
186 $tabs.tabs("load", selectedTab.index); 181 $tabs.tabs("load", selectedTab.tab.index());
187 }, 182 },
188 error: function (xhr, textStatus, ex) { 183 error: function (xhr, textStatus, ex) {
189 alert('Oops, an error occurred. ' + xhr.statusText + ' - ' + 184 alert('Oops, an error occurred. ' + xhr.statusText + ' - ' +
190 xhr.responseText); 185 xhr.responseText);
191 } 186 }