cancel
Showing results for 
Search instead for 
Did you mean: 

Customizing the aikau search placeholder

iwkse
Star Contributor
Star Contributor

I have this problem with customizing the aikau search placeholder. I've created a share amp with maven and setting the extension like this to extend the SearchBox widget:

<extension>
   <modules>
      <module>
          <id>Aikau SearchBox Customization</id>
          <version>1.0</version>
          <auto-deploy>true</auto-deploy>
          <configurations>
              <config evaluator="string-compare" condition="WebFramework" replace="false">
                 <web-framework>
                     <dojo-pages>
                      <packages>
                            <package name="header" location="js/header"/>
                       </packages>
                     </dojo-pages>
                   </web-framework>
                 </config>
               </configurations>
            </module>
        </modules>
</extension>

with the structure in META-INF:

▾ js/
   ▾ header/
       ▾ i18n/
          SearchBox.properties
       SearchBox.js

having SearchBox.js:

define(["dojo/_base/declare", "alfresco/header/SearchBox"],
    function(declare, SearchBox) {
           return declare([SearchBox], {
               i18nRequirements: [ {i18nFile: "./i18n/SearchBox.properties"} ],
           });
});

and the properties file:

search.instruction=he who seeks shall find, Seek and ye shall find 

Any idea why the properties is not overridden?

[edit]

Never mind..I just find it out. Last time I was searching this aikau didn't allow to override the placeholder but this is been added! Thanks Dave Draper‌ !

No need now to extend the widget but it's enough to set a customization extension and modify like:

var searchBox = widgetUtils.findObject(model.jsonModel.widgets, "id", "HEADER_SEARCH");
searchBox.config.placeholder= "search-custom.label";

1 ACCEPTED ANSWER

ddraper
World-Class Innovator
World-Class Innovator

Glad you were able to resolve the problem! Let me know if there are any other issues I can help with.

View answer in original post

15 REPLIES 15

nwali
Star Contributor
Star Contributor

Hi,

I followed this search custom properties?  and was able to remove the people suggestion from the live-search. 

I have put in summaries way in Modify live search in Alfresco Commmunity 5.0.d - Stack Overflow  but I'm still trying to find way to override the placeholder in search box.

If any idea then please let me know.

Thanks.

iwkse
Star Contributor
Star Contributor

Hi,

For the placeholder you have two ways and it depends on the aikau version. If the aikau version is sufficiently new, you can use the method I've explained (just setting the property as you were trying to do for the showPeopleResults. If it's an older version of aikau you will have to override with an extension. WIth this method I was never able to be successful.

HTH

nwali
Star Contributor
Star Contributor

Thank you!

I updated the aikau from 1.0.8 to 1.0.101 (very big difference ) but placeholder changed and it worked well. Although I need to do a through testing of the system in case anything is broken.

Also if you have any idea that this upgrading to 1.0.101 is good for Alfresco community 5.0.d ? or should I use 1.0.10 or any other version for safer side?

Thanks again.

iwkse
Star Contributor
Star Contributor

Glad it solved your problem Smiley Happy

Actually you can use latest version of aikau, it has been made in that way so it's possible to upgrade it separately from Alfresco.

nwali
Star Contributor
Star Contributor

I have share-header.get.js with following code:

if (!user.isAdmin)
{

widgetUtils.deleteObjectFromArray(model.jsonModel, "id", "HEADER_REPOSITORY");
}

var searchBox = widgetUtils.findObject(model.jsonModel.widgets, "id", "HEADER_SEARCH");
searchBox.config.placeholder= "test";

But nothing is changed and placeholder of search box is old one.

How to change the placeholder in search input?

Thanks.

sharix
Champ in-the-making
Champ in-the-making

I cannot customize the default text in the searchbox by creating an amp that works. I am using the latest version of Aikau and have the enterprise version of Alfresco.  I tried all the suggestions above but I must be missing something for nothing works. 

I tried this - 

Created .xml file within web-extension/site-data/extensions/share-module.xml
<extension>
  <modules>
    <module>
      <id>Searchbox</id>
      <version>1.0</version>
      <auto-deploy>true</auto-deploy> 
      <customizations>
        <customization>
          <targetPackageRoot>org.alfresco.share.header</targetPackageRoot>
          <sourcePackageRoot>com.menu</sourcePackageRoot>
        </customization>
      </customizations>
    </module>
  </modules>
</extension>
Created .js file within web-extension/site-webscripts/com/menu/share-header.get.js
var searchBox = widgetUtils.findObject(model.jsonModel.widgets, "id", "HEADER_SEARCH");
searchBox.config.placeholder= "search-custom.label";
I also tired this method -
custom-searchbox.js  withal the associated files  -
define(["dojo/_base/declare", "alfresco/header/SearchBox"],
    function(declare, SearchBox) {
           return declare([SearchBox], {
               i18nRequirements: [ {i18nFile: "./i18n/searchbox.properties"} ],
           });
});
All my other amps are working but this one.  I can change the text by modifying the core file in Alfresco so I know it can be done.  We plan on upgrading our enterprise account so it is important to have a clear upgrade path with amps that work.
Any and all help is appreciated.
Thanks
sharix