From ebd2d943c73d091e889c70b6a7ceb9afc2a40816 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Wed, 24 Feb 2010 22:15:00 -0700 Subject: [PATCH] Hide flag menus if no flags are settable --- imp/js/DimpBase.js | 9 ++++++--- imp/templates/index/index-dimp.inc | 20 ++++++++++++-------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/imp/js/DimpBase.js b/imp/js/DimpBase.js index d45414db0..d80a97e7e 100644 --- a/imp/js/DimpBase.js +++ b/imp/js/DimpBase.js @@ -612,9 +612,12 @@ var DimpBase = { /* Context menu: generate the list of settable flags for this * mailbox. */ flags = this.viewport.getMetaData('flags'); - $('ctx_flag').childElements().each(function(c) { - [ c ].invoke(flags.include(c.readAttribute('flag')) ? 'show' : 'hide'); - }); + $('ctx_draft_setflag', 'ctx_message_setflag', 'oa_setflag').invoke('up').invoke(flags.size() ? 'show' : 'hide'); + if (flags.size()) { + $('ctx_flag').childElements().each(function(c) { + [ c ].invoke(flags.include(c.readAttribute('flag')) ? 'show' : 'hide'); + }); + } }.bindAsEventListener(this)); container.observe('ViewPort:deselect', function(e) { diff --git a/imp/templates/index/index-dimp.inc b/imp/templates/index/index-dimp.inc index 1e1a425c4..6c15d88fe 100644 --- a/imp/templates/index/index-dimp.inc +++ b/imp/templates/index/index-dimp.inc @@ -366,12 +366,14 @@ function _simpleButton($id, $text, $image, $nodisplay = false)