summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2015-01-21 10:42:02 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2015-01-21 10:42:02 (GMT)
commit239b07e3005a44ce36196492d311e906bf305e9a (patch)
tree853f8c5e8e29583533354ee994125857c66866eb
parentafa4133177ce369736237029d742890f162360ed (diff)
downloadroundcubemail-plugins-kolab-239b07e3005a44ce36196492d311e906bf305e9a.tar.gz
Improve "New tag" feature, allow Down/Up keys in tag selector (#4159)
-rw-r--r--plugins/kolab_tags/kolab_tags.js19
-rw-r--r--plugins/kolab_tags/lib/kolab_tags_engine.php2
-rw-r--r--plugins/kolab_tags/localization/en_US.inc1
3 files changed, 19 insertions, 3 deletions
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!';