Merge branch 'development' of gitlab.ub.uni-bielefeld.de:sfb1288inf/opaque into development

This commit is contained in:
Patrick Jentsch 2019-10-24 13:29:09 +02:00
commit 409d94d0ae
25 changed files with 128 additions and 37 deletions

View File

@ -6,6 +6,7 @@ from . import main
from .forms import CreateCorpusForm from .forms import CreateCorpusForm
from .. import db from .. import db
from ..models import Corpus, CorpusFile, Job from ..models import Corpus, CorpusFile, Job
from werkzeug.utils import secure_filename
import os import os
import threading import threading
@ -38,7 +39,7 @@ def corpus(corpus_id):
return render_template('main/corpora/corpus.html.j2', return render_template('main/corpora/corpus.html.j2',
corpus=corpus, corpus=corpus,
files=files, files=files,
title='Corpus') title='Corpus: ' + corpus.title)
@main.route('/corpora/<int:corpus_id>/download') @main.route('/corpora/<int:corpus_id>/download')
@ -61,6 +62,15 @@ def corpus_download(corpus_id):
filename=file) filename=file)
@main.route('/corpora/<int:corpus_id>/analysis')
@login_required
def corpus_analysis(corpus_id):
corpus = Corpus.query.get_or_404(corpus_id)
return render_template('main/corpora/corpus_analysis.html.j2',
corpus=corpus,
title='Corpus: ' + corpus.title)
@main.route('/dashboard', methods=['GET', 'POST']) @main.route('/dashboard', methods=['GET', 'POST'])
@login_required @login_required
def dashboard(): def dashboard():
@ -85,15 +95,16 @@ def dashboard():
flash('OSError!') flash('OSError!')
else: else:
for file in create_corpus_form.files.data: for file in create_corpus_form.files.data:
file.save(os.path.join(dir, file.filename)) filename = secure_filename(file.filename)
dir = os.path.join(str(corpus.user_id), file.save(os.path.join(dir, filename))
'corpora', file_dir = os.path.join(str(corpus.user_id),
str(corpus.id)) 'corpora',
corpus_file = CorpusFile(filename=file.filename, str(corpus.id))
corpus_file = CorpusFile(filename=filename,
corpus_id=corpus.id, corpus_id=corpus.id,
dir=dir) dir=file_dir)
db.session.add(corpus_file) db.session.add(corpus_file)
db.session.commit() db.session.commit()
flash('Corpus created!') flash('Corpus created!')
return redirect(url_for('main.dashboard')) return redirect(url_for('main.dashboard'))

View File

@ -53,7 +53,6 @@ def service(service_handle):
db.session.commit() db.session.commit()
else: else:
for file in new_job_form.files.data: for file in new_job_form.files.data:
''' TODO: Use secure filename '''
filename = secure_filename(file.filename) filename = secure_filename(file.filename)
file.save(os.path.join(dir, filename)) file.save(os.path.join(dir, filename))
job_input = JobInput( job_input = JobInput(

View File

@ -73,3 +73,11 @@ indicator will show up how the column is sorted right now.; */
top:-10px; top:-10px;
right:-5px; right:-5px;
} }
/* Sticy side elements */
.sticky {
position: -webkit-sticky;
position: sticky;
top: 80px;
padding: 50px;
}

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="page-header"> <div class="page-header">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="page-header"> <div class="page-header">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="page-header"> <div class="page-header">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "full_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="col s12"> <div class="col s12">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="col s12 m6"> <div class="col s12 m6">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="col s12 m8"> <div class="col s12 m8">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="col s12 m4"> <div class="col s12 m4">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="col s12 m4"> <div class="col s12 m4">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="col s12 m4"> <div class="col s12 m4">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="col s12 m4"> <div class="col s12 m4">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block title %}Opaque - Confirm your account{% endblock %} {% block title %}Opaque - Confirm your account{% endblock %}

View File

@ -24,8 +24,8 @@
{% if current_user.is_dark == True %} {% if current_user.is_dark == True %}
DarkReader.enable({ DarkReader.enable({
brightness: 100, brightness: 100,
contrast: 90, contrast: 100,
sepia: 10 sepia: 0
}); });
{% else %} {% else %}
DarkReader.disable(); DarkReader.disable();
@ -182,15 +182,9 @@
</header> </header>
<main class="grey lighten-5"> <main class="grey lighten-5">
<div class="container"> {% block main_block %}
<div class="row">
<div class="col s12">
<h2>{% if title %}{{ title }}{% else %}Unnamed page{% endif %}</h2>
</div>
{% block page_content %}
{% endblock %} {% endblock %}
</div>
</div>
</main> </main>
<footer class="page-footer"> <footer class="page-footer">

View File

@ -0,0 +1,11 @@
{% extends "base.html.j2" %}
{% block main_block %}
<div class="row">
<div class="col s12">
<h2>{% if title %}{{ title }}{% else %}Unnamed page{% endif %}</h2>
</div>
{% block page_content %}
{% endblock %}
</div>
{% endblock %}

View File

@ -0,0 +1,13 @@
{% extends "base.html.j2" %}
{% block main_block %}
<div class="container">
<div class="row">
<div class="col s12">
<h2>{% if title %}{{ title }}{% else %}Unnamed page{% endif %}</h2>
</div>
{% block page_content %}
{% endblock %}
</div>
</div>
{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<script> <script>
@ -84,6 +84,7 @@
<!-- Confirm deletion of job with modal dialogue <!-- Confirm deletion of job with modal dialogue
Modal Trigger--> 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="#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 --> <!-- Modal Strucutre -->
<div id="modal-confirm-delete" class="modal"> <div id="modal-confirm-delete" class="modal">
<div class="modal-content"> <div class="modal-content">

View File

@ -0,0 +1,54 @@
{% extends "full_width.html.j2" %}
{% block page_content %}
<div class="col s12 m9 l9">
<div class="card">
<div class="card-content">
<span class="card-title">Query Results</span>
<table class="responsive highlight">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
{% for i in range(0,51) %}
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
{% endfor %}
</table>
</div>
</div>
</div>
<div class="col s12 m3 l3 sticky">
<div class="card">
<div class="card-content">
<span class="card-title">Card Title</span>
<table class="responsive highlight">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
</div>
</div>
</div>
{% endblock %}

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="col s12 m4"> <div class="col s12 m4">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="col s12 m4"> <div class="col s12 m4">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<script> <script>

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="col s12 m4"> <div class="col s12 m4">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="col s12 m4"> <div class="col s12 m4">

View File

@ -1,4 +1,4 @@
{% extends "base.html.j2" %} {% extends "limited_width.html.j2" %}
{% block page_content %} {% block page_content %}
<div class="col s12 m4"> <div class="col s12 m4">