Implement a click handler to add a tag from the list of the user's
authorMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 24 Mar 2009 23:30:54 +0000 (19:30 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Tue, 24 Mar 2009 23:30:54 +0000 (19:30 -0400)
frequently used tags. May need to be revisited when a tag autocompleter
is added.

kronolith/js/src/kronolith.js

index 01165e5..af87d75 100644 (file)
@@ -877,10 +877,10 @@ KronolithCore = {
                 }
                 if (tmp && tmp.readAttribute('date')) {
                     if (tmp.hasClassName('kronolithMinicalWeek')) {
-                       this.go('week:' + tmp.readAttribute('date'));
-                   } else if (!tmp.hasClassName('empty')) {
-                       this.go('day:' + tmp.readAttribute('date'));
-                   }
+                        this.go('week:' + tmp.readAttribute('date'));
+                    } else if (!tmp.hasClassName('empty')) {
+                        this.go('day:' + tmp.readAttribute('date'));
+                    }
                 }
                 e.stop();
                 return;
@@ -909,6 +909,12 @@ KronolithCore = {
                 return;
             }
 
+            if (elt.hasClassName('eventTopTag')) {
+                etags = $F('kronolithEventTags');
+                $('kronolithEventTags').value = (etags ? etags + ', ' :  '') + elt.getText();
+                return;
+            }
+            
             calClass = elt.readAttribute('calendarclass');
             if (calClass) {
                 var calendar = elt.readAttribute('calendar');
@@ -986,7 +992,7 @@ KronolithCore = {
         }
         $('eventTopTags').update();
         r.response.tags.each(function(tag) {
-            $('eventTopTags').insert(new Element('span').update(tag));
+            $('eventTopTags').insert(new Element('span', {'class': 'eventTopTag'}).update(tag));
         });
         return;
     },