From b0e5923fec061623dbe8a874b4b07a4b4429fd42 Mon Sep 17 00:00:00 2001 From: Paulo Veiga Date: Tue, 4 Oct 2011 23:59:21 -0300 Subject: [PATCH] Minor fix. --- mindplot/src/main/javascript/widget/Menu.js | 16 ++++++++++++---- .../src/main/javascript/widget/ToolbarItem.js | 1 - .../main/javascript/widget/ToolbarPaneItem.js | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/mindplot/src/main/javascript/widget/Menu.js b/mindplot/src/main/javascript/widget/Menu.js index ce3c0974..bf2dd01e 100644 --- a/mindplot/src/main/javascript/widget/Menu.js +++ b/mindplot/src/main/javascript/widget/Menu.js @@ -323,13 +323,21 @@ mindplot.widget.Menu = new Class({ var rels = designer.getModel().filterSelectedRelations(); this._toolbarElems.forEach(function(button) { - if (button.isTopicAction() && topics.length == 0) { + var disable = false; + if (button.isTopicAction() && button.isRelAction()) { + disable = rels.length == 0 && topics.length == 0; + + } else if (button.isTopicAction() && topics.length == 0) { + disable = true; + } else if (button.isRelAction() && rels.length == 0) { + disable = true; + } + + if (disable) { button.disable(); } - if (button.isRelAction() && rels.length == 0) { - button.disable(); - } + }) }.bind(this)); diff --git a/mindplot/src/main/javascript/widget/ToolbarItem.js b/mindplot/src/main/javascript/widget/ToolbarItem.js index 2f10f96a..583766d6 100644 --- a/mindplot/src/main/javascript/widget/ToolbarItem.js +++ b/mindplot/src/main/javascript/widget/ToolbarItem.js @@ -24,7 +24,6 @@ mindplot.widget.ToolbarItem = new Class({ this._buttonId = buttonId; this._fn = fn; this._options = options; - }, getButtonElem : function() { diff --git a/mindplot/src/main/javascript/widget/ToolbarPaneItem.js b/mindplot/src/main/javascript/widget/ToolbarPaneItem.js index 0c9f7531..bf563819 100644 --- a/mindplot/src/main/javascript/widget/ToolbarPaneItem.js +++ b/mindplot/src/main/javascript/widget/ToolbarPaneItem.js @@ -30,7 +30,7 @@ mindplot.widget.ToolbarPaneItem = new Class({ } }.bind(this); - this.parent(buttonId, fn, {topicAction:true,relAction:true}); + this.parent(buttonId, fn, {topicAction:true,relAction:false}); this._model = model; this._panelId = this._init().id; },