<div class="content-box shadow-z-1">
  <h3 class="text-primary flex items-center">
    <span>{{data.collection.name || 'Link collection'}}</span>
    <small class="badge bg-primary collection-counter">{{getCollection(data.active).size || data.collection.links.length}}</small>
  </h3>
  <div style="height: 500px" ng-if="!data.collection._id">
    <div class="alert alert-dismissible alert-warning">
      <button type="button" class="close" data-dismiss="alert">×</button>
      <p>This collection is not available, sorry.</p>
    </div>
  </div>

  <div style="height: 500px" ng-if="!data.collection.links.length">
    <div class="alert alert-dismissible alert-success">
      <button type="button" class="close" data-dismiss="alert">×</button>
      <p>There are no more links in this collection.</p>
    </div>
  </div>

  <div class="row">
    <div class="col-md-12">
      <div class="row">
        <div class="col-md-8"></div>
        <div class="col-md-4">
          <div class="form-group search-form">
            <div class="input-group">
              <span class="input-group-addon"><i class="glyphicon glyphicon-search"></i></span>
              <input class="form-control" ng-model="data.search" ng-change="onSearchUpdated()" placeholder="Search ...">
            </div>
          </div>
        </div>
      </div>

      <table class="table table-striped table-hover" ng-if="data.collection.links.length">
        <thead>
          <tr>
            <th class="col-md-6">Link</th>
            <th>Description</th>
            <th>Date</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-repeat="l in data.collection.links | filter:search | orderBy:'-date'">
            <td><a href="{{l.url}}" target="_blank">{{l.url}}</a></td>
            <td>{{l.description}}</td>
            <td>{{l.date | date : 'MMM d, y h:mm a'}}</td>
          </tr>
        </tbody>
      </table>
    </div>
    
  </div>

  <nav>
    <ul class="pager">
        <li class="previous" ng-class="{ disabled: data.currentPage == 1 }"><a href="javascript:void(0)" ng-click="movePage(-1)"><span aria-hidden="true">&larr;</span> Previous</a></li>
        <span class="text-small">Page {{ data.currentPage }} / {{ data.numPages }}</span>
        <li class="next" ng-class="{ disabled: data.currentPage == data.numPages }"><a href="javascript:void(0)" ng-click="movePage(+1)">Next <span aria-hidden="true">&rarr;</span></a></li>
    </ul>
  </nav>

</div>