Improve "New tag" feature, allow Down/Up keys in tag selector (#4159)
This commit is contained in:
parent
afa4133177
commit
239b07e300
3 changed files with 19 additions and 3 deletions
|
@ -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
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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!';
|
||||
|
|
Loading…
Add table
Reference in a new issue