Change corpus file model to save metadata.

This commit is contained in:
Patrick Jentsch
2019-10-28 15:46:25 +01:00
parent 8a4a7577a0
commit f4c7af02ad
6 changed files with 111 additions and 37 deletions

View File

@ -4,11 +4,6 @@
<div class="col s12 m4">
<h3 id="title">{{ corpus.title }}</h3>
<p id="description">{{ corpus.description }}</p>
<h2>Actions:</h2>
<!-- Confirm deletion of job with modal dialogue
Modal Trigger-->
<a href="#modal-confirm-delete" class="waves-effect waves-light btn red modal-trigger"><i class="material-icons left">delete</i>Delete Corpus</a>
<a href="{{ url_for('main.corpus_analysis', corpus_id=corpus.id) }}" class="waves-effect waves-light btn "><i class="material-icons left">help</i>Analyse</a>
<!-- Modal Strucutre -->
<div id="modal-confirm-delete" class="modal">
<div class="modal-content">
@ -39,7 +34,7 @@
<a href="{{ url_for('main.corpus_analysis', corpus_id=corpus.id) }}" class="waves-effect waves-light btn">
<i class="material-icons left">help</i>Analyse
</a>
<a href="" class="waves-effect waves-light btn">
<a data-target="add-corpus-file-modal" class="waves-effect waves-light btn modal-trigger">
<i class="material-icons left">add</i>Add corpus file
</a>
<a href="#modal-confirm-delete" class="waves-effect waves-light btn red modal-trigger right">
@ -61,33 +56,76 @@
<th>Filename</th>
<th>Author</th>
<th>Title</th>
<th>Publishing year</th>
<th></th>
</tr>
</thead>
<tbody>
{% for file in corpus.files %}
<tr>
<td>Harry Potter.vrt</td>
<td>Stephan Porada</td>
<td>Utopias</td>
<td>{{ file.filename }}</td>
<td>{{ file.author }}</td>
<td>{{ file.title }}</td>
<td>{{ file.publishing_year }}</td>
<td class="right-align">
<a class="waves-effect waves-light btn-small" download="" href="/jobs/1/download?ressource_id=1&amp;ressource_type=input"><i class="material-icons">edit</i></a>
<a class="waves-effect waves-light btn-small" download="" href="/jobs/1/download?ressource_id=1&amp;ressource_type=input"><i class="material-icons">file_download</i></a>
<a class="waves-effect waves-light btn-small red" download="" href="/jobs/1/download?ressource_id=1&amp;ressource_type=input"><i class="material-icons">delete</i></a>
</td>
</tr>
<tr>
<td>Harry Potter.vrt</td>
<td>Stephan Porada</td>
<td>Utopias</td>
<td class="right-align">
<a class="waves-effect waves-light btn-small" download="" href="/jobs/1/download?ressource_id=1&amp;ressource_type=input"><i class="material-icons">edit</i></a>
<a class="waves-effect waves-light btn-small" download="" href="/jobs/1/download?ressource_id=1&amp;ressource_type=input"><i class="material-icons">file_download</i></a>
<a class="waves-effect waves-light btn-small red" download="" href="/jobs/1/download?ressource_id=1&amp;ressource_type=input"><i class="material-icons">delete</i></a>
<a class="waves-effect waves-light btn-small"><i class="material-icons">edit</i></a>
<a class="waves-effect waves-light btn-small"><i class="material-icons">file_download</i></a>
<a class="waves-effect waves-light btn-small red"><i class="material-icons">delete</i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div id="add-corpus-file-modal" class="modal">
<div class="modal-content">
<h4>Add corpus file</h4>
<form method="POST" enctype="multipart/form-data">
{{ add_corpus_file_form.hidden_tag() }}
<div class="row">
<div class="col s12 m8">
<div class="input-field">
<i class="material-icons prefix">person</i>
{{ add_corpus_file_form.author(data_length='64') }}
{{ add_corpus_file_form.author.label }}
{% for error in add_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>
{{ add_corpus_file_form.title(data_length='64') }}
{{ add_corpus_file_form.title.label }}
{% for error in add_corpus_file_form.title.errors %}
<span class="helper-text red-text">{{ error }}</span>
{% endfor %}
</div>
</div>
<div class="col s12">
<div class="file-field input-field">
<div class="btn">
<span>{{ add_corpus_file_form.files.label.text }}</span>
{{ add_corpus_file_form.files(accept='.vrt') }}
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text">
</div>
{% for error in add_corpus_file_form.files.errors %}
<span class="helper-text red-text">{{ error }}</span>
{% endfor %}
</div>
</div>
</div>
<div class="modal-footer">
{{ add_corpus_file_form.submit(class='btn') }}
</div>
</form>
</div>
</div>
{% endblock %}