Banner on every portal page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • czcpf
    Senior Member
    • Aug 2022
    • 160

    Banner on every portal page

    Hello,

    I would like to put a custom div banner on every portal page (preferably between header and main). I suppose that would require overriding header.js or main.js but I do not know how to tell espo to use custom header.js or main.js. Please advise. Espo 8.0.6
  • czcpf
    Senior Member
    • Aug 2022
    • 160

    #2
    I have made progress on this by adding some custom html to portalNavbarView

    clientDefs/App.json

    Code:
    {
    
    "portalNavbarView": "{my-custom-portal-nav-view-path}"
    
    }
    Code:
    define('{my-custom-portal-nav-view-path}', 'views/site-portal/navbar', function (Dep) {
    
    return Dep.extend({​
    
    afterRender: function () {
    Dep.prototype.afterRender.call(this);
    
    this.doSomething();
    
    },​
    
    doSomething: function() {
    //early return if no navbar container present
    if(!this.$navbarRightContainer) {return;}
    
    //add something to navBarRightContainer
    $('<li><p>Hello</p></li>).prependTo(this.$navbarRightContainer.find('ul').first());​
    }
    
    });

    Comment

    Working...