plugins/kolab_tags

Aleksander Machniak machniak at kolabsys.com
Wed Jan 21 12:18:15 CET 2015


 plugins/kolab_tags/kolab_tags.js             |   19 +++++++++++++++++--
 plugins/kolab_tags/lib/kolab_tags_engine.php |    2 +-
 plugins/kolab_tags/localization/en_US.inc    |    1 +
 3 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit 239b07e3005a44ce36196492d311e906bf305e9a
Author: Aleksander Machniak <machniak at kolabsys.com>
Date:   Wed Jan 21 05:42:02 2015 -0500

    Improve "New tag" feature, allow Down/Up keys in tag selector (#4159)

diff --git a/plugins/kolab_tags/kolab_tags.js b/plugins/kolab_tags/kolab_tags.js
index bdc5d3a..567eeb1 100644
--- a/plugins/kolab_tags/kolab_tags.js
+++ b/plugins/kolab_tags/kolab_tags.js
@@ -702,9 +702,21 @@ function tag_selector(event, callback)
             link = document.createElement('a'),
             span = document.createElement('span');
 
-        container = $('<div id="tag-selector" class="popupmenu"></div>');
         link.href = '#';
         link.className = 'active';
+        container = $('<div id="tag-selector" class="popupmenu"></div>')
+            .keydown(function(e) {
+                var focused = $('*:focus', container).parent();
+
+                if (e.which == 40) { // Down
+                    focused.nextAll('li:visible').first().find('a').focus();
+                    return false;
+                }
+                else if (e.which == 38) { // Up
+                    focused.prevAll('li:visible').first().find('input,a').focus();
+                    return false;
+                }
+            });
 
         // add tag search/create input
         rows.push(tag_selector_search_element(container));
@@ -758,7 +770,10 @@ function tag_selector_reset()
 
 function tag_selector_search_element(container)
 {
-    var input = $('<input>').attr({'type': 'text', title: rcmail.gettext('kolab_tags.tagsearchnew')})
+    var title = rcmail.gettext('kolab_tags.tagsearchnew'),
+        placeholder = rcmail.gettext('kolab_tags.newtag');
+
+    var input = $('<input>').attr({'type': 'text', title: title, placeholder: placeholder})
         .keyup(function(e) {
             if (this.value) {
                 // execute action on Enter
diff --git a/plugins/kolab_tags/lib/kolab_tags_engine.php b/plugins/kolab_tags/lib/kolab_tags_engine.php
index 609e89d..14a6e07 100644
--- a/plugins/kolab_tags/lib/kolab_tags_engine.php
+++ b/plugins/kolab_tags/lib/kolab_tags_engine.php
@@ -55,7 +55,7 @@ class kolab_tags_engine
             $this->rc->output->add_label('cancel', 'save');
             $this->plugin->add_label('tags', 'add', 'edit', 'delete', 'saving',
                 'nameempty', 'nameexists', 'colorinvalid', 'untag', 'tagname',
-                'tagcolor', 'tagsearchnew');
+                'tagcolor', 'tagsearchnew', 'newtag');
 
             $this->rc->output->add_handlers(array(
                 'plugin.taglist' => array($this, 'taglist'),
diff --git a/plugins/kolab_tags/localization/en_US.inc b/plugins/kolab_tags/localization/en_US.inc
index 5c1aa09..12a48db 100644
--- a/plugins/kolab_tags/localization/en_US.inc
+++ b/plugins/kolab_tags/localization/en_US.inc
@@ -21,6 +21,7 @@ $labels['edit'] = 'Edit';
 $labels['delete'] = 'Delete';
 $labels['tagname'] = 'Name';
 $labels['tagcolor'] = 'Color';
+$labels['newtag'] = 'New tag';
 $labels['tagsearchnew'] = 'Enter text to search or create a new tag';
 $labels['nameempty'] = 'Tag name cannot be empty!';
 $labels['nameexists'] = 'Tag with specified name already exists!';




More information about the commits mailing list