A handlebars template is used to display widgets. This provides the HTML which is always filled with the current data from the widget class.
In addition to simple placeholders such as {{NoEntries}} handlebars also allow to use control structures such as {{#each items}}.
<div class="jr-dashboard-container">
<ul class="jr-dashboard-list">{{#each items}}
<li class="jr-dashboard-list-item">
{{#if this.value}}
<span class="jr-dashboard-list-value">{{this.value}}</span>
{{/if}}
{{#if this.label}}
<span class="jr-dashboard-list-label">{{this.label}}</span>
{{/if}}
</li>
{{else}}
<p class="jr-dashboard-empty-widget">{{noEntries}}</p>
{{/each}}
</ul>
</div>
Please note: If you have not implemented a getTemplate method in your Widget class, the handlebars template must be stored exactly as template.hbs in the widget folder. A different name for the file causes the widget to be displayed empty.