Disable Delete button on sites console

Avatar

Avatar

laughingb220006

Avatar

laughingb220006

laughingb220006

10-01-2018

AEM Author should be unable to delete content/page once it published.

delete.JPG

- Once author selects page from sites console, we have to disable the delete button if page was in published status.

- we need to enable the delete button if page is not in published status.

- Once author selects any page from sites console it shows action bar that means we are calling listeners (java script files) for showing action bar buttons on sites console.

Question is:

please let me know exact listeners java script files or paths that calls when we select the page on sites console.

Accepted Solutions (0)

Answers (7)

Answers (7)

Avatar

Avatar

Hemant_arora

Avatar

Hemant_arora

Hemant_arora

11-01-2018

Go to /libs/cq/gui/components/siteadmin/admin/clientlibs/collectionpage/js/viewpropertiesaction.js

Overlay the above js , copy to apps and edit the one in apps /apps/cq/gui/components/siteadmin/admin/clientlibs/collectionpage/js/viewpropertiesaction.js

go to line number line number 91 and add this line

if (isActivated(selections)) {       

         control.removeAttr("hidden");    

            $('.cq-siteadmin-admin-actions-delete-activator').attr('disabled','disabled');     

}

Avatar

Avatar

Hemant_arora

Avatar

Hemant_arora

Hemant_arora

10-01-2018

Overlay this node in your project /libs/wcm/core/content/sites/jcr:content/actions/selection

copy the above sites page from libs and paste it under /apps/wcm/core/content

Remove the deletepage node under this node.

1391736_pastedImage_2.png

1391735_pastedImage_1.png

Avatar

Avatar

sarveshkmr

Avatar

sarveshkmr

sarveshkmr

13-01-2018

I guess you are looking this js-  /libs/granite/ui/components/coral/foundation/clientlibs/foundation/js/collection/action/action.js

Avatar

Avatar

abhishekagg19

Employee

Avatar

abhishekagg19

Employee

abhishekagg19
Employee

11-01-2018

Have you tried custom render conditions? Refer:

1. GitHub - nateyolles/aem-granite-rendercondition-demo: AEM Granite Render Condition demo

Disable functionality can also be achieved using ACL's as well (button will not get disabled but delete operation will fail). You can set ACL on content node of page or asset (remove delete privilege) via custom Preprocessor when a page/asset is published. When a page is unpublished, you can remove these ACLs.

Avatar

Avatar

kautuk_sahni

Community Manager

Total Posts

5.6K

Likes

969

Correct Answer

1.1K

Avatar

kautuk_sahni

Community Manager

Total Posts

5.6K

Likes

969

Correct Answer

1.1K
kautuk_sahni
Community Manager

12-01-2018

There is no easy way to do so to solve problem efficiently.

On top of the solution suggested by Hemant, you can always check the status of page is activated or not and hide disable button accordingly.

Best way would be to create custom workflow and there you can put all the checks that you want to achieve.

~kautuk

Avatar

Avatar

laughingb220006

Avatar

laughingb220006

laughingb220006

11-01-2018

Thank you for response.

-  But it is disabling every time. can't we enable for not activated/not published pages.

-  Can we do same for damadmin also ?

Avatar

Avatar

laughingb220006

Avatar

laughingb220006

laughingb220006

11-01-2018

it should not show disable mode in every time.it has to show enable mode when page is not in published status.

Below is the status has to show when page is in activated or deactivated status:

if page is activated -disable delete button

if page is not activated - enable delete button

when author selects the page from console it shows action tool bar (these action bar items populates using listeners). so i want the listeners (java script files) that shows for action bar after selecting the page from console.if we know that, we can add our disable condition on listener.