summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-05-06 15:05:27 +0200
committerAleksander Machniak <alec@alec.pl>2013-05-06 15:05:27 +0200
commitef1d6525c2333794d954ccce33de1bcd533f85c8 (patch)
tree0599c26ad66df4809dd45098d7701858af74a254
parentce89ecd54277fdd8113320ba463dfab6d504b00c (diff)
Fix display issue on addressbooks/groups list (#1489039)
-rw-r--r--program/js/app.js21
-rw-r--r--program/steps/addressbook/func.inc2
2 files changed, 18 insertions, 5 deletions
diff --git a/program/js/app.js b/program/js/app.js
index a652b8985..af09572ff 100644
--- a/program/js/app.js
+++ b/program/js/app.js
@@ -4453,11 +4453,22 @@ function rcube_webmail()
this.name_input.bind('keydown', function(e){ return rcmail.add_input_keydown(e); });
this.name_input_li = $('<li>').addClass(type).append(this.name_input);
- var li = type == 'contactsearch' ? $('li:last', this.gui_objects.folderlist) : $('ul.groups li:last', this.get_folder_li(this.env.source,'',true));
+ var ul, li;
+
+ // find list (UL) element
+ if (type == 'contactsearch')
+ ul = this.gui_objects.folderlist;
+ else
+ ul = $('ul.groups', this.get_folder_li(this.env.source,'',true));
+
+ // append to the list
+ li = $('li:last', ul);
if (li.length)
this.name_input_li.insertAfter(li);
- else
- this.name_input_li.appendTo(type == 'contactsearch' ? this.gui_objects.folderlist : $('ul.groups', this.get_folder_li(this.env.source,'',true)));
+ else {
+ this.name_input_li.appendTo(ul);
+ ul.show(); // make sure the list is visible
+ }
}
this.name_input.select().focus();
@@ -4514,11 +4525,13 @@ function rcube_webmail()
this.reset_add_input = function()
{
if (this.name_input) {
+ var li = this.name_input.parent();
if (this.env.group_renaming) {
- var li = this.name_input.parent();
li.children().last().show();
this.env.group_renaming = false;
}
+ else if ($('li', li.parent()).length == 1)
+ li.parent().hide();
this.name_input.remove();
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index f0fb433bf..d8a8e2556 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -297,7 +297,7 @@ function rcmail_contact_groups($args)
}
$args['out'] .= html::tag('ul',
- array('class' => 'groups', 'style' => ($is_collapsed ? "display:none;" : null)),
+ array('class' => 'groups', 'style' => ($is_collapsed || empty($groups) ? "display:none;" : null)),
$groups_html);
return $args;