From 9cae8684923e3fa7fbf87da27b2d8511fa0370ae Mon Sep 17 00:00:00 2001 From: LaShonda Hopper Date: Wed, 5 Jul 2017 16:33:05 -0400 Subject: [PATCH] [Worklist #21420] Implement Create button disabled state (details below). * The create button icon is set to its disabled resource when the user enters a domain where they have _neither_ Rez or TempRez permissions. ** If the user has either of the Rez permission levels then the normal edit-i.svg icon is used and the user is able to create items as before. * When the user clicks the button in this state, the INSUFFICIENT_PERMISSIONS_ERROR_MSG is shown and creation menu is not shown. * The disabled icon, edit-disabled.svg, is based on the edit-i.svg and is set to 33% opacity. Item Ticket Link: https://worklist.net/21420 Changes to be committed: new file: interface/resources/icons/tablet-icons/edit-disabled.svg modified: scripts/system/edit.js --- .../icons/tablet-icons/edit-disabled.svg | 25 +++++++++++++++++++ scripts/system/edit.js | 8 +++++- 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 interface/resources/icons/tablet-icons/edit-disabled.svg diff --git a/interface/resources/icons/tablet-icons/edit-disabled.svg b/interface/resources/icons/tablet-icons/edit-disabled.svg new file mode 100644 index 0000000000..4869b30dd9 --- /dev/null +++ b/interface/resources/icons/tablet-icons/edit-disabled.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + + diff --git a/scripts/system/edit.js b/scripts/system/edit.js index a83d2159bb..69aacfd48f 100644 --- a/scripts/system/edit.js +++ b/scripts/system/edit.js @@ -397,9 +397,10 @@ var toolBar = (function () { } }); + var hasEditPermissions = (Entities.canRez() || Entities.canRezTmp()); tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); activeButton = tablet.addButton({ - icon: "icons/tablet-icons/edit-i.svg", + icon: (hasEditPermissions ? "icons/tablet-icons/edit-i.svg" : "icons/tablet-icons/edit-disabled.svg"), activeIcon: "icons/tablet-icons/edit-a.svg", text: "CREATE", sortOrder: 10 @@ -412,6 +413,11 @@ var toolBar = (function () { tablet.fromQml.connect(fromQml); activeButton.clicked.connect(function() { + if ( ! hasEditPermissions ){ + Window.notifyEditError(INSUFFICIENT_PERMISSIONS_ERROR_MSG); + return; + } + that.toggle(); });