This article talks about disabling the ‘File Upload’ option for the image component in the Touch UI dialog (screenshot shown below).
Image Touch UI Dialog
This also helps in understanding
- Customizing the Touch UI dialog
- Inheriting the foundation component
- Create a custom image component under /apps/<your-app>/components/
- Add a property sling:resourceSuperType = wcm/foundation/components/image to inherit the OOB image component properties
- copy and page the cq:dialog node from ‘libs/wcm/foundation/components/image’ under your image component node. (override the TouchUI dialog)
Image Component
- add a property disabled Boolean value of true for a node cq:dialog/content/items/image/items/column/items/file – This will disable the file upload option in the dialog.
- In CRXDE Lite navigate to /libs/granite/ui/components/foundation/form/fileupload and copy the folder
- file upload
- Navigate back to your image component and paste the folder under the Image component node.
After fieldAttrs.addClass(“coral-Form-field”); (line #239) add this
// show drop target when disabled
if(cfg.get("disabled", false)){
fieldAttrs.addClass("is-active");
}
What this will do is automatically add the “is-active” css class to the for sale Levitra drop target input for the file upload. This, in turn, displays the target that you see when dragging an image from the Asset Finder.
After buttonAttrs.addClass(“coral-FileUpload-trigger coral-Button”); (line #252) add this
What this will do is automatically add the “is-active” css class to the for sale Levitra drop target input for the file upload. This, in turn, displays the target that you see when dragging an image from the Asset Finder.
After buttonAttrs.addClass(“coral-FileUpload-trigger coral-Button”); (line #252) add this
//hide button when button is disabled
if(cfg.get("disabled", false)){
buttonAttrs.add("style","display:none;");
}
This will hide the disabled Upload Image button so there is no confusion why the button is disabled.
Now we have to update your dialog to use our new form for the fileupload.
Now you can drop your image component on the page and see your new dialog.
This will hide the disabled Upload Image button so there is no confusion why the button is disabled.
Now we have to update your dialog to use our new form for the fileupload.
- Navigate to your file node
- /apps/<your-app>/components/content/image/cq:dialog/content/items/image/items/column/items/file
- Add the property
- sling:resourceType=”/apps/<your-app>/components/image/form/fileupload”
Now you can drop your image component on the page and see your new dialog.
No comments:
Post a Comment
If you have any doubts or questions, please let us know.