Do I want to know why the click handler fires on hitting the return key? No, I
authorJan Schneider <jan@horde.org>
Mon, 7 Sep 2009 13:10:45 +0000 (15:10 +0200)
committerJan Schneider <jan@horde.org>
Mon, 7 Sep 2009 13:10:45 +0000 (15:10 +0200)
don't.
Also, only reset the quick add form if the adding was successful.

kronolith/js/kronolith.js

index b20a46a..b574766 100644 (file)
@@ -1687,9 +1687,9 @@ KronolithCore = {
     /* Keydown event handler */
     keydownHandler: function(e)
     {
-        var kc = e.keyCode || e.charCode;
+        var kc = e.keyCode || e.charCode,
+            form = e.findElement('FORM');
 
-        form = e.findElement('FORM');
         if (form) {
             switch (kc) {
             case Event.KEY_RETURN:
@@ -1703,11 +1703,6 @@ KronolithCore = {
                     this.go('search:' + $F('kronolithSearchContext') + ':' + $F('kronolithSearchTerm'))
                     e.stop();
                     break;
-
-                case 'kronolithQuickinsertForm':
-                    $('kronolithQuickinsert').fade();
-                    this.quickSaveEvent();
-                    break;
                 }
                 break;
 
@@ -1783,7 +1778,6 @@ KronolithCore = {
                 return;
 
             case 'kronolithQuickinsertSave':
-                $('kronolithQuickinsert').fade();
                 this.quickSaveEvent();
                 e.stop();
                 return;
@@ -2116,6 +2110,7 @@ KronolithCore = {
             start = viewDates[0].dateString(),
             end = viewDates[1].dateString();
 
+        $('kronolithQuickinsert').fade();
         this.startLoading(null, start, end);
         this.doAction('QuickSaveEvent',
                       $H({ 'text': text,
@@ -2125,10 +2120,8 @@ KronolithCore = {
                       }),
                       function(r) {
                           this._loadEventsCallback(r);
-                          this._closeRedBox();
+                          $('kronolithQuickinsertQ').value = '';
                       }.bind(this));
-
-        $('kronolithQuickinsertQ').value = '';
     },
 
     _topTags: function(r)