Prior to this commit we had an inline logic check on whether or not to render a navigation link. As we are looking to rollout the feature flag for Listings, we needed to add another somewhat complex conditional. This commit moves the inline conditionals to a helper function, which makes testing the logic far easier. Especially since we need to bombard the tests with the combination of 3 different boolean checks. (And one of those boolean checks requires even more but could be stubbed). There should be no UI differences, as we're presently assuming the Listings feature is enabled. Related to forem/rfcs#291
13 lines
483 B
Text
13 lines
483 B
Text
<% if display_navigation_link?(link: link) %>
|
|
<li>
|
|
<a href="<%= link.url %>" class="sidebar-navigation-link c-link c-link--block c-link--icon-left">
|
|
<span class="c-link__icon">
|
|
<%= link.icon.html_safe %>
|
|
</span>
|
|
<%= t("views.main.nav_name.#{link.name}", default: link.name) %>
|
|
<% if link.url.include?("readinglist") %>
|
|
<span id="reading-list-count" class="c-indicator ml-2 self-center"></span>
|
|
<% end %>
|
|
</a>
|
|
</li>
|
|
<% end %>
|