Goal
Set the Orderable checked on new Folder Create dialog, so any new folders have default type sling:OrderedFolder
Demo | Package Install | Github
Solution
1) Login to CRXDE Lite, create folder (nt:folder) /apps/eaem-touchui-assets-folder-create-default-orderable
2) Create clientlib (type cq:ClientLibraryFolder) /apps/eaem-touchui-assets-folder-create-default-orderable/clientlib and set property categories of String[] type to dam.gui.coral.fileupload and dependencies String[] to underscore
3) Create file ( type nt:file ) /apps/eaem-touchui-assets-folder-create-default-orderable/clientlib/js.txt, add the following
default-orderable.js
4) Create file (type nt:file) /apps/eaem-touchui-assets-folder-create-default-orderable/clientlib/default-orderable.js, add the following code
(function ($, $document) { var DAM_CREATE_FOLDER = "#dam-create-folder", CREATE_FOLDER_DIALOG = "#createfolder", ORDERABLE_SEL = "coral-checkbox:last"; $document.on("foundation-contentloaded", onUILoad); function onUILoad() { Coral.commons.ready($(DAM_CREATE_FOLDER), function () { $(DAM_CREATE_FOLDER).click(makeOrderableDefault); }); } function makeOrderableDefault(event) { var $orderable = $(CREATE_FOLDER_DIALOG).find(ORDERABLE_SEL); if (_.isEmpty($orderable)) { return; } $orderable[0].checked = false; $orderable.click(); } })(jQuery, jQuery(document));
No comments:
Post a Comment