AEM6.5 Disable Some selected fields in Action Bar for specific Metadata schema Folder [DAM]

Avatar

Avatar

tushaar_srivastava

Avatar

tushaar_srivastava

tushaar_srivastava

01-10-2020

Hi Team,

 

when I tried to disable the "Properties",  "To Collection" , "Annotate" , "Quick Publish"

from Action Bar for specific Schema folder. It is disabling for all the schema folder.

image.png

 

The requirement here is

- Suppose we have two schema folder in DAM, with different metadata schema, eg. public and central-library having their respective metadata schemas

image.png

Now, If I open central-library schema folder and I need to restrict "Properties",  "To Collection" , "Annotate" , "Quick Publish" from Action Bar only for central-library schema, not for Public folder.

 

How to Restrict that for specific folder?

image.png

 

 

@Arun_Patidar  @Vijayalakshmi_S  @kautuk_sahni  @Theo_Pendle  @BrianKasingli  @vanegi 

 

Thank you.

 

actions AEM 6.5 aem6.5 Asset DAM DAM Assets DAM Schema Metadataschema Touch UI

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

aemmarc

Employee

Avatar

aemmarc

Employee

aemmarc
Employee

01-10-2020

@Theo_Pendle authored this article around render conditions that is highly relevant to your ask : https://levelup.gitconnected.com/aem-creating-custom-granite-render-conditions-28a21958f420

 

Cheers


~Marc

Answers (2)

Answers (2)

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.1K

Correct Reply

839

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.1K

Correct Reply

839
Arun_Patidar
MVP

01-10-2020

you have to use the path render condition to show hide menu items

One of the examples of rendercondition is https://aemlab.blogspot.com/2019/07/aem-granite-custom-render-conditions.html

Avatar

Avatar

Vijayalakshmi_S

MVP

Avatar

Vijayalakshmi_S

MVP

Vijayalakshmi_S
MVP

01-10-2020

Hi @tushaar_srivastava,

If metadata schema is associated to a folder in DAM, respective folder/jcr:content will have a property named metadataSchema with value being the schema path.

Conditional logic in this use case to control the display of actions goes like this,

Check if a DAM folder has central-library schema(via a check using the property above) for which DAM folder path is retrieved from requestPathInfo object via requestPathInfo.suffix.

Using this conditional check in granite:renderconditions or in granite:hide will work only on page load. As we switch between folders within /assets.html, conditional check will not be evaluated for the same reason mentioned above.

You can make use of JS

  • To get the DAM folder path on select of an asset by listening to click event on Quick action - "Select"  button. (based on your AEM version, use the selectors considering all 3 view - list, column and card)
  • Perform the logic using the path retrieved in previous step
    • via AJAX call to servlet (conditional check based on schema using property above) or
    • conditional check based on folder path (Only if it is known that schema is limited to one or two folder paths and this logic need not be moved to servlet, can be written as is in JS)
  • Display/hide desired action elements by .addClass() or .css() jQuery function based on the outcome of previous step