Show alert log count in dimp
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 2 Feb 2010 08:07:55 +0000 (01:07 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 2 Feb 2010 08:07:55 +0000 (01:07 -0700)
imp/js/DimpBase.js

index 4c7e140..2b3ef01 100644 (file)
@@ -1682,6 +1682,13 @@ var DimpBase = {
         }
     },
 
+    /* Growler handler */
+    alertsloglinkUpdate: function()
+    {
+        var lsize = DimpCore.Growler.logSize();
+        $('alertsloglink').down('A').update((DimpCore.Growler.logVisible() ? DIMP.text.hidealog : DIMP.text.showalog) + (lsize ? (' (' + DimpCore.Growler.logSize() + ')') : ''));
+    },
+
     /* Keydown event handler */
     keydownHandler: function(e)
     {
@@ -1965,7 +1972,8 @@ var DimpBase = {
                 return;
 
             case 'alertsloglink':
-                $('alertsloglink').down('A').update(DimpCore.Growler.toggleLog() ? DIMP.text.hidealog : DIMP.text.showalog);
+                DimpCore.Growler.toggleLog();
+                this.alertsloglinkUpdate();
                 break;
 
             case 'applyfilterlink':
@@ -3147,10 +3155,13 @@ DimpCore.onDoActionComplete = function(r) {
 /* Click handler. */
 DimpCore.clickHandler = DimpCore.clickHandler.wrap(DimpBase.clickHandler.bind(DimpBase));
 
-/* ContextSensitive functions. */
+/* ContextSensitive handlers. */
 DimpCore.contextOnClick = DimpCore.contextOnClick.wrap(DimpBase.contextOnClick.bind(DimpBase));
 DimpCore.contextOnShow = DimpCore.contextOnShow.wrap(DimpBase.contextOnShow.bind(DimpBase));
 
+/* Growler listener. */
+document.observe('Growler:created', DimpBase.alertsloglinkUpdate.bind(DimpBase));
+
 /* Extend AJAX exception handling. */
 DimpCore.doActionOpts.onException = DimpCore.doActionOpts.onException.wrap(DimpBase.onAjaxException.bind(DimpBase));