30 lines
949 B
Plaintext
30 lines
949 B
Plaintext
<% function build_list(categories) {
|
|
return categories.map(category => {
|
|
let result = `<li>
|
|
<a class="level is-marginless" href="${category.url}">
|
|
<span class="level-start">
|
|
<span class="level-item">${category.name}</span>
|
|
</span>
|
|
<span class="level-end">
|
|
<span class="level-item tag">${category.count}</span>
|
|
</span>
|
|
</a>`;
|
|
if (category.hasOwnProperty('children')) {
|
|
result += '<ul>' + build_list(category.children) + '</ul>';
|
|
}
|
|
return result + '</li>';
|
|
}).join('');
|
|
}
|
|
%>
|
|
<div class="card widget">
|
|
<div class="card-content">
|
|
<div class="menu">
|
|
<h3 class="menu-label">
|
|
<%= _p('common.category', Infinity) %>
|
|
</h3>
|
|
<ul class="menu-list">
|
|
<%- build_list(_list_categories()) %>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div> |