As per your requirement, you want to disable a button that is a part of Speak UI
. For this, you need to check the location of the files that get installed with the Publishing service. So if you extract the Sitecore Publishing package
, you will find the location of the files that will be installed in your Sitecore instance. The location of these files will be this.
wwwroot\your-sitecore-instance\sitecore\shell\client\Applications\Publishing
You have to write some JS code to disable or hide the button, I got the reference from the Sitecore basic publishing service panel, that I found under this location.
wwwroot\your-sitecore-instance\sitecore\shell\Applications\Dialogs\Publish
Under the file pubilsh.js
, you will find an example of writing the JS code. Now for the polishing service, under sitecore\shell\client\Applications\Publishing
folder, there is a file called PublishingDialog.js
. Here I tried to write a custom code to hide the publish button like this at the end of the file.
jQuery(document).ready(function ($) {
var publishButton = $('.sc-dialogFooter-content-buttons').find("[data-sc-id='ButtonPublish']")
setTimeout(function () {
$(publishButton).hide();
}, 1000);
});
And it hides the button. This answers your question that how to write JS. Next you need to do this for a particular role. Not sure but you need to call some API that may give you the identity of the logged-in user and you can write the condition on the basis of the role.
Lastly, I would say that you can try this as well if you want to use custom JS with the Speak UI
then you can put it anywhere in your Sitecore solution, and using the Sitecore Rocks
, go to the presentation details of your page item and double-click on the PageCode
component to open its Properties. There is a PageCodeScriptFileName
to the path of your .js file.
Follow this article for more references.
https://mhwelander.net/2014/07/01/speak-for-newbies-part-4-pagecode-and-javascript-libraries/