08-27-2021 05:29 PM
Is there an easy way to hide the nuxeo-document-create-button element so that it only shows when viewing a folderish document? We would like to disable the element in WebUI so that it doesn't show for other types of documents as it can sometimes obscure information, and that it really isn't needed for our users unless they are in a "folder" (or something with a similar view).
This element seems to reside in https://github.com/nuxeo/nuxeo-web-ui/blob/master/elements/nuxeo-app.js, and I'm not sure if I'm able to override that or not (probably isn't recommended to do so anyway). We are using LTS 2021 latest hotfix as well.
09-09-2021 12:34 PM
Posting a solution, in case anyone also would like to do this. Support came up with a script that I modified slightly and it seems to be working well so far (at least in development). Add the following code in your custom-bundle:
<script>
const app = document.querySelector('nuxeo-app');
app.$.pages.addEventListener('iron-select', () => {
app.root.querySelector('nuxeo-document-create-button').hidden = (app.page === 'home') || (app.page === 'search') ? true : app.currentDocument && (!app.currentDocument.facets.includes('Folderish') || app.currentDocument.facets.includes('Collection'));
});
</script>
This will hide the document-create-button on the following pages in WebUI:
The goal we had was to hide the button on any page that could not directly have documents created in it. This code satisfies those conditions.
09-03-2021 12:43 PM
Note, I added some padding-bottom to the card in the screenshot to account for the document create button (so that it doesn't cover download options). That helps a bit, but we still are looking to disable/hide the button except on folderish document views.
09-09-2021 12:34 PM
Posting a solution, in case anyone also would like to do this. Support came up with a script that I modified slightly and it seems to be working well so far (at least in development). Add the following code in your custom-bundle:
<script>
const app = document.querySelector('nuxeo-app');
app.$.pages.addEventListener('iron-select', () => {
app.root.querySelector('nuxeo-document-create-button').hidden = (app.page === 'home') || (app.page === 'search') ? true : app.currentDocument && (!app.currentDocument.facets.includes('Folderish') || app.currentDocument.facets.includes('Collection'));
});
</script>
This will hide the document-create-button on the following pages in WebUI:
The goal we had was to hide the button on any page that could not directly have documents created in it. This code satisfies those conditions.
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.