<p class="well-sm" ng-bind-html="document.description | newline"></p>
<dl class="dl-horizontal">
  <dt ng-if="document.subject">{{ 'document.subject' | translate }}</dt>
  <dd ng-if="document.subject">{{ document.subject }}</dd>
  <dt ng-if="document.identifier">{{ 'document.identifier' | translate }}</dt>
  <dd ng-if="document.identifier">{{ document.identifier }}</dd>
  <dt ng-if="document.publisher">{{ 'document.publisher' | translate }}</dt>
  <dd ng-if="document.publisher">{{ document.publisher }}</dd>
  <dt ng-if="document.format">{{ 'document.format' | translate }}</dt>
  <dd ng-if="document.format">{{ document.format }}</dd>
  <dt ng-if="document.source">{{ 'document.source' | translate }}</dt>
  <dd ng-if="document.source">{{ document.source }}</dd>
  <dt ng-if="document.type">{{ 'document.type' | translate }}</dt>
  <dd ng-if="document.type">{{ document.type }}</dd>
  <dt ng-if="document.coverage">{{ 'document.coverage' | translate }}</dt>
  <dd ng-if="document.coverage">{{ document.coverage }}</dd>
  <dt ng-if="document.rights">{{ 'document.rights' | translate }}</dt>
  <dd ng-if="document.rights">{{ document.rights }}</dd>
  <dt>{{ 'document.contributors' | translate }}</dt>
  <dd>
    <span ng-repeat="contributor in document.contributors">
      <span class="btn btn-link btn-xs">
        <a href="#/user/{{ contributor.username }}">
          {{ contributor.username }}
        </a>
      </span>
    </span>
  </dd>
  <dt ng-if="document.relations.length > 0">{{ 'document.relations' | translate }}</dt>
  <dd ng-if="document.relations.length > 0">
    <span ng-repeat="relation in document.relations">
      <span class="btn btn-link btn-xs">
        <a href="#/document/view/{{ relation.id }}">
          {{ relation.title }}
        </a>
      </span>
    </span>
  </dd>
</dl>

<div class="row upload-zone"
     ngf-drop="fileDropped($files)"
     ngf-drag-over-class="'bg-success'"
     ngf-multiple="true"
     ngf-allow-dir="false">
  <div ui-sortable="fileSortableOptions" ng-model="files">
    <div class="col-xs-6 col-sm-4 col-md-4 col-lg-3 text-center" ng-repeat="file in files">
      <div class="thumbnail handle" ng-if="file.id">
        <a ng-click="openFile(file)">
          <img ng-src="../api/file/{{ file.id }}/data?size=thumb" uib-tooltip="{{ file.mimetype }} | {{ file.size | filesize }}" tooltip-placement="top" />
        </a>
        <div class="caption caption-hover-inverse btn btn-link file-name" ng-click="openFile(file)" ng-if="file.name">{{ file.name }}</div>
        <div class="caption caption-hover" ng-show="document.writable">
          <div class="pull-left">
            <div class="btn btn-default handle"><span class="glyphicon glyphicon-resize-horizontal"></span></div>
          </div>
          <div class="pull-right">
            <button class="btn btn-danger" ng-click="deleteFile(file)"><span class="glyphicon glyphicon-trash"></span></button>
          </div>
          <div class="clearfix"></div>
        </div>
      </div>

      <div class="thumbnail" ng-if="!file.id">
        <p class="text-center lead">
          {{ file.status }}
        </p>
        <div class="caption">
          <uib-progressbar value="file.progress" class="progress-info active"></uib-progressbar>
        </div>
      </div>
    </div>
  </div>

  <p class="text-center well-lg" ng-if="files.length == 0">
    <span class="glyphicon glyphicon-move"></span>
    {{ 'document.view.content.drop_zone' | translate }}
  </p>
</div>

<p class="text-center">
  <button class="btn btn-primary" ngf-select
    ngf-change="fileDropped($files, $event)"
    input-file-multiple="multiple"
    ngf-multiple="true">
    {{ 'document.view.content.add_files' | translate }}
  </button>
</p>

<div ui-view="file"></div>