{% extends 'visko2/base.html' %}
{% load staticfiles %}

{% block content %}

<ol class="breadcrumb">
  <li class="breadcrumb-item"><a href="{% url 'visko2:list_collection' %}">Collections</a></li>
  <li class="breadcrumb-item"><a href="{% url 'visko2:list_corpus' collection_name=collection_name %}">{{ collection_name }}</a></li>
  <li class="breadcrumb-item active">{{ corpus.name }}</li>
</ol>

<h1 class="page-header">{{ corpus.name }}</h1>

<form method="POST" action="{% url 'visko2:create_doc' collection_name=collection_name corpus_name=corpus.name %}" style="padding-bottom: 20px;">
  {% csrf_token %}
  <div class="input-group input-group-lg">
    <input class="form-control" name="doc_name" id="doc_name" placeholder="Unique name (only alphanumeric or underscore characters are allowed)" value="{{ doc_name|default:'' }}" type="text">
    <span class="input-group-addon">-</span>
    <input class="form-control" name="doc_title" id="doc_title" placeholder="Title (optional)" value="{{ doc_title|default:'' }}" type="text">
    <span class="input-group-btn">
      <button class="btn btn-default btn-lg" name="action" type="submit" value="cached">Create</button>
    </span>
  </div>
</form>

{% if corpus and corpus.documents %}
<div class="list-group">
  {% for doc in corpus.documents %}
  <a href="{% url 'visko2:list_sent' collection_name=collection_name corpus_name=corpus.name doc_id=doc.ID %}" class="list-group-item">
    {% if doc.title %}{{ doc.title }}{% else %}{{doc.name}}{% endif %}
    {% if doc.sent_count %}({{doc.sent_count}}){% endif %}
  </a>
  {% endfor %}
</div>
{% else %}
There is no document.
{% endif %}

{% endblock %}
