{{#if selected}}
  <div id='bulk-select'>
    <button class='btn' {{action showBulkActions}}><i class="fa fa-wrench"></i></button>
  </div>
{{/if}}

<div class='contents'>
  {{#if showTable}}
    <table id='topic-list'>
      <thead>
      <tr>
        {{#if currentUser}}
        <th>
          {{#if canBulkSelect}}
          <button class='btn bulk-select' {{action toggleBulkSelect}} title="{{i18n topics.bulk.toggle}}"><i class='fa fa-list'></i></button>
          {{/if}}
        </th>
        {{/if}}
        {{#sortable-heading sortBy="default" sortOrder=sortOrder}}
          {{i18n topic.title}}
        {{/sortable-heading}}
        {{#unless controller.hideCategory}}
          {{#sortable-heading sortBy="category" sortOrder=sortOrder}}
            {{i18n category_title}}
          {{/sortable-heading}}
        {{/unless}}
        {{#sortable-heading sortBy="posters" sortOrder=sortOrder}}
          {{i18n users}}
        {{/sortable-heading}}
        {{#sortable-heading sortBy="posts" number=true sortOrder=sortOrder}}
          {{i18n posts}}
        {{/sortable-heading}}
        {{#sortable-heading sortBy="likes" number=true sortOrder=sortOrder}}
          {{i18n likes}}
        {{/sortable-heading}}
        {{#sortable-heading sortBy="views" number=true sortOrder=sortOrder}}
          {{i18n views}}
        {{/sortable-heading}}
        {{#sortable-heading sortBy="activity" number=true colspan="2" sortOrder=sortOrder}}
          {{i18n activity}}
        {{/sortable-heading}}
      </tr>
      </thead>

      {{#if topicTrackingState.hasIncoming}}
        <tbody>
          <tr>
            <td colspan="9">
              <div class='alert alert-info clickable' {{action showInserted}}>
                {{countI18n new_topics_inserted count=topicTrackingState.incomingCount}}
                {{i18n show_new_topics}}
              </div>
            </td>
          </tr>
        </tbody>
      {{/if}}

      {{each topics itemController="topicListItem" itemViewClass="Discourse.TopicListItemView"}}
    </table>
  {{/if}}
</div>

<footer id='topic-list-bottom'>
  {{#if loadingMore}}
    <div class='topics-loading'>{{i18n topic.loading_more}}</div>
  {{/if}}
  {{#if allLoaded}}
    <h3>
      {{#if latest}}
        {{footerMessage}}
        {{#if can_create_topic}}<a href='#' {{action createTopic}}>{{i18n topic.suggest_create_topic}}</a>{{/if}}
      {{else}}
        {{#if top}}
          {{#link-to "discovery.categories"}}{{i18n topic.browse_all_categories}}{{/link-to}}, {{#link-to 'discovery.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}} {{i18n or}} {{i18n filters.top.other_periods}}
          {{#unless yearly}}<a href="{{unbound showMoreYearlyUrl}}" class='btn'>{{i18n filters.top.this_year}}</a>{{/unless}}
          {{#unless monthly}}<a href="{{unbound showMoreMonthlyUrl}}" class='btn'>{{i18n filters.top.this_month}}</a>{{/unless}}
          {{#unless weekly}}<a href="{{unbound showMoreWeeklyUrl}}" class='btn'>{{i18n filters.top.this_week}}</a>{{/unless}}
          {{#unless daily}}<a href="{{unbound showMoreDailyUrl}}" class='btn'>{{i18n filters.top.today}}</a>{{/unless}}
        {{else}}
          {{footerMessage}}{{#link-to "discovery.categories"}} {{i18n topic.browse_all_categories}}{{/link-to}} {{i18n or}} {{#link-to 'discovery.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}}
        {{/if}}
      {{/if}}
    </h3>
  {{/if}}
</footer>
