From 6501f55af8c91619dd5e16210219aa6ec975df5a Mon Sep 17 00:00:00 2001 From: Defman21 Date: Thu, 4 May 2017 20:44:29 +0300 Subject: [PATCH 1/2] Commando: show a tip when next/previous/current item is not available for multiselection Signed-off-by: Defman21 --- src/modules/commando/content/sdk/commando.js | 22 ++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/modules/commando/content/sdk/commando.js b/src/modules/commando/content/sdk/commando.js index 1d98bdc0cb..0508c549eb 100644 --- a/src/modules/commando/content/sdk/commando.js +++ b/src/modules/commando/content/sdk/commando.js @@ -1682,9 +1682,16 @@ { resultElem.addItemToSelection(sibling); resultElem.ensureElementIsVisible(sibling); + c.tip("Selected " + resultElem.selectedCount + " items"); + } else if (!selItem.resultData.allowMultiSelect) { + c.tip("Selected item is not allowed for multiselection"); + } else if (sibling || !sibling.resultData.allowMultiSelect) { + let tip = 'Next item is not allowed for multiselection'; + if (resultElem.selectedCount > 1) { + tip += `, selected ${resultElem.selectedCount} items`; + } + c.tip(tip); } - - c.tip("Selected " + resultElem.selectedCount + " items"); } else { @@ -1729,9 +1736,16 @@ { resultElem.addItemToSelection(sibling); resultElem.ensureElementIsVisible(sibling); + c.tip("Selected " + resultElem.selectedCount + " items"); + } else if (!selItem.resultData.allowMultiSelect) { + c.tip("Selected item is not allowed for multiselection"); + } else if (sibling || !sibling.resultData.allowMultiSelect) { + let tip = 'Previous item is not allowed for multiselection'; + if (resultElem.selectedCount > 1) { + tip += `, selected ${resultElem.selectedCount} items`; + } + c.tip(tip); } - - c.tip("Selected " + resultElem.selectedCount + " items"); } else { From af430afecca81295d2ca6e09dcb8f9b4ce07f186 Mon Sep 17 00:00:00 2001 From: Defman21 Date: Thu, 4 May 2017 21:14:00 +0300 Subject: [PATCH 2/2] Updated the tip Signed-off-by: Defman21 --- src/modules/commando/content/sdk/commando.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/modules/commando/content/sdk/commando.js b/src/modules/commando/content/sdk/commando.js index 0508c549eb..70ef6d70a3 100644 --- a/src/modules/commando/content/sdk/commando.js +++ b/src/modules/commando/content/sdk/commando.js @@ -1684,9 +1684,9 @@ resultElem.ensureElementIsVisible(sibling); c.tip("Selected " + resultElem.selectedCount + " items"); } else if (!selItem.resultData.allowMultiSelect) { - c.tip("Selected item is not allowed for multiselection"); + c.tip("Cannot expand selection to item meant for single selection only"); } else if (sibling || !sibling.resultData.allowMultiSelect) { - let tip = 'Next item is not allowed for multiselection'; + let tip = 'Cannot expand selection to item meant for single selection only'; if (resultElem.selectedCount > 1) { tip += `, selected ${resultElem.selectedCount} items`; } @@ -1738,9 +1738,9 @@ resultElem.ensureElementIsVisible(sibling); c.tip("Selected " + resultElem.selectedCount + " items"); } else if (!selItem.resultData.allowMultiSelect) { - c.tip("Selected item is not allowed for multiselection"); + c.tip("Cannot expand selection to item meant for single selection only"); } else if (sibling || !sibling.resultData.allowMultiSelect) { - let tip = 'Previous item is not allowed for multiselection'; + let tip = 'Cannot expand selection to item meant for single selection only'; if (resultElem.selectedCount > 1) { tip += `, selected ${resultElem.selectedCount} items`; }