From f89423318242c2ad683ccd0f0f24d7a3bbe3327c Mon Sep 17 00:00:00 2001 From: Victor Woeltjen Date: Mon, 23 Feb 2015 15:13:46 -0800 Subject: [PATCH] [Edit] Default to inclusive mode Default to inclusive mode in Edit mode toolbar; simplifies adding additional toolbar elements for Fixed Position view, WTD-881. --- platform/commonUI/edit/README.md | 8 ++++---- platform/commonUI/edit/src/representers/EditToolbar.js | 2 +- .../edit/src/representers/EditToolbarRepresenter.js | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/platform/commonUI/edit/README.md b/platform/commonUI/edit/README.md index a8c552fb3e..7ddf90b699 100644 --- a/platform/commonUI/edit/README.md +++ b/platform/commonUI/edit/README.md @@ -17,10 +17,10 @@ view's scope.) These additional properties are: an argument to set.) * `method`: Name of a method to invoke upon a selected object when a control is activated, e.g. on a button click. -* `inclusive`: Optional; true if this control should be considered - applicable whenever at least one element in the selection has - the associated property. Otherwise, all members of the current - selection must have this property for the control to be shown. +* `exclusive`: Optional; true if this control should be considered + applicable only when all elements in the selection has + the associated property. Otherwise, only at least one member of the + current selection must have this property for the control to be shown. Controls in the toolbar are shown based on applicability to the current selection. Applicability for a given member of the selection diff --git a/platform/commonUI/edit/src/representers/EditToolbar.js b/platform/commonUI/edit/src/representers/EditToolbar.js index 60d6990bb6..4b2a925019 100644 --- a/platform/commonUI/edit/src/representers/EditToolbar.js +++ b/platform/commonUI/edit/src/representers/EditToolbar.js @@ -108,7 +108,7 @@ define( function isApplicable(item) { var property = (item || {}).property, method = (item || {}).method, - exclusive = !(item || {}).inclusive; + exclusive = (item || {}).exclusive; // Check if a selected item defines this property function hasProperty(selected) { diff --git a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js index 63a4c9d3cd..0c5cd772d4 100644 --- a/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js +++ b/platform/commonUI/edit/src/representers/EditToolbarRepresenter.js @@ -57,6 +57,7 @@ define( commit("Changes from toolbar."); } + // Initialize toolbar (expose object to parent scope) function initialize() { // If we have been asked to expose toolbar state... if (attrs.toolbar) { @@ -67,7 +68,7 @@ define( // Represent a domain object using this definition function represent(representation) { - // + // Expose the toolbar object to the parent scope initialize(); // Clear any existing selection scope.selection = [];