AEM 6.4.1.0 - Need help in understanding we-retail page "Delete" implementation.

cquser1

13-03-2019

Hi All,

Need to understand how the text - "You are going to delete the following item: Sleek Insulated Coat"

is coming up when we click on delete.

- Can you please let us know from where is the text "You are going to delete the following item:" getting picked up.

- Code where it is picking the page title and appending to the text mentioned above.

- Any other files, which will be of help understanding this 'Delete' functionality.

we-retail.png

Accepted Solutions (1)

Accepted Solutions (1)

Arun_Patidar

MVP

13-03-2019

Hi,

Its is implemented in http://localhost:4502/libs/cq/gui/components/common/wcm/clientlibs/wcm.js

    $(window).adaptTo("foundation-registry").register("foundation.collection.action.action", {

        name: "cq.wcm.delete",

        handler: function(name, el, config, collection, selections) {

            var message = createEl("div");

            var intro = createEl("p").appendTo(message);

            if (selections.length === 1) {

                intro.text(Granite.I18n.get("You are going to delete the following item:"));

            } else {

                intro.text(Granite.I18n.get("You are going to delete the following {0} items:", selections.length));

            }

            var list = [];

            var maxCount = Math.min(selections.length, 12);

            for (var i = 0, ln = maxCount; i < ln; i++) {

                var title = $(selections[i]).find(".foundation-collection-item-title").text();

                list.push(createEl("b").text(title).prop("outerHTML"));

            }

            if (selections.length > maxCount) {

                list.push("&#8230;"); // &#8230; is ellipsis

            }

            createEl("p").html(list.join("<br>")).appendTo(message);

            var ui = $(window).adaptTo("foundation-ui");

           

            ui.prompt(getDeleteText(), message.html(), "notice", [{

                text: getCancelText()

            }, {

                text: getDeleteText(),

                warning: true,

                handler: function() {

                    var paths = selections.map(function(v) {

                        return $(v).data("foundationCollectionItemId");

                    });

                    deletePages($(collection), paths, false, true);

                }

            }]);

        }

    });