more normalization

This commit is contained in:
Patrick Jentsch 2023-03-28 14:19:37 +02:00
parent b41436c844
commit 9de09519d6
9 changed files with 72 additions and 46 deletions

View File

@ -60,8 +60,8 @@ def register():
return redirect(url_for('.login')) return redirect(url_for('.login'))
return render_template( return render_template(
'auth/register.html.j2', 'auth/register.html.j2',
form=form, title='Register',
title='Register' form=form
) )
@ -81,7 +81,11 @@ def login():
flash('You have been logged in') flash('You have been logged in')
return redirect(next) return redirect(next)
flash('Invalid email/username or password', category='error') flash('Invalid email/username or password', category='error')
return render_template('auth/login.html.j2', form=form, title='Log in') return render_template(
'auth/login.html.j2',
title='Log in',
form=form
)
@bp.route('/logout') @bp.route('/logout')
@ -98,7 +102,10 @@ def logout():
def unconfirmed(): def unconfirmed():
if current_user.confirmed: if current_user.confirmed:
return redirect(url_for('main.dashboard')) return redirect(url_for('main.dashboard'))
return render_template('auth/unconfirmed.html.j2', title='Unconfirmed') return render_template(
'auth/unconfirmed.html.j2',
title='Unconfirmed'
)
@bp.route('/confirm-request') @bp.route('/confirm-request')
@ -157,8 +164,8 @@ def reset_password_request():
return redirect(url_for('.login')) return redirect(url_for('.login'))
return render_template( return render_template(
'auth/reset_password_request.html.j2', 'auth/reset_password_request.html.j2',
form=form, title='Password Reset',
title='Password Reset' form=form
) )
@ -176,7 +183,7 @@ def reset_password(token):
return redirect(url_for('main.index')) return redirect(url_for('main.index'))
return render_template( return render_template(
'auth/reset_password.html.j2', 'auth/reset_password.html.j2',
form=form,
title='Password Reset', title='Password Reset',
form=form,
token=token token=token
) )

View File

@ -54,8 +54,8 @@ def create_spacy_nlp_pipeline_model():
return {}, 201, {'Location': url_for('.spacy_nlp_pipeline_models')} return {}, 201, {'Location': url_for('.spacy_nlp_pipeline_models')}
return render_template( return render_template(
'contributions/spacy_nlp_pipeline_models/create_spacy_nlp_pipeline_model.html.j2', 'contributions/spacy_nlp_pipeline_models/create_spacy_nlp_pipeline_model.html.j2',
form=form, title='Create SpaCy NLP Pipeline Model',
title='Create SpaCy NLP Pipeline Model' form=form
) )
@ -77,7 +77,7 @@ def spacy_nlp_pipeline_model(spacy_nlp_pipeline_model_id):
return redirect(url_for('.spacy_nlp_pipeline_models')) return redirect(url_for('.spacy_nlp_pipeline_models'))
return render_template( return render_template(
'contributions/spacy_nlp_pipeline_models/spacy_nlp_pipeline_model.html.j2', 'contributions/spacy_nlp_pipeline_models/spacy_nlp_pipeline_model.html.j2',
title=f'{snpm.title} {snpm.version}',
form=form, form=form,
spacy_nlp_pipeline_model=snpm, spacy_nlp_pipeline_model=snpm
title=f'{snpm.title} {snpm.version}'
) )

View File

@ -53,8 +53,8 @@ def create_tesseract_ocr_pipeline_model():
return {}, 201, {'Location': url_for('.tesseract_ocr_pipeline_models')} return {}, 201, {'Location': url_for('.tesseract_ocr_pipeline_models')}
return render_template( return render_template(
'contributions/tesseract_ocr_pipeline_models/create_tesseract_ocr_pipeline_model.html.j2', 'contributions/tesseract_ocr_pipeline_models/create_tesseract_ocr_pipeline_model.html.j2',
form=form, title='Create Tesseract OCR Pipeline Model',
title='Create Tesseract OCR Pipeline Model' form=form
) )
@ -76,7 +76,7 @@ def tesseract_ocr_pipeline_model(tesseract_ocr_pipeline_model_id):
return redirect(url_for('.tesseract_ocr_pipeline_models')) return redirect(url_for('.tesseract_ocr_pipeline_models'))
return render_template( return render_template(
'contributions/tesseract_ocr_pipeline_models/tesseract_ocr_pipeline_model.html.j2', 'contributions/tesseract_ocr_pipeline_models/tesseract_ocr_pipeline_model.html.j2',
title=f'{topm.title} {topm.version}',
form=form, form=form,
tesseract_ocr_pipeline_model=topm, tesseract_ocr_pipeline_model=topm
title=f'{topm.title} {topm.version}'
) )

View File

@ -24,7 +24,7 @@ from .utils import (
@register_breadcrumb(bp, '.entity.files', 'Files', endpoint_arguments_constructor=corpus_eac) @register_breadcrumb(bp, '.entity.files', 'Files', endpoint_arguments_constructor=corpus_eac)
@login_required @login_required
def corpus_files(corpus_id): def corpus_files(corpus_id):
return redirect(url_for('.corpus', corpus_id=corpus_id, _anchor='files')) return redirect(url_for('.corpus', _anchor='files', corpus_id=corpus_id))
@bp.route('/<hashid:corpus_id>/files/create', methods=['GET', 'POST']) @bp.route('/<hashid:corpus_id>/files/create', methods=['GET', 'POST'])
@ -64,9 +64,9 @@ def create_corpus_file(corpus_id):
return '', 201, {'Location': corpus.url} return '', 201, {'Location': corpus.url}
return render_template( return render_template(
'corpora/files/create_corpus_file.html.j2', 'corpora/files/create_corpus_file.html.j2',
corpus=corpus, title='Add corpus file',
form=form, form=form,
title='Add corpus file' corpus=corpus
) )
@ -86,10 +86,10 @@ def corpus_file(corpus_id, corpus_file_id):
return redirect(corpus_file.corpus.url) return redirect(corpus_file.corpus.url)
return render_template( return render_template(
'corpora/files/corpus_file.html.j2', 'corpora/files/corpus_file.html.j2',
corpus=corpus_file.corpus, title='Edit corpus file',
corpus_file=corpus_file,
form=form, form=form,
title='Edit corpus file' corpus=corpus_file.corpus,
corpus_file=corpus_file
) )

View File

@ -43,8 +43,8 @@ def create_corpus():
return redirect(corpus.url) return redirect(corpus.url)
return render_template( return render_template(
'corpora/create_corpus.html.j2', 'corpora/create_corpus.html.j2',
form=form, title='Create corpus',
title='Create corpus' form=form
) )
@ -59,18 +59,18 @@ def corpus(corpus_id):
if corpus.user == current_user or current_user.is_administrator(): if corpus.user == current_user or current_user.is_administrator():
return render_template( return render_template(
'corpora/corpus.html.j2', 'corpora/corpus.html.j2',
title=corpus.title,
corpus=corpus, corpus=corpus,
corpus_follower_roles=corpus_follower_roles, corpus_follower_roles=corpus_follower_roles,
users = users, users = users
title=corpus.title
) )
if current_user.is_following_corpus(corpus) or corpus.is_public: if current_user.is_following_corpus(corpus) or corpus.is_public:
cfa = CorpusFollowerAssociation.query.filter_by(corpus_id=corpus_id, follower_id=current_user.id).first_or_404() cfa = CorpusFollowerAssociation.query.filter_by(corpus_id=corpus_id, follower_id=current_user.id).first_or_404()
return render_template( return render_template(
'corpora/public_corpus.html.j2', 'corpora/public_corpus.html.j2',
title=corpus.title,
corpus=corpus, corpus=corpus,
cfa=cfa, cfa=cfa
title=corpus.title
) )
abort(403) abort(403)

View File

@ -29,8 +29,8 @@ def job(job_id):
abort(403) abort(403)
return render_template( return render_template(
'jobs/job.html.j2', 'jobs/job.html.j2',
job=job, title='Job',
title='Job' job=job
) )

View File

@ -18,20 +18,30 @@ def index():
return redirect(url_for('.dashboard')) return redirect(url_for('.dashboard'))
flash('Invalid email/username or password', category='error') flash('Invalid email/username or password', category='error')
redirect(url_for('.index')) redirect(url_for('.index'))
return render_template('main/index.html.j2', form=form, title='nopaque') return render_template(
'main/index.html.j2',
title='nopaque',
form=form
)
@bp.route('/faq') @bp.route('/faq')
@register_breadcrumb(bp, '.faq', 'Frequently Asked Questions') @register_breadcrumb(bp, '.faq', 'Frequently Asked Questions')
def faq(): def faq():
return render_template('main/faq.html.j2', title='Frequently Asked Questions') return render_template(
'main/faq.html.j2',
title='Frequently Asked Questions'
)
@bp.route('/dashboard') @bp.route('/dashboard')
@register_breadcrumb(bp, '.dashboard', '<i class="material-icons left">dashboard</i>Dashboard') @register_breadcrumb(bp, '.dashboard', '<i class="material-icons left">dashboard</i>Dashboard')
@login_required @login_required
def dashboard(): def dashboard():
return render_template('main/dashboard.html.j2', title='Dashboard') return render_template(
'main/dashboard.html.j2',
title='Dashboard'
)
# @bp.route('/user_manual') # @bp.route('/user_manual')
@ -43,19 +53,28 @@ def dashboard():
@bp.route('/news') @bp.route('/news')
@register_breadcrumb(bp, '.news', '<i class="material-icons left">email</i>News') @register_breadcrumb(bp, '.news', '<i class="material-icons left">email</i>News')
def news(): def news():
return render_template('main/news.html.j2', title='News') return render_template(
'main/news.html.j2',
title='News'
)
@bp.route('/privacy_policy') @bp.route('/privacy_policy')
@register_breadcrumb(bp, '.privacy_policy', 'Private statement (GDPR)') @register_breadcrumb(bp, '.privacy_policy', 'Private statement (GDPR)')
def privacy_policy(): def privacy_policy():
return render_template('main/privacy_policy.html.j2', title='Privacy statement (GDPR)') return render_template(
'main/privacy_policy.html.j2',
title='Privacy statement (GDPR)'
)
@bp.route('/terms_of_use') @bp.route('/terms_of_use')
@register_breadcrumb(bp, '.terms_of_use', 'Terms of Use') @register_breadcrumb(bp, '.terms_of_use', 'Terms of Use')
def terms_of_use(): def terms_of_use():
return render_template('main/terms_of_use.html.j2', title='Terms of Use') return render_template(
'main/terms_of_use.html.j2',
title='Terms of Use'
)
@bp.route('/social-area') @bp.route('/social-area')
@ -73,7 +92,7 @@ def social_area():
users = User.query.filter(User.is_public == True, User.id != current_user.id).all() users = User.query.filter(User.is_public == True, User.id != current_user.id).all()
return render_template( return render_template(
'main/social_area.html.j2', 'main/social_area.html.j2',
users=users, title='Social Area',
corpora=corpora, corpora=corpora,
title='Social Area' users=users
) )

View File

@ -63,8 +63,8 @@ def file_setup_pipeline():
return {}, 201, {'Location': job.url} return {}, 201, {'Location': job.url}
return render_template( return render_template(
'services/file_setup_pipeline.html.j2', 'services/file_setup_pipeline.html.j2',
form=form, title=service_manifest['name'],
title=service_manifest['name'] form=form
) )
@ -112,9 +112,9 @@ def tesseract_ocr_pipeline():
] ]
return render_template( return render_template(
'services/tesseract_ocr_pipeline.html.j2', 'services/tesseract_ocr_pipeline.html.j2',
title=service_manifest['name'],
form=form, form=form,
tesseract_ocr_pipeline_models=tesseract_ocr_pipeline_models, tesseract_ocr_pipeline_models=tesseract_ocr_pipeline_models
title=service_manifest['name']
) )
@ -172,8 +172,8 @@ def transkribus_htr_pipeline():
return {}, 201, {'Location': job.url} return {}, 201, {'Location': job.url}
return render_template( return render_template(
'services/transkribus_htr_pipeline.html.j2', 'services/transkribus_htr_pipeline.html.j2',
form=form,
title=service_manifest['name'], title=service_manifest['name'],
form=form,
transkribus_htr_pipeline_models=transkribus_htr_pipeline_models transkribus_htr_pipeline_models=transkribus_htr_pipeline_models
) )
@ -218,9 +218,9 @@ def spacy_nlp_pipeline():
return {}, 201, {'Location': job.url} return {}, 201, {'Location': job.url}
return render_template( return render_template(
'services/spacy_nlp_pipeline.html.j2', 'services/spacy_nlp_pipeline.html.j2',
title=service_manifest['name'],
form=form, form=form,
spacy_nlp_pipeline_models=spacy_nlp_pipeline_models, spacy_nlp_pipeline_models=spacy_nlp_pipeline_models
title=service_manifest['name']
) )

View File

@ -29,8 +29,8 @@ def user(user_id):
abort(403) abort(403)
return render_template( return render_template(
'users/user.html.j2', 'users/user.html.j2',
user=user, title=user.username,
title=user.username user=user
) )