Add extra menu to navigation menu Navbar

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nunos
    Member
    • Mar 2018
    • 94

    Add extra menu to navigation menu Navbar

    Hi everyone,

    I am trying to add a new menu entry on the client navigation menu (client navbar i think, where you have the preferences, last viewed, logout options) top right menu, but with no luck, i edit the navbar.js where that information is and insert the new menu line but changes don't seem to be acepted / updated.

    I am editing the right file? not sure

    EspoCRM version 8.1.1

    Thanks for all your help

    Nuno
    Last edited by nunos; 05-18-2024, 09:50 PM.
  • eymen-elkum
    Active Community Member
    • Nov 2014
    • 472

    #2
    Hi,

    Here's how to do:

    - Create a file custom/Espo/Custom/Resources/metadata/clientDefs/App.json

    Code:
    {
        "navbarView": "custom:views/site/navbar"
    }
    ​
    - Create custom navbar js file: client/custom/src/views/site/navbar.js

    Code:
    define('custom:views/site/navbar', ['views/site/navbar'], function (Dep) {
        return Dep.extend({
           getMenuDataList: function () {
             const menuDataList = Dep.prototype.getMenuDataList.call(this);
    
             menuDataList.push({
                action: 'myCustomAction',
                link: '#MyCustomLink',
                label: this.getLanguage().translate('My Custom Action'),
             });
    
             return menuDataList;
          }
       });
    });
    ​
    Click image for larger version  Name:	Screenshot 2024-05-20 at 12.30.20 PM.png Views:	0 Size:	19.7 KB ID:	106333
    CEO of Eblasoft
    EspoCRM Expert since 2014
    Full Stack Web Developer since 2008
    Creator of Numerous Successful Extensions & Projects​

    Comment


    • nunos
      nunos commented
      Editing a comment
      ​Thanks eymen-elkum​, it's working just perfectly!!!

      And if i want to remove an existing menu? for example, the "Preferences" option?

      Nuno​
  • nunos
    Member
    • Mar 2018
    • 94

    #3
    I think to remove some menu options maybe this post can help:
    issue we are having is that we rely on CRM notification both in App and email notification to keep our users informed, however we have noticed that some of our users were not engaged and when we checked we found that they have disabled the notifications on the CRM and hence they don't receive any further notifications. is there

    Comment

    • nunos
      Member
      • Mar 2018
      • 94

      #4
      Ok guys, to remove the "preferences" menu from the top right menu just follow the info bellow from the above link of the forum.

      1 - Create App.json under custom\Espo\Custom\Resources\metadata\clientDefs

      {
      "navbarView": "custom:views/site/navbar"
      }

      2 - Create the new custom view navbar.js under client\custom\src\views\site

      define('custom:views/site/navbar', ['views/site/navbar'], function (Dep) {

      return Dep.extend({

      getMenuDataList: function () {

      var list = Dep.prototype.getMenuDataList.call(this);

      if (!this.getUser().isAdmin()) {
      list = list.filter(item => item.link !== '#Preferences');
      }

      return list;
      },
      });

      });​​

      Thanks to rabii

      Comment


      • rabii
        rabii commented
        Editing a comment
        you are welcome
    • yuri
      Member
      • Mar 2014
      • 8452

      #5
      In v8.4 it will be possible to define menu items through metadata: https://github.com/espocrm/espocrm/issues/3080
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      Working...