cancel
Showing results for 
Search instead for 
Did you mean: 

Closed twisters on window load

mtsiak
Star Contributor
Star Contributor

In document details page, how can i  change the twisters so as to be all closed when (dom) document loads?

1 ACCEPTED ANSWER

ddraper
World-Class Innovator
World-Class Innovator

This is likely to be a tricky thing to achieve and I'll provide some background to explain information to explain why...

Whether or not a twister is open or closed on the details page is down to the preferences of the individual user that is viewing that page. By default all the twisters will be open, but if a user collapses a twister then an XHR request will be made to update their preferences using a key for that twister. 

When the user reloads the details page (for any node) their preferences will be inspected to determine if each twister should be initially opened or closed.

The code for creating the twister can be found in the alfresco.js source file and is defined in the Alfresco.util.createTwister function that is created in the global namespace.

Each twister section (Document Actions, Tags, Share, Properties, etc) is defined by a separate Surf Component bound to a separate WebScript. The template for each of these WebScripts calls the Alfresco.util.createTwister to create a twister widget around some HTML content.

Therefore in order to ensure that twisters are always open it will be necessary to override the Alfresco.util.createTwister function to change its behaviour to ensure that twisters are always closed. It should be possible to write an extension module to include an extra JS resource on the page, but it will not be possible to extend the Alfresco.util.createTwister widget (unless you plan on creating extension to modify each document details page WebScript to call a custom twister widget). So therefore you will need to copy/paste the existing code (which I consider an absolute last resort) and then edit it so that either all twisters are closed (which will impact more than just the document details page - although your extension could be targeted at just that page) or to disregard user preferences for those document details page specific twisters.

Hopefully that makes sense and will at least get you on the path to creating this customization, if you need any further help then please reply with any more specific questions based on the information provided above.

View answer in original post

2 REPLIES 2

ddraper
World-Class Innovator
World-Class Innovator

This is likely to be a tricky thing to achieve and I'll provide some background to explain information to explain why...

Whether or not a twister is open or closed on the details page is down to the preferences of the individual user that is viewing that page. By default all the twisters will be open, but if a user collapses a twister then an XHR request will be made to update their preferences using a key for that twister. 

When the user reloads the details page (for any node) their preferences will be inspected to determine if each twister should be initially opened or closed.

The code for creating the twister can be found in the alfresco.js source file and is defined in the Alfresco.util.createTwister function that is created in the global namespace.

Each twister section (Document Actions, Tags, Share, Properties, etc) is defined by a separate Surf Component bound to a separate WebScript. The template for each of these WebScripts calls the Alfresco.util.createTwister to create a twister widget around some HTML content.

Therefore in order to ensure that twisters are always open it will be necessary to override the Alfresco.util.createTwister function to change its behaviour to ensure that twisters are always closed. It should be possible to write an extension module to include an extra JS resource on the page, but it will not be possible to extend the Alfresco.util.createTwister widget (unless you plan on creating extension to modify each document details page WebScript to call a custom twister widget). So therefore you will need to copy/paste the existing code (which I consider an absolute last resort) and then edit it so that either all twisters are closed (which will impact more than just the document details page - although your extension could be targeted at just that page) or to disregard user preferences for those document details page specific twisters.

Hopefully that makes sense and will at least get you on the path to creating this customization, if you need any further help then please reply with any more specific questions based on the information provided above.

mtsiak
Star Contributor
Star Contributor

thank you for your reply. i overridden the Alfresco.util.createTwister to collapse all twisters in a js file of my module, as you suggested.

Getting started

Tags


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.