cancel
Showing results for 
Search instead for 
Did you mean: 

How to override client-side JavaScript in Share tier?

anon26949
Star Contributor
Star Contributor

My issue is related to sorting order in people-finder interface.

I have found that I can to control the sort order by using people-finder.js

This script included in the FreeMarker template people-finder.get.html.ftl:

<@standalone>
   <@markup id="css" >
      <#-- CSS Dependencies -->
      <@link href="${url.context}/res/components/people-finder/people-finder.css" group="people-finder"/>
   </@>
  
   <@markup id="js">
      <#-- JavaScript Dependencies -->
      <@script src="${url.context}/res/components/people-finder/people-finder.js" group="people-finder"/>
   </@>
  
    <@markup id="new-js" action="replace" target="js">
      <#– JavaScript Dependencies >
      <@script src="${url.context}/res/components/people-finder/people-finder-ext.js" group="people-finder"/>
    </@>
  
   <@markup id="widgets">
      <@createWidgets group="people-finder"/>
   </@>
  
   <@markup id="html">
      <@uniqueIdDiv>
         <#assign el=args.htmlid?html>
         <div id="${el}-body" class="people-finder list theme-color-1">
            <div class="title theme-color-2"><label for="${el}-search-text">${msg("title")}</label></div>
            <div class="finder-wrapper">
               <@markup id="searchBar">
               <div class="search-bar theme-bg-color-3">
                  <div class="search-text"><input type="text" id="${el}-search-text" name="-" value="" maxlength="256" tabindex="0" placeholder="${msg('help.title')}"/></div>
                  <div class="search-button alf-colored-button">
                     <span id="${el}-search-button" class="yui-button yui-push-button"><span class="first-child"><button>${msg("button.search")}</button></span></span>
                  </div>
               </div>
               </@markup>
              
                <@markup id="searchHelp">
               <div id="${el}-help" class="yui-g theme-bg-color-2 help hidden">
                  <span>${msg("help.content")}</span>
               </div>
               </@markup>              

               <@markup id="searchResults">
               <div class="alf-results-wrapper">
                  <div id="${el}-results-info" class="yui-dt-liner theme-bg-color-2 result-info hidden"></div>
                  <div id="${el}-results" class="results hidden"></div>
               </div>
               </@markup>
            </div>
         </div>
      </@>
   </@>
</@>

To determine the required functionality I need to override this script and I "developed" my own - let's say, people-finder-ext.js

As I understand it, with this code I can achieve this:

    <@markup id="new-js" action="replace" target="js">
      <#– JavaScript Dependencies >
      <@script src="${url.context}/res/components/people-finder/people-finder-ext.js" group="people-finder"/>
    </@>

In my AMP- extension I placed people-finder-ext.js here:   

/some-customization-share/src/main/amp/web/components/people-finder/people-finder-ext.js

And modified FreeMarker template people-finder.get.html.ftl I placed here:

/some-customization-share/src/main/amp/config/alfresco/web-extension/site-webscripts/org/alfresco/components/people-finder/people-finder.get.html.ftl

Then I run my project on the embedded Tomcat:

mvn integration-test -Pamp-to-war

So, I see that the sorting is not works the way I need.

I watched the network traffic between Share tier and the Alfresco tier and noticed, that my script is not loaded.

What could be the reason?

I would be very grateful for the information. Thanks to all.

1 ACCEPTED ANSWER
1 REPLY 1

anon26949
Star Contributor
Star Contributor