Add an image or company logo to the header bar widget of your application.
Before you begin:
-
The following is assumed:
-
Open the project_dir/customization/custom_project_dir/js/MyHeaderBarWidget.tpl.html file with a text editor.
-
Inside the div element add an <img> tag, and set its
src attribute to the path to your image. Save your changes:
<div>
<img src="./resources/img/my_logo.jpg"/>
Applications started: <b class="MyHeaderBarWidget-counter"></b>
<span data-i18n="mycusto.window.currentTitle"></span> : <b class="MyHeaderBarWidget-title"></b>
</div>
In
this example your can see:
-
Open your project_dir/customization/custom_project_dir/MyMainContainerWidget.js file.
The header bar widget is added. Check that the main container class has code that adds the
header bar class as a child of the main container
widget.
"use strict";
modulum('MyMainContainerWidget', ['WidgetGroupBase', 'WidgetFactory'],
...
constructor: function() {
$super.constructor.call(this);
var headerBar = new cls.MyHeaderBarWidget();
headerBar.setParentWidget(this);
this.getElement().querySelector("header").appendChild(headerBar.getElement());
}
};
});
cls.WidgetFactory.register('MainContainer', cls.MyMainContainerWidget);
});
In
the highlighted code in the JavaScript example, you can see:
- The variable headerBar references an instance of the
MyHeaderBarWidget class.
- The .getElement().querySelector method inserts the header bar widget as a child
of the header element in the main container element of the interface.
-
In your project_dir/customization/custom_project_dir/scss/customization.scss file add a reference to the
MyMainContainerWidget.scss. In this example we import the
MyMainContainerWidget style.
@import "MyMainContainerWidget";
-
Rebuild using grunt.
-
Test the image is displayed as expected by closing and reopening your application.
Tip: You may need to use CTRL + F5 to clear the browser cache
before you see your changes.