{% extends "nopaque.html.j2" %}

{% block page_content %}
<div class="col s12 m4">
  <h3 id="title">...</h3>
  <p id="description">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et</p>
  <a class="btn waves-effect waves-light" href="{{ url_for('corpora.corpus', corpus_id=corpus_file.corpus.id) }}"><i class="material-icons left">arrow_back</i>Back to corpus</a>
</div>

<div class="col s12 m8">
  <form method="POST">
  <div class="card">
      <div class="card-content">
        {{ edit_corpus_file_form.hidden_tag() }}
        <div class="row">
          <div class="col s12 m4">
            <div class="input-field">
              <i class="material-icons prefix">person</i>
              {{ edit_corpus_file_form.author(data_length='255', value=corpus_file.author) }}
              {{ edit_corpus_file_form.author.label }}
              {% for error in edit_corpus_file_form.author.errors %}
                <span class="helper-text red-text">{{ error }}</span>
              {% endfor %}
            </div>
          </div>
          <div class="col s12 m4">
            <div class="input-field">
              <i class="material-icons prefix">title</i>
              {{ edit_corpus_file_form.title(data_length='255', value=corpus_file.title) }}
              {{ edit_corpus_file_form.title.label }}
              {% for error in edit_corpus_file_form.title.errors %}
                <span class="helper-text red-text">{{ error }}</span>
              {% endfor %}
            </div>
          </div>
          <div class="col s12 m4">
            <div class="input-field">
              <i class="material-icons prefix">access_time</i>
              {{ edit_corpus_file_form.publishing_year(value=corpus_file.publishing_year) }}
              {{ edit_corpus_file_form.publishing_year.label }}
              {% for error in edit_corpus_file_form.publishing_year.errors %}
                <span class="helper-text red-text">{{ error }}</span>
              {% endfor %}
            </div>
          </div>
        </div>
      </div>
      <div class="card-action right-align">
        {{ macros.submit_button(edit_corpus_file_form.submit) }}
      </div>
    </div>
    <br>
    <ul class="collapsible hoverable">
      <li>
        <div class="collapsible-header"><i class="material-icons">edit</i>Edit additional metadata</div>
        <div class="collapsible-body">
          <span>
            <div class="row">
              <div class="col s12">
                {% for field in edit_corpus_file_form if not (field.name == "file"
                  or field.name == "author"
                  or field.name == "submit"
                  or field.name == "csrf_token"
                  or field.name == "title"
                  or field.name == "publishing_year") %}
                  {{ macros.render_field_with_value(field, corpus_file)}}
                {% endfor %}
              </div>
            </div>
          </span>
        </div>
      </li>
    </ul>
  </form>
</div>
{% endblock %}
