diff 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
line wrap: on
line diff
--- a/messages/static/js/tabbed_messages.js	Fri Sep 06 21:50:53 2013 -0500
+++ b/messages/static/js/tabbed_messages.js	Mon Sep 09 20:30:13 2013 -0500
@@ -12,18 +12,13 @@
    }));
 
    $tabs = $('#tabs').tabs({
-      selected: initialTab,
-      select: function(event, ui) {
+      active: initialTab,
+      activate: function(event, ui) {
          $(ui.panel).html('');
       },
       load: function(event, ui) {
          selectedTab = ui;
-         if (ui.index == 1 && receiver && !doReply)
-         {
-            $('#id_receiver').val(receiver);
-            receiver = '';
-         }
-         else if (doReply && ui.index == 1)
+         if (doReply && ui.tab.index() == 1)
          {
             doReply = false;
             var msg = msgCache[$msgDialog.msgId];
@@ -34,11 +29,11 @@
                $msgDialog.msgId + '" />');
          }
       },
-      ajaxOptions: {
-         error: function(xhr, status, index, anchor) {
+      beforeLoad: function(event, ui) {
+         ui.jqXHR.error(function(xhr, status, index, anchor) {
             $(anchor.hash).html(
                "Oops, we couldn't load this tab. We'll try to fix this as soon as possible.");
-         }
+         });
       }
    });
    $msgDialog = $('#msgDialog').dialog({
@@ -53,7 +48,7 @@
             click: function() { 
                doReply = true;
                $(this).dialog('close'); 
-               $tabs.tabs("select", 1);
+               $tabs.tabs("option", "active", 1);
             } 
          },
          { 
@@ -183,7 +178,7 @@
          data: $(form).serialize(),
          dataType: 'text',
          success: function (data, textStatus) {
-            $tabs.tabs("load", selectedTab.index);
+            $tabs.tabs("load", selectedTab.tab.index());
          },
          error: function (xhr, textStatus, ex) {
             alert('Oops, an error occurred. ' + xhr.statusText + ' - ' +