From d08014dbbe0a7923fdc9091b96fdd81da319ebc7 Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Mon, 2 Mar 2020 14:05:31 +0100 Subject: [PATCH 1/4] First implementation of a feedback formular --- app/main/forms.py | 12 ++++++++++ app/main/views.py | 14 ++++++++++++ app/templates/auth/register.html.j2 | 2 +- app/templates/main/feedback.html.j2 | 35 +++++++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 app/main/forms.py create mode 100644 app/templates/main/feedback.html.j2 diff --git a/app/main/forms.py b/app/main/forms.py new file mode 100644 index 00000000..d209a6ba --- /dev/null +++ b/app/main/forms.py @@ -0,0 +1,12 @@ +from flask_wtf import FlaskForm +from wtforms import DecimalField, StringField, SubmitField, TextAreaField +from wtforms.validators import DataRequired, Email, Length, NumberRange + + +class FeedbackForm(FlaskForm): + email = StringField('Email', validators=[DataRequired(), Email()]) + feedback = TextAreaField('Feedback', validators=[Length(0, 255)]) + like_range = DecimalField('How would you rate nopaque?', + validators=[DataRequired(), + NumberRange(min=1, max=10)]) + submit = SubmitField('Send feedback') diff --git a/app/main/views.py b/app/main/views.py index 65f02548..8f855399 100644 --- a/app/main/views.py +++ b/app/main/views.py @@ -1,8 +1,10 @@ +from app import logger from app.auth.forms import LoginForm from app.models import User from flask import flash, redirect, render_template, url_for from flask_login import login_required, login_user from . import main +from .forms import FeedbackForm @main.route('/', methods=['GET', 'POST']) @@ -26,6 +28,18 @@ def dashboard(): return render_template('main/dashboard.html.j2', title='Dashboard') +@main.route('/feedback', methods=['GET', 'POST']) +@login_required +def feedback(): + feedback_form = FeedbackForm(prefix='feedback-form') + if feedback_form.validate_on_submit(): + logger.warning(feedback_form.email) + logger.warning(feedback_form.feedback) + logger.warning(feedback_form.like_range) + return render_template('main/feedback.html.j2', + feedback_form=feedback_form, title='Feedback') + + @main.route('/poster', methods=['GET', 'POST']) def poster(): login_form = LoginForm(prefix='login-form') diff --git a/app/templates/auth/register.html.j2 b/app/templates/auth/register.html.j2 index 35ff2436..bb39bdce 100644 --- a/app/templates/auth/register.html.j2 +++ b/app/templates/auth/register.html.j2 @@ -50,7 +50,7 @@ {{ error }} {% endfor %} -
+
email {{ registration_form.email(class='validate', type='email') }} {{ registration_form.email.label }} diff --git a/app/templates/main/feedback.html.j2 b/app/templates/main/feedback.html.j2 new file mode 100644 index 00000000..99facaa9 --- /dev/null +++ b/app/templates/main/feedback.html.j2 @@ -0,0 +1,35 @@ +{% extends "nopaque.html.j2" %} + +{% block page_content %} + +
+
+
+ {{ feedback_form.hidden_tag() }} +
+

+ {{ feedback_form.like_range.label }} + {{ feedback_form.like_range(class='validate', type='range', min=1, max=10) }} +

+
+ email + {{ feedback_form.email(class='validate', type='email') }} + {{ feedback_form.email.label }} + {% for error in feedback_form.email.errors %} + {{ error }} + {% endfor %} +
+
+ mode_edit + {{ feedback_form.feedback(class='materialize-textarea', data_length='255') }} + {{ feedback_form.feedback.label }} +
+
+
+ {{ macros.submit_button(feedback_form.submit) }} +
+
+
+
+ +{% endblock %} From 98155e5d25325863cecdb5540718c73c83652b8e Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Mon, 2 Mar 2020 14:08:49 +0100 Subject: [PATCH 2/4] Update --- app/templates/main/feedback.html.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/main/feedback.html.j2 b/app/templates/main/feedback.html.j2 index 99facaa9..eef11d7e 100644 --- a/app/templates/main/feedback.html.j2 +++ b/app/templates/main/feedback.html.j2 @@ -21,7 +21,7 @@
mode_edit - {{ feedback_form.feedback(class='materialize-textarea', data_length='255') }} + {{ feedback_form.feedback(class='materialize-textarea', data_length=255) }} {{ feedback_form.feedback.label }}
From 9912017d7801c070c46ffa2c73dfb1c8b792f70f Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Mon, 2 Mar 2020 14:13:32 +0100 Subject: [PATCH 3/4] csrf token immediatly after form tag --- app/templates/auth/login.html.j2 | 2 +- app/templates/auth/register.html.j2 | 2 +- app/templates/auth/reset_password.html.j2 | 2 +- .../auth/reset_password_request.html.j2 | 2 +- app/templates/corpora/add_corpus.html.j2 | 2 +- app/templates/corpora/add_corpus_file.html.j2 | 4 +- .../corpora/edit_corpus_file.html.j2 | 4 +- app/templates/main/poster.html.j2 | 2 +- app/templates/main/poster2.html.j2 | 264 ------------------ app/templates/profile/settings.html.j2 | 10 +- app/templates/services/nlp.html.j2 | 2 +- app/templates/services/ocr.html.j2 | 2 +- app/templates/services/setup_files.html.j2 | 2 +- 13 files changed, 18 insertions(+), 282 deletions(-) delete mode 100644 app/templates/main/poster2.html.j2 diff --git a/app/templates/auth/login.html.j2 b/app/templates/auth/login.html.j2 index ce6ab69f..6f57d209 100644 --- a/app/templates/auth/login.html.j2 +++ b/app/templates/auth/login.html.j2 @@ -26,8 +26,8 @@
+ {{ login_form.hidden_tag() }}
- {{ login_form.hidden_tag() }}
person {{ login_form.user(class='validate') }} diff --git a/app/templates/auth/register.html.j2 b/app/templates/auth/register.html.j2 index bb39bdce..8b38326a 100644 --- a/app/templates/auth/register.html.j2 +++ b/app/templates/auth/register.html.j2 @@ -24,8 +24,8 @@
+ {{ registration_form.hidden_tag() }}
- {{ registration_form.hidden_tag() }}
person {{ registration_form.username(class='validate', data_length='64') }} diff --git a/app/templates/auth/reset_password.html.j2 b/app/templates/auth/reset_password.html.j2 index 6b947b69..5c6740cf 100644 --- a/app/templates/auth/reset_password.html.j2 +++ b/app/templates/auth/reset_password.html.j2 @@ -9,8 +9,8 @@
+ {{ reset_password_form.hidden_tag() }}
- {{ reset_password_form.hidden_tag() }}
{{ reset_password_form.password(class='validate') }} {{ reset_password_form.password.label }} diff --git a/app/templates/auth/reset_password_request.html.j2 b/app/templates/auth/reset_password_request.html.j2 index 9145e52f..9ea8d8ea 100644 --- a/app/templates/auth/reset_password_request.html.j2 +++ b/app/templates/auth/reset_password_request.html.j2 @@ -8,8 +8,8 @@
+ {{ reset_password_request_form.hidden_tag() }}
- {{ reset_password_request_form.hidden_tag() }}
{{ reset_password_request_form.email(class='validate', type='email') }} {{ reset_password_request_form.email.label }} diff --git a/app/templates/corpora/add_corpus.html.j2 b/app/templates/corpora/add_corpus.html.j2 index a93a7088..39e33abf 100644 --- a/app/templates/corpora/add_corpus.html.j2 +++ b/app/templates/corpora/add_corpus.html.j2 @@ -9,8 +9,8 @@
+ {{ add_corpus_form.hidden_tag() }}
- {{ add_corpus_form.hidden_tag() }}
diff --git a/app/templates/corpora/add_corpus_file.html.j2 b/app/templates/corpora/add_corpus_file.html.j2 index 479b4b62..f792f0fe 100644 --- a/app/templates/corpora/add_corpus_file.html.j2 +++ b/app/templates/corpora/add_corpus_file.html.j2 @@ -9,10 +9,10 @@
-
+ {{ add_corpus_file_form.hidden_tag() }} +
Required metadata - {{ add_corpus_file_form.hidden_tag() }}
diff --git a/app/templates/corpora/edit_corpus_file.html.j2 b/app/templates/corpora/edit_corpus_file.html.j2 index 7a07855a..1c7ef7ef 100644 --- a/app/templates/corpora/edit_corpus_file.html.j2 +++ b/app/templates/corpora/edit_corpus_file.html.j2 @@ -9,9 +9,9 @@
-
+ {{ edit_corpus_file_form.hidden_tag() }} +
- {{ edit_corpus_file_form.hidden_tag() }}
diff --git a/app/templates/main/poster.html.j2 b/app/templates/main/poster.html.j2 index 735715d9..ee5b0a9e 100644 --- a/app/templates/main/poster.html.j2 +++ b/app/templates/main/poster.html.j2 @@ -163,9 +163,9 @@
+ {{ login_form.hidden_tag() }}
Registration and Log in - {{ login_form.hidden_tag() }}
person {{ login_form.user(class='validate') }} diff --git a/app/templates/main/poster2.html.j2 b/app/templates/main/poster2.html.j2 deleted file mode 100644 index 0173042d..00000000 --- a/app/templates/main/poster2.html.j2 +++ /dev/null @@ -1,264 +0,0 @@ -{% extends "nopaque.html.j2" %} - -{% block page_content %} - - -
-
-
- burst_modeFile Setup -

- Häufig liegen Digitalisate textueller Foschungsdaten (Bücher, Briefe etc.) in mehreren Dateien und Formaten vor. Nopaque ermöglicht die Konvertierung und Zusammenfassung in ein einheitliches Datenformat, was eine vereinfachte Weiterverarbeitung mit weiteren Services ermöglicht. -

-
-
-
-
- File - -
-
- -
-
-
-
-

 

- -
-
-
-
-
-
-
-
- -
-
-
- Ausgabe -

Nach Eingabeateinamen sortierte Multipage-TIFF-Dateien.

-
-
-

-

- Umgesetzt mit ImageMagick
- als Docker Swarm Service -
-

-
-
-
-
- -
- -
-
-
- find_in_pageOptical Character Recognition -

- Durch optische Analysemethoden werden aus Bilddaten, wie Fotos oder - Scans, Textdateien erzeugt. Erst dieser Vorverarbeitungsschritt - ermöglicht eine weitere computergestützte Verarbeitung von Dokumenten. -

-
-
-
-
- File - -
-
- -
-
-
-
-

 

- -
-
-
-
-
-
-
-
- -
-
-
- Ausgabe -

- Textdateien, PDF-Dateien und TEI P5 konforme XML-Dateien. -

-
-
-

-

- Pipelineumsetzung mit Tesseract OCR
- als Docker Swarm Service -
-

-
-
-
-
- -
- -
-
-
- format_textdirection_l_to_rNatural Language Processing -

- Mit Hilfe computergestützter linguistischer Datenverarbeitungsmethoden - (Tokenisierung, Lemmatisierung, Part-of-speech-Tagging und - Eigennamenerkennung) werden Textdateien mit weiteren Informationen ausgezeichnet. -

-
-
-
-
- File - -
-
- -
-
-
-
-

 

- -
-
-
-
-
-
-
-
- -
-
-
- Ausgabe -

Korpusdateien im verticalized text-Format (XML-Dialekt, Ähnelt CoNLL).

-
-
-

-

- Pipelineumsetzung mit spaCy
- als Docker Swarm Service -
-

-
-
-
-
- -
- -
-
-
- searchCorpus Analysis -

- Mittels CQP Query Language können komplexe Suchanfragen unter - Zuhilfenahme von Metadaten und NLP-Auszeichnungen an eigens erstellte - Korpora gestellt werden. Ergebnisse können als Text oder in abstrakter Darstellung ausgewertet werden. -

-
- search - -
- subdirectory_arrow_right -

- The | DET - quick | ADJ - brown | ADJ - fox | PROPN - jumps | VERB - over | ADP - the | DET - lazy | ADJ - - dog | NOUN - - . | PUNCT -

-
-
-
-
-
-
- -
-
-
- Ausgabe -

- Export der Ergebnisse in JSON. (Zunkünftig angedacht: CSV, Excel und - HTML) -

-
-
-

-

- Umgesetzt mit IMS Open Corpus Workbench
- als lokaler Docker-Container -
-

-
- -
-

 

-

 

-

 

-

 

-
- - -{% endblock %} diff --git a/app/templates/profile/settings.html.j2 b/app/templates/profile/settings.html.j2 index a2994afd..1289e5b0 100644 --- a/app/templates/profile/settings.html.j2 +++ b/app/templates/profile/settings.html.j2 @@ -7,9 +7,9 @@

-
- - {{ edit_general_settings_form.hidden_tag() }} + + {{ edit_general_settings_form.hidden_tag() }} +

brightness_3{{ edit_general_settings_form.dark_mode.label.text }}

@@ -48,8 +48,8 @@
+ {{ edit_password_form.hidden_tag() }}
- {{ edit_password_form.hidden_tag() }}
vpn_key {{ edit_password_form.current_password() }} @@ -93,8 +93,8 @@
+ {{ edit_email_form.hidden_tag() }}
- {{ edit_email_form.hidden_tag() }}
mail {{ edit_email_form.email() }} diff --git a/app/templates/services/nlp.html.j2 b/app/templates/services/nlp.html.j2 index 330323e4..da0cd2e7 100644 --- a/app/templates/services/nlp.html.j2 +++ b/app/templates/services/nlp.html.j2 @@ -38,8 +38,8 @@

Submit a job

+ {{ add_job_form.hidden_tag() }}
- {{ add_job_form.hidden_tag() }}
diff --git a/app/templates/services/ocr.html.j2 b/app/templates/services/ocr.html.j2 index 685f236a..3e2a75e7 100644 --- a/app/templates/services/ocr.html.j2 +++ b/app/templates/services/ocr.html.j2 @@ -20,8 +20,8 @@

Submit a job

+ {{ add_job_form.hidden_tag() }}
- {{ add_job_form.hidden_tag() }}
diff --git a/app/templates/services/setup_files.html.j2 b/app/templates/services/setup_files.html.j2 index cef684ed..ee93de48 100644 --- a/app/templates/services/setup_files.html.j2 +++ b/app/templates/services/setup_files.html.j2 @@ -20,8 +20,8 @@

Submit a job

+ {{ add_job_form.hidden_tag() }}
- {{ add_job_form.hidden_tag() }}
From 55a86a60f3c064249e3e6d0e7fa85e251aca5c43 Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Mon, 2 Mar 2020 14:15:50 +0100 Subject: [PATCH 4/4] disable notifications for now --- app/templates/nopaque.html.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/templates/nopaque.html.j2 b/app/templates/nopaque.html.j2 index 67c8abd6..5a33e27d 100644 --- a/app/templates/nopaque.html.j2 +++ b/app/templates/nopaque.html.j2 @@ -59,7 +59,7 @@ menu {% endif %}