Closed chrsbrq closed 7 years ago
Also, it would be nice to change the wording of the alert to remove the dash.
Instead of: "Limit exceeded, allowed - 3"
It would be better to say: "Limit exceeded, allowed: 3"
The first could be interpreted as "-3" which does not make sense.
I changed the error message, but I'm not sure how to address the larger concern. Do people really implement those mapping rules on author? I usually see that only on publish.
Hi Justin. We do hide "/content" on Author. I would like to offer the following changes. Please see file attached.
A couple of highlights.
1) Instead of getting path from "window.location.pathname" use "CQ.WCM.getPagePath()"
2) The value of "CQ.WCM.getPagePath()" is not set correctly until much later in the page load. So, instead of executing the Limited Parsys code on page load, execute it on CQ.Ext.onReady
3) Preventing items from being dropped is good but can easily be worked around by double-clicking the drop zone and selecting a component. So, completely hide the drop zone if the max-limit is reached. I could not find a perfect approach so I came up with somewhat of a hack. Maybe you'll have a better approach. What I did was look at the resource type of each editComponent and if it is a "new" component I hide that edit Component.
if(dropTargets[0].editComponent.params["./sling:resourceType"]==="foundation/components/parsys/new"){
@chrsbrq do you still need this? Im w @justinedelson in that i havent seen this mapping on AEM Author. /cc @schoudry
Deprecated feature (ClassicUI)
The "if" statement here is not always valid...
https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/content/src/main/content/jcr_root/apps/acs-commons/widgets/source/js/classicui-limit-parsys.js#L30
if( ( pathName !== "/cf" ) && ( pathName.indexOf("/content") !== 0)){ return; }
Many customers use Sling Mapping to avoid having "/content/" in their URLs. With this logic, the Limited Parsys would only work if the user is using Content Finder or if the URL contains "/content".