How to get a list of all the categories in a handle bar template?


(Webtrend Inc) #1

I am trying to modify a template and would like to get a list of all the available categories (preferably with the color and url). I am seeing a code like the following in one of the existing template. However, I am not sure how do I loop through the categories.

{{#if category}}
  <a href {{action "expand"}} class="badge-category" style={{badgeStyle}} aria-label={{i18n 'categories.category_list'}} aria-expanded={{expanded}}>
    <span class="badge-category-bg" style={{categoryColor}}></span>
    {{#if category.read_restricted}}
      {{fa-icon "lock"}}
    {{/if}}
    {{category.name}}
  </a>
{{else}}
  {{#if noSubcategories}}
    <a href {{action "expand"}} class='badge-category home' style={{badgeStyle}} aria-label={{i18n 'categories.category_list'}} aria-expanded={{expanded}}>{{i18n 'categories.no_subcategory'}}</a>
  {{else}}
    <a href {{action "expand"}} class='badge-category home' style={{badgeStyle}} aria-label={{i18n 'categories.category_list'}} aria-expanded={{expanded}}>{{allCategoriesLabel}}</a>
  {{/if}}
{{/if}}