{% 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 active">{{ collection_name }}</li>
</ol>

<h1 class="page-header">{{ collection_name }}</h1>

{% if corpuses %}
<div class="panel-body">
  {% for corpus in corpuses %}
  <div class="panel panel-default">
    <div class="panel-heading">
      <h3 class="panel-title"><a href="{% url 'visko2:list_doc' collection_name=collection_name corpus_name=corpus.name %}">{{ corpus.name }}</a></h3>
    </div>
    <div class="panel-body">
      <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>
    </div>
  </div>
  {% endfor %}
</div>
{% else %}
There is no corpus.
{% endif %}

<form method="POST" action="{% url 'visko2:create_corpus' collection_name=collection_name %}">
  {% csrf_token %}
  <div class="input-group input-group-lg">
    <input class="form-control input-lg" name="corpus_name" id="corpus_name" placeholder="New Corpus (only alphanumeric or underscore characters are allowed)" value="{{ corpus_name|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>

{% endblock %}
