diff --git a/app/jobs/views.py b/app/jobs/views.py index e713fb71..ec22ccd7 100644 --- a/app/jobs/views.py +++ b/app/jobs/views.py @@ -20,10 +20,11 @@ def job(job_id): @jobs.route('//delete') @login_required def delete_job(job_id): - delete_thread = threading.Thread( - target=background_delete_job, - args=(current_app._get_current_object(), job_id) - ) + job = Job.query.get_or_404(job_id) + if not (job.creator == current_user or current_user.is_administrator()): + abort(403) + delete_thread = threading.Thread(target=background_delete_job, + args=(current_app, job_id)) delete_thread.start() flash('Job has been deleted!') return redirect(url_for('main.dashboard')) diff --git a/app/templates/corpora/corpus.html.j2 b/app/templates/corpora/corpus.html.j2 index 97740799..fbcf321b 100644 --- a/app/templates/corpora/corpus.html.j2 +++ b/app/templates/corpora/corpus.html.j2 @@ -55,7 +55,7 @@ edit file_download - delete + delete {% endfor %} @@ -79,4 +79,17 @@ Confirmsend + +{% for file in corpus.files %} + +{% endfor %} {% endblock %} diff --git a/app/templates/jobs/job.html.j2 b/app/templates/jobs/job.html.j2 index 2c7d064a..512dc734 100644 --- a/app/templates/jobs/job.html.j2 +++ b/app/templates/jobs/job.html.j2 @@ -31,6 +31,8 @@ this.job = jobs[this.jobId]; } + // End date + this.setEndDate(this.job.end_date); // Status this.setStatus(this.job.status); // End date @@ -73,7 +75,13 @@ } setEndDate(timestamp) { - document.getElementById("end-date").value = new Date(timestamp * 1000).toLocaleString(); + var end_date; + if (timestamp === null) { + end_date = "N.a."; + } else { + end_date = new Date(timestamp * 1000).toLocaleString(); + } + document.getElementById("end-date").value = end_date; M.updateTextFields(); }