mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Add first Corpus analysis page
This commit is contained in:
parent
dce834c9a1
commit
3e622ac553
@ -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'))
|
||||||
|
|
||||||
|
@ -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(filename=filename, job=job)
|
job_input = JobInput(filename=filename, job=job)
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user