Customize the sites.html | Community
Skip to main content
Level 5
July 5, 2017

Customize the sites.html

  • July 5, 2017
  • 2 replies
  • 8648 views

Hi ,

I am able to add the new buttons to the action bar in sites.html by customizing the selection actions but not able to do any activities. I am adding here my sample code and approach please guide me what needs to do fix this.

Here is my code in apps

<jcr:content

        jcr:mixinTypes="[sling:VanityPath]"

        jcr:primaryType="nt:unstructured"

        jcr:title="AEM Sites"

        sling:resourceType="granite/ui/components/shell/collectionpage"

        sling:vanityOrder="{Long}301"

        sling:vanityPath="/sites"

        consoleId="cq-sites"

        modeGroup="cq-siteadmin-admin-childpages"

        omnisearchLocationPath="/libs/granite/omnisearch/content/metadata/site"

        pageURITemplate="/sites.html{+id}"

        targetCollection=".cq-siteadmin-admin-childpages">

        <actions jcr:primaryType="nt:unstructured">

            <selection jcr:primaryType="nt:unstructured">  

            <test

                    jcr:primaryType="nt:unstructured"

                    sling:resourceType="granite/ui/components/endor/actionbar/button"

                    class="foundation-collection-action cq-siteadmin-admin-actions-eahelp-preview cq-siteadmin-admin-actions-publish-activator"

                    foundation-collection-action="\{&quot;target&quot;: &quot;.cq-siteadmin-admin-childpages&quot;, &quot;activeSelectionCount&quot;: &quot;single&quot;}"

                    foundation-mode-group="cq-siteadmin-admin-searchpages"

                    foundation-mode-value="default"

                    text="Test"

                    variant="actionBar"/>

          </selection>

        </actions>

    </jcr:content>

</jcr:root>

client libs for this

 

Client lib properties :

<?xml version="1.0" encoding="UTF-8"?>

<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"

    jcr:primaryType="cq:ClientLibraryFolder"

    categories="[granite.ui.foundation.admin]"/>

and JS file I am trying to capture the click event.

(function(window, document, Granite, $) {

    "use strict";

     alert("hi");

    var TWITTER_ACTIVATOR = ".cq-siteadmin-admin-actions-eahelp-preview";

    $(document).on("click", TWITTER_ACTIVATOR, function(e) {

        var selection = $(".foundation-collection").first().find(".foundation-selections-item").first();

        var path = selection.data("foundationCollectionItemId") || selection.data("path");

     alert (path);

etc .........

I am not seeing any action for this button.

Here I have couple of doubts

1. Am I using the correct category ?If not what is the correct one to use it.

2.  Where can I get the list categories used in AEM? I tried to get the list but not able to get it.

Here is the my screen output

Please advice what needs to correct here and what needs to add extra to see the actions on this button. Very Urgent.

Thanks In Advance.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

kautuk_sahni
Community Manager
Community Manager
July 6, 2017

edubey you might can help here... as this is something you have already done.

  ~kautuk

Kautuk Sahni
edubey
Level 10
July 6, 2017

Can you share the package with node and JS ?

To answer your question: Where can I get the list categories used in AEM? I tried to get the list but not able to get it.

check here http://localhost:4502/libs/granite/ui/content/dumplibs.html

Thanks

Level 3
July 6, 2017

Thanks, Kautuk.

Hi, edubey Thanks for looking into it. How can I share the package? I am not seeing any attachment option here.

Thanks

dragon2AAuthor
Level 5
July 7, 2017

Whats the use case of the action you are trying to achieve?

Thanks


when the user wants to see a preview of the page we wanted to redirect to the external site by passing the selected page.

The preview we are displaying in the new tab. I am able to write that for in the edit mode of the page but user prefers that option here.

Thanks