Unify more tables (Corpus: corpus files view)

This commit is contained in:
Stephan Porada
2020-07-08 15:24:18 +02:00
parent 43f79291aa
commit ea7bb82661
7 changed files with 134 additions and 51 deletions

@ -59,41 +59,34 @@
<div class="col s12">
<div class="card">
<div class="card-content" style="overflow: hidden;">
<div class="card-content" id="corpus-files" style="overflow: hidden;">
<span class="card-title">Files</span>
<div class="input-field">
<i class="material-icons prefix">search</i>
<input id="search-results" class="search" type="search"></input>
<label for="search-results">Search results</label>
</div>
<ul class="pagination paginationTop"></ul>
<table class="highlight responsive-table">
<thead>
<tr>
<th>Filename</th>
<th>Author</th>
<th>Title</th>
<th>Publishing year</th>
<th></th>
<th class="sort" data-sort="filename">Filename</th>
<th class="sort" data-sort="author">Author</th>
<th class="sort" data-sort="title">Title</th>
<th class="sort" data-sort="publishing_year">Publishing year</th>
<th>{# Actions #}</th>
</tr>
</thead>
<tbody>
<tbody class="list">
<tr class="show-if-only-child">
<td colspan="5">
<span class="card-title"><i class="material-icons left">book</i>Nothing here...</span>
<p>Corpus is empty. Add texts using the option below.</p>
</td>
</tr>
{% for file in corpus.files %}
<tr>
<td style="word-break: break-word;">{{ file.filename }}</td>
<td style="word-break: break-word;">{{ file.author }}</td>
<td style="word-break: break-word;">{{ file.title }}</td>
<td>{{ file.publishing_year }}</td>
<td class="right-align">
<a class="btn-floating waves-effect waves-light" href="{{ url_for('corpora.edit_corpus_file', corpus_file_id=file.id, corpus_id=corpus.id) }}"><i class="material-icons">edit</i></a>
<a class="btn-floating waves-effect waves-light" href="{{ url_for('corpora.download_corpus_file', corpus_file_id=file.id, corpus_id=corpus.id) }}"><i class="material-icons">file_download</i></a>
<a data-target="delete-corpus-file-{{ file.id }}-modal" class="btn-floating modal-trigger red waves-effect waves-light"><i class="material-icons">delete</i></a>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<ul class="pagination paginationBottom"></ul>
</div>
<div class="card-action right-align">
<a href="{{ url_for('corpora.add_corpus_file', corpus_id=corpus.id) }}" class="btn waves-effect waves-light"><i class="material-icons left">add</i>Add corpus file</a>
@ -129,6 +122,11 @@
<script>
// create corpus file table
var ressources = {{ corpus_files|tojson|safe }};
var corpusFilesList = new RessourceList("corpus-files", null, "corpus_file");
corpusFilesList.addRessources(ressources);
class InformationUpdater {
constructor(corpusId, foreignCorpusFlag) {
this.corpusId = corpusId;

@ -120,7 +120,7 @@
<tr>
<th>Result Type</th>
<th>Archive Name</th>
<th>Download</th>
<th>{# Actions #}</th>
</tr>
</thead>
<tbody class="results">
@ -159,7 +159,6 @@
<script>
// job_input_table code
var ressources = {{ job_inputs|tojson|safe }};
console.log(ressources);
var jobInputsList = new RessourceList("inputs", null, "job_input");
jobInputsList.addRessources(ressources);
@ -244,9 +243,12 @@
<tr>
<td>${resultType}</td>
<td>${result.filename}</td>
<td>
<a class="btn-floating waves-effect waves-light" download href="/jobs/${result.job_id}/results/${result.id}/download">
<i class="material-icons left">file_download</i>
<td class="center-align">
<a class="btn-floating tooltipped waves-effect waves-light"
download href="/jobs/${result.job_id}/results/${result.id}/download"
data-position="top"
data-tooltip="Download">
<i class="material-icons">file_download</i>
</a>
</td>
</tr>

@ -85,7 +85,8 @@
</button>
{% endmacro %}
{% macro delete_modal_file(file) %}
{# maybe create a modal template later on for actions like delete etc #}
{# {% macro delete_modal_file(file) %}
<div id="delete-corpus-file-{{ file.id }}-modal" class="modal">
<div class="modal-content">
<h4>Confirm corpus file deletion</h4>
@ -96,4 +97,4 @@
<a class="btn modal-close red waves-effect waves-light" href="{{ url_for('corpora.delete_corpus_file', corpus_file_id=resource_id, corpus_id=corpus.id) }}"><i class="material-icons left">delete</i>Delete</a>
</div>
</div>
{% endmacro %}
{% endmacro %} #}