cancel
Showing results for 
Search instead for 
Did you mean: 

Add new buttom on header

zazugue
Champ in-the-making
Champ in-the-making
Hellow guys. I am trying to add a new buttom on the header. So i followed this tutorial https://www.alfresco.com/blogs/developer/2013/09/16/customizing-the-share-header-part-3/

And i make a new java project and made this hierarchy :

Project
|
|–> alfresco
|    |
|    |–> site-data
|    |      |
|    |      |–> custombuttom.xml
|    |
|    |–> site-webscripts
|          |
|          |–> share-header.get.js
|
|–> build.xml



Inside custombuttom.xml
————————


<extension>
  <modules>
    <module>
      <id>Add Buttom Exersys</id>
      <version>1.0</version>
      <customizations>
        <customization>
          <targetPackageRoot>org.alfresco.share.header</targetPackageRoot>
          <sourcePackageRoot>custom-header</sourcePackageRoot>
        </customization>
      </customizations>
    </module>
  </modules>
</extension>



————————

Inside share-header.get.js
————————


//<import resource="classpath:/alfresco/site-webscripts/org/alfresco/share/imports/share-header.lib.js">
var headerMenus = widgetUtils.findObject(model.jsonModel, "id", "HEADER_APP_MENU_BAR"); //Retrouve l'objet Menu Bar
var NewAppItems = [
{
         id: "HEADER_EXERSYS",
         name: "alfresco/menus/AlfMenuBarItem",
         config:
      {
            label: "header.menu.exersys.label",
            targetUrl: "alfresco/service/exersys/"
         }
}
];
headerMenus.appItems = NewAppItems; //L'attribut appItems permet d'ajouter l'objet à gauche



The problem is when i deploy in alfresco, i found it in "http://localhost:8080/share/page/modules/deploy" and activate it but nothing change and i don't have error in logs.

Did i forgot something?
Thank in advance ><"
1 REPLY 1

niketapatel
Star Contributor
Star Contributor
Hi Please refer this one.
http://docs.alfresco.com/community5.0/concepts/dev-extensions-share-aikau-menus.html

First your share-header.get.js should be under site-webscripts/custom-header as per your sourcePackageRoot.

And try this one as per above mentioned link.


var headerMenu = widgetUtils.findObject(model.jsonModel, "id", "HEADER_APP_MENU_BAR"); //Retrouve l'objet Menu Bar
if (headerMenu != null) {
    headerMenu.config.widgets.push({
        id: "HEADER_EXERSYS",
        name: "alfresco/menus/AlfMenuBarItem",
            config: {
                label: "header.menu.exersys.label",
                targetUrl: "alfresco/service/exersys/"
            }
    });
}