Implement "href" options in menu config

This commit is contained in:
Niko 2022-03-14 19:48:26 +01:00
parent 9d2e1ca35d
commit 2ad27897fe
2 changed files with 3 additions and 1 deletions

View File

@ -29,7 +29,7 @@ app.menus = {
maxwidth: 35, maxwidth: 35,
items: [ items: [
{ text: 's:nav.profile', fa: 'user', { text: 's:nav.profile', fa: 'user',
onclick: "alert('user')" }, href: "settings/profile" },
{ separator: true }, { separator: true },
], ],
}, },

View File

@ -52,6 +52,8 @@ app.menu = {
item.isItem = item.separator === undefined; item.isItem = item.separator === undefined;
item.isSep = item.separator === true; item.isSep = item.separator === true;
item.class = item.class || ''; item.class = item.class || '';
if (item.href !== undefined && item.onclick === undefined)
item.onclick = "hashredir('"+item.href+"')";
content += app.template.fill(item, v); content += app.template.fill(item, v);
} }
return content; return content;