AEM 62 - Touch UI Move Asset Wizard Set Default Path for Rename

Goal


Handy extension for setting the default path in move asset wizard/mnt/overlay/dam/gui/content/assets/moveassetwizard.html, saving few clicks while renaming assets

Demo | Package Install | Git Hub



Solution


1) Login to CRXDE Lite, create folder (nt:folder) /apps/eaem-assets-move-set-default-path

2) Create clientlib (type cq:ClientLibraryFolder/apps/eaem-assets-move-set-default-path/clientlib and set a property categories of String type to cq.gui.damadmin.moveassetwizarddependencies of type String[] with value underscore

3) Create file ( type nt:file ) /apps/eaem-assets-move-set-default-path/clientlib/js.txt, add the following

                         set-default-path.js

4) Create file ( type nt:file ) /apps/eaem-assets-move-set-default-path/clientlib/set-default-path.js, add the following code

(function () {
    var oneTime = false;

    Granite.UI.MovePageWizard.prototype.getDestinationPath = function() {
        if(oneTime){
            return this.destinationPath;
        }

        oneTime = true;

        this.destinationPath = getStringBeforeLastSlash(decodeURIComponent(queryParameters()["item"]));

        return this.destinationPath;
    };

    function queryParameters() {
        var result = {}, param,
            params = document.location.search.split(/\?|\&/);

        params.forEach( function(it) {
            if (_.isEmpty(it)) {
                return;
            }

            param = it.split("=");
            result[param[0]] = param[1];
        });

        return result;
    }

    function getStringBeforeLastSlash(str){
        if(!str){
            return str;
        }

        return str.substring(0,str.lastIndexOf("/"));
    }
}());

1 comment:

  1. I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Adobe Experience Manager
    , kindly contact us http://www.maxmunus.com/contact
    MaxMunus Offer World Class Virtual Instructor led training on Adobe Experience Manager . We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
    For Demo Contact us:
    Name : Arunkumar U
    Email : arun@maxmunus.com
    Skype id: training_maxmunus
    Contact No.-+91-9738507310
    Company Website –http://www.maxmunus.com



    ReplyDelete