{{#if model.categories}}
  <div class='contents'>
    <table id='topic-list' class='categories'>
      <thead>
        <tr>
          <th class='category'>{{i18n categories.category}}</th>
          <th class='latest'>{{i18n categories.latest}}</th>
          <th class='stats topics'>{{i18n categories.topics}}</th>
          <th class='stats posts'>{{i18n categories.posts}}
            {{#if canEdit}}<button title='{{i18n categories.toggle_ordering}}' class='btn toggle-admin no-text' {{action toggleOrdering}}><i class='fa fa-wrench'></i></button>{{/if}}
          </th>
        </tr>
      </thead>
      <tbody>
        {{#each model.categories}}
        <tr data-category_id='{{unbound id}}' {{bindAttr class="description_excerpt:has-description:no-description"}}>
          <td class='category'>
            <div>
              <div class="pull-left">
                {{#if controller.ordering}}<i class="fa fa-bars"></i>{{/if}}
                {{categoryLink this allowUncategorized=true}}
                {{#if unreadTopics}}
                  <a href={{unbound unreadUrl}} class='badge new-posts badge-notification' title='{{i18n topic.unread_topics count="unreadTopics"}}'>{{unbound unreadTopics}}</a>
                {{/if}}
                {{#if newTopics}}
                  <a href={{unbound newUrl}} class='badge new-posts badge-notification' title='{{i18n topic.new_topics count="newTopics"}}'>{{unbound newTopics}} <i class='fa fa-asterisk'></i></a>
                {{/if}}
              </div>
              <div class='featured-users'>
                {{#each featured_users}}
                  <a href="/users/{{unbound username_lower}}">{{avatar this imageSize="small"}}</a>
                {{/each}}
              </div>
              <div class="clearfix"></div>
            </div>
            {{#if description_excerpt}}
              <div class="category-description">
                {{{description_excerpt}}}
              </div>
            {{/if}}
            {{#if subcategories}}
              <div class='subcategories'>
                {{i18n categories.subcategories}}
                {{#each subcategory in subcategories}}
                  {{categoryLink subcategory}}
                {{/each}}
              </div>
            {{/if}}
          </td>
          <td {{bindAttr class="archived :latest"}}>
            {{#each featuredTopics}}
              <div class="featured-topic">
                {{topicStatus topic=this}}
                <a class='title' href="{{unbound lastUnreadUrl}}">{{{unbound fancy_title}}}</a>
                {{#if unread}}
                  <a href="{{unbound lastUnreadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts count="unread"}}'>{{unread}}</a>
                {{/if}}
                {{#if new_posts}}
                  <a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new_posts count="new_posts"}}'>{{new_posts}}</a>
                {{/if}}
                {{#if unseen}}
                  <a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new}}'><i class='fa fa-asterisk'></i></a>
                {{/if}}

                {{#if controller.latestTopicOnly}}
                  <div class='last-user-info'>
                    {{i18n categories.latest_by}} <a href="{{{unbound lastPosterUrl}}}">{{unbound last_poster.username}}</a>
                    <a href="{{unbound lastPostUrl}}">{{unboundAge last_posted_at}}</a>
                  </div>
                {{else}}
                  &nbsp;
                  <a href="{{unbound lastPostUrl}}" class="last-posted-at">{{unboundAge last_posted_at}}</a>
                {{/if}}
              </div>
            {{/each}}
          </td>
          <td class='stats' {{bindAttr title="topicStatsTitle"}}>
            <table class="categoryStats">
              {{#each topicCountStats}}
                <tr>
                  <td class="value">{{value}}</td>
                  <td class="unit">{{unit}}</td>
                </tr>
              {{/each}}
            </table>
          </td>
          <td class='stats' {{bindAttr title="postStatsTitle"}}>
            <table class="categoryStats">
              {{#each postCountStats}}
                <tr>
                  <td class="value">{{value}}</td>
                  <td class="unit">{{unit}}</td>
                </tr>
              {{/each}}
            </table>
          </td>
        </tr>
        {{/each}}
      </tbody>
    </table>
  </div>
  <footer id='topic-list-bottom'></footer>
{{/if}}
