<div class="container">
  <div class='directory'>

    <div class='clearfix'>
      {{period-chooser period=period}}
      {{text-field value=nameInput placeholderKey="directory.filter_name" class="filter-name"}}
    </div>

    {{#loading-spinner condition=model.loading}}
      {{#if model.length}}
        <div class='total-rows'>{{i18n "directory.total_rows" count=model.totalRows}}</div>

        <table>
          <thead>
            <th>&nbsp;</th>
            {{directory-toggle field="likes_received" order=order asc=asc icon="heart"}}
            {{directory-toggle field="likes_given" order=order asc=asc icon="heart"}}
            {{directory-toggle field="topic_count" order=order asc=asc}}
            {{directory-toggle field="post_count" order=order asc=asc}}
            {{directory-toggle field="topics_entered" order=order asc=asc}}
            {{directory-toggle field="posts_read" order=order asc=asc}}
            {{directory-toggle field="days_visited" order=order asc=asc}}
            {{#if showTimeRead}}
              <th>{{i18n "directory.time_read"}}</th>
            {{/if}}
          </thead>
          <tbody>
            {{#each item in model itemController="directory-item"}}
              <tr {{bind-attr class="item.me"}}>
                <td>{{user-small user=item.model.user}}</td>
                <td>{{number item.model.likes_received}}</td>
                <td>{{number item.model.likes_given}}</td>
                <td>{{number item.model.topic_count}}</td>
                <td>{{number item.model.post_count}}</td>
                <td>{{number item.model.topics_entered}}</td>
                <td>{{number item.model.posts_read}}</td>
                <td>{{number item.model.days_visited}}</td>
                {{#if showTimeRead}}
                <td><span class='time-read'>{{unbound item.model.time_read}}</span></td>
                {{/if}}
              </tr>
            {{/each}}
          </tbody>
        </table>

        {{loading-spinner condition=model.loadingMore}}
      {{else}}
        <div class='clearfix'></div>
        <p>{{i18n "directory.no_results"}}</p>
      {{/if}}
    {{/loading-spinner}}

  </div>
</div>
