<jskom:loading ng-hide="conf"></jskom:loading>

<div ng-show="conf != null" ng-cloak>
  <h2>
    Latest texts in <a href="/conferences/{{conf.conf_no}}">{{ conf | confTitle }}</a>
  </h2>
  
  <div class="row">
    <div class="twelve columns">
      <div class="button-bar">
        <ul class="button-group">
          <li>
            <a href="/conferences/{{conf.conf_no}}/texts/new" class="secondary button">
              <i class="icon-pencil"></i> New text...
            </a>
          </li>
          
          <li>
            <a href="/conferences/{{conf.conf_no}}/set-unread" class="secondary button">
              Set unread...
            </a>
          </li>
        </ul>
        
        <ul class="button-group">
          <li>
            <a href="/conferences/{{conf.conf_no}}" class="secondary button">
              Conference details...
            </a>
          </li>
        </ul>
      </div>
    </div>
  </div>
  
  <div class="row">
    <div class="twelve columns">

      <jskom:loading ng-show="isLoadingTexts"></jskom:loading>
      <table class="twelve" ng-hide="texts == null">
        <thead>
          <tr>
            <th></th>
            <th>Text number</th>
            <th>Date</th>
            <th>Author</th>
          </tr>
        </thead>
        <tbody>
          <tr ng-show="texts.length == 0"><td>No texts</td></tr>

          <tr ng-repeat="text in texts | startFrom:currentPage*pageSize | limitTo:pageSize">
            <td>
              <i class="icon-unread" ng-show="text.text_no|isUnread:membership"></i>
            </td>
            <td>
              <a href="/conferences/{{conf.conf_no}}/texts/?text={{text.text_no}}">
                {{ text.text_no }}
              </a>
            </td>
            <td>{{ text | textDate | dateString }}</td>
            <td>
              <a href="/conferences/{{text.author.pers_no}}">
                {{ text | textAuthor }}
              </a>
            </td>
          </tr>
        </tbody>
      </table>

    <ul class="pagination">
      <li ng-class="{'unavailable': currentPage < 1 }">
        <a ng-click="previousPage()">Previous</a>
      </li>
      <li>{{currentPage+1}} / {{numberOfPages}}</li>
      <li ng-class="{'unavailable': currentPage >= numberOfPages - 1}">
        <a ng-click="nextPage()">Next</a>
      </li>
    </ul>
    </div>
  </div>
  
  <div id="jskomControlBar">
    <div class="row">
      <div class="six mobile-two columns"></div>
      
      <div class="six mobile-two columns">
        <a type="submit" class="button right" ng-disabled="conf == null || membership == null "
           href="/conferences/{{conf.conf_no}}/texts/">
          <i class="icon-arrow-right"></i>
          Read
        </a>
      </div>
    </div>
  </div>
</div>
