0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Updated navigation.hbs to use {{link_class}}

closes: #5162

- We no longer have to implement funky current logic, our link_class helper will do this for us
- We use {{concat}} to pass an extra class for the li, so we don't end up with a random space
This commit is contained in:
Hannah Wolfe 2019-07-18 22:37:08 +01:00 committed by Hannah Wolfe
parent b48fdaf1be
commit bbfea086b3
2 changed files with 3 additions and 1 deletions

View file

@ -1,5 +1,5 @@
<ul class="nav" role="menu">
{{#foreach navigation}}
<li class="nav-{{slug}}{{#if current}} nav-current{{/if}}" role="menuitem"><a href="{{url absolute="true"}}">{{label}}</a></li>
<li class="{{link_class for=(url) class=(concat "nav-" slug)}}" role="menuitem"><a href="{{url absolute="true"}}">{{label}}</a></li>
{{/foreach}}
</ul>

View file

@ -21,6 +21,8 @@ describe('{{navigation}} helper', function () {
// The navigation partial expects this helper
// @TODO: change to register with Ghost's own registration tools
hbs.registerHelper('link_class', helpers.link_class);
hbs.registerHelper('concat', helpers.concat);
hbs.registerHelper('url', helpers.url);
hbs.registerHelper('foreach', helpers.foreach);
});