diff options
author | Camil Staps | 2021-06-23 09:21:49 +0200 |
---|---|---|
committer | Camil Staps | 2021-06-23 09:21:49 +0200 |
commit | 351c2a94d368e88d033e4ba53b6b23301fb40a76 (patch) | |
tree | a070929ff1ea937c2cae56e861184a2d3f0be457 /resources | |
parent | Simplify layout-sidebar (diff) |
Replace menuItem mixin in sidebar layout with single menu mixin
Diffstat (limited to 'resources')
-rw-r--r-- | resources/pug/include/layout-ham.pug | 6 | ||||
-rw-r--r-- | resources/pug/include/layout-sidebar.pug | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/resources/pug/include/layout-ham.pug b/resources/pug/include/layout-ham.pug index 1958c78..bb20ef0 100644 --- a/resources/pug/include/layout-ham.pug +++ b/resources/pug/include/layout-ham.pug @@ -5,5 +5,7 @@ block title block append menu - var base_url = '/ham/' - +menuItem('', 'Home') - +menuItem('cw-decoder', 'CW Decoder') + +menu( + {name: 'Home', link: ''}, + {name: 'CW Decoder'}, + ) diff --git a/resources/pug/include/layout-sidebar.pug b/resources/pug/include/layout-sidebar.pug index 75a5f12..68c1ac2 100644 --- a/resources/pug/include/layout-sidebar.pug +++ b/resources/pug/include/layout-sidebar.pug @@ -5,10 +5,13 @@ block content div.col-lg-3.col-md-4 ul.nav.nav-pills.nav-stacked block menu + mixin menu(...items) + each item in items + if typeof item.link == 'undefined' + - item.link = item.name.toLowerCase().replace(/\W/g, '-') - mixin menuItem(link, text) - li(role='presentation', class=(page == link) ? 'active' : '') - a(href=base_url + (link == '' ? '' : link + '.html'))= text + li(role='presentation', class=(page == item.link) ? 'active' : '') + a(href=base_url + (item.link == '' ? '' : item.link + '.html'))= item.name div.col-lg-7.col-md-6 h3 |