From b9ebb64fcc5269d86b3f6cad3ccc383b059d3f7d Mon Sep 17 00:00:00 2001 From: Patrick Jentsch Date: Fri, 17 Apr 2020 11:13:11 +0200 Subject: [PATCH] Change macro names --- app/templates/admin/edit_user.html.j2 | 10 ++++---- app/templates/auth/login.html.j2 | 8 +++--- app/templates/auth/register.html.j2 | 10 ++++---- app/templates/auth/reset_password.html.j2 | 6 ++--- .../auth/reset_password_request.html.j2 | 4 +-- app/templates/corpora/add_corpus.html.j2 | 6 ++--- app/templates/corpora/add_corpus_file.html.j2 | 12 ++++----- app/templates/corpora/analyse_corpus.html.j2 | 8 +++--- .../corpora/edit_corpus_file.html.j2 | 10 ++++---- .../materialize.html.j2} | 25 +++++++------------ app/templates/main/feedback.html.j2 | 2 +- app/templates/main/index.html.j2 | 8 +++--- app/templates/nopaque.html.j2 | 2 +- app/templates/profile/settings.html.j2 | 14 +++++------ app/templates/services/file-setup.html.j2 | 8 +++--- app/templates/services/nlp.html.j2 | 12 ++++----- app/templates/services/ocr.html.j2 | 12 ++++----- 17 files changed, 75 insertions(+), 82 deletions(-) rename app/templates/{materialize.jinja => macros/materialize.html.j2} (75%) diff --git a/app/templates/admin/edit_user.html.j2 b/app/templates/admin/edit_user.html.j2 index 42187b9e..3a48adf8 100644 --- a/app/templates/admin/edit_user.html.j2 +++ b/app/templates/admin/edit_user.html.j2 @@ -12,13 +12,13 @@
{{ edit_user_form.hidden_tag() }} - {{ materialize.field(edit_user_form.username, data_length='64', material_icon='account_circle') }} - {{ materialize.field(edit_user_form.email, class_='validate', material_icon='email', type='email') }} - {{ materialize.field(edit_user_form.role, material_icon='swap_vert') }} - {{ materialize.field(edit_user_form.confirmed, material_icon='check') }} + {{ M.render_field(edit_user_form.username, data_length='64', material_icon='account_circle') }} + {{ M.render_field(edit_user_form.email, class_='validate', material_icon='email', type='email') }} + {{ M.render_field(edit_user_form.role, material_icon='swap_vert') }} + {{ M.render_field(edit_user_form.confirmed, material_icon='check') }}
- {{ materialize.field(edit_user_form.submit, material_icon='send') }} + {{ M.render_field(edit_user_form.submit, material_icon='send') }}
diff --git a/app/templates/auth/login.html.j2 b/app/templates/auth/login.html.j2 index 4561a966..69ccbe57 100644 --- a/app/templates/auth/login.html.j2 +++ b/app/templates/auth/login.html.j2 @@ -28,19 +28,19 @@
{{ login_form.hidden_tag() }} - {{ materialize.field(login_form.user, material_icon='person') }} - {{ materialize.field(login_form.password, material_icon='vpn_key') }} + {{ M.render_field(login_form.user, material_icon='person') }} + {{ M.render_field(login_form.password, material_icon='vpn_key') }}
- {{ materialize.field(login_form.remember_me) }} + {{ M.render_field(login_form.remember_me) }}
- {{ materialize.field(login_form.submit, material_icon='send') }} + {{ M.render_field(login_form.submit, material_icon='send') }}
diff --git a/app/templates/auth/register.html.j2 b/app/templates/auth/register.html.j2 index 42259f07..f0920190 100644 --- a/app/templates/auth/register.html.j2 +++ b/app/templates/auth/register.html.j2 @@ -26,13 +26,13 @@
{{ registration_form.hidden_tag() }} - {{ materialize.field(registration_form.username, data_length='64', material_icon='person') }} - {{ materialize.field(registration_form.password, data_length='128', material_icon='vpn_key') }} - {{ materialize.field(registration_form.password_confirmation, data_length='128', material_icon='vpn_key') }} - {{ materialize.field(registration_form.email, class_='validate', material_icon='email', type='email') }} + {{ M.render_field(registration_form.username, data_length='64', material_icon='person') }} + {{ M.render_field(registration_form.password, data_length='128', material_icon='vpn_key') }} + {{ M.render_field(registration_form.password_confirmation, data_length='128', material_icon='vpn_key') }} + {{ M.render_field(registration_form.email, class_='validate', material_icon='email', type='email') }}
- {{ materialize.field(registration_form.submit, material_icon='send') }} + {{ M.render_field(registration_form.submit, material_icon='send') }}
diff --git a/app/templates/auth/reset_password.html.j2 b/app/templates/auth/reset_password.html.j2 index dcf2aa4b..6bd93f56 100644 --- a/app/templates/auth/reset_password.html.j2 +++ b/app/templates/auth/reset_password.html.j2 @@ -11,11 +11,11 @@
{{ reset_password_form.hidden_tag() }} - {{ materialize.field(reset_password_form.password, data_length='128') }} - {{ materialize.field(reset_password_form.password_confirmation, data_length='128') }} + {{ M.render_field(reset_password_form.password, data_length='128') }} + {{ M.render_field(reset_password_form.password_confirmation, data_length='128') }}
- {{ materialize.field(reset_password_form.submit, material_icon='send') }} + {{ M.render_field(reset_password_form.submit, material_icon='send') }}
diff --git a/app/templates/auth/reset_password_request.html.j2 b/app/templates/auth/reset_password_request.html.j2 index e25481a1..cb8f23c8 100644 --- a/app/templates/auth/reset_password_request.html.j2 +++ b/app/templates/auth/reset_password_request.html.j2 @@ -10,10 +10,10 @@
{{ reset_password_request_form.hidden_tag() }} - {{ materialize.field(reset_password_request_form.email, class_='validate', material_icon='email', type='email') }} + {{ M.render_field(reset_password_request_form.email, class_='validate', material_icon='email', type='email') }}
- {{ materialize.field(reset_password_request_form.submit, material_icon='send') }} + {{ M.render_field(reset_password_request_form.submit, material_icon='send') }}
diff --git a/app/templates/corpora/add_corpus.html.j2 b/app/templates/corpora/add_corpus.html.j2 index 9fb6d841..7205ab29 100644 --- a/app/templates/corpora/add_corpus.html.j2 +++ b/app/templates/corpora/add_corpus.html.j2 @@ -13,15 +13,15 @@ {{ add_corpus_form.hidden_tag() }}
- {{ materialize.field(add_corpus_form.title, data_length='32', material_icon='title') }} + {{ M.render_field(add_corpus_form.title, data_length='32', material_icon='title') }}
- {{ materialize.field(add_corpus_form.description, data_length='255', material_icon='description') }} + {{ M.render_field(add_corpus_form.description, data_length='255', material_icon='description') }}
- {{ materialize.field(add_corpus_form.submit, material_icon='send') }} + {{ M.render_field(add_corpus_form.submit, material_icon='send') }}
diff --git a/app/templates/corpora/add_corpus_file.html.j2 b/app/templates/corpora/add_corpus_file.html.j2 index cee8457c..9242c0e8 100644 --- a/app/templates/corpora/add_corpus_file.html.j2 +++ b/app/templates/corpora/add_corpus_file.html.j2 @@ -15,21 +15,21 @@ {{ add_corpus_file_form.hidden_tag() }}
- {{ materialize.field(add_corpus_file_form.author, data_length='255', material_icon='person') }} + {{ M.render_field(add_corpus_file_form.author, data_length='255', material_icon='person') }}
- {{ materialize.field(add_corpus_file_form.title, data_length='255', material_icon='title') }} + {{ M.render_field(add_corpus_file_form.title, data_length='255', material_icon='title') }}
- {{ materialize.field(add_corpus_file_form.publishing_year, material_icon='access_time') }} + {{ M.render_field(add_corpus_file_form.publishing_year, material_icon='access_time') }}
- {{ materialize.field(add_corpus_file_form.file, accept='.vrt') }} + {{ M.render_field(add_corpus_file_form.file, accept='.vrt') }}
- {{ materialize.field(add_corpus_file_form.submit, material_icon='send') }} + {{ M.render_field(add_corpus_file_form.submit, material_icon='send') }}

@@ -39,7 +39,7 @@
{% for field in add_corpus_file_form if field.short_name not in ['author', 'csrf_token', 'file', 'publishing_year', 'submit', 'title'] %} - {{ materialize.field(field, data_length='255', material_icon=field.label.text[0:1]) }} + {{ M.render_field(field, data_length='255', material_icon=field.label.text[0:1]) }} {% endfor %}
diff --git a/app/templates/corpora/analyse_corpus.html.j2 b/app/templates/corpora/analyse_corpus.html.j2 index 62fefdf9..86c2a687 100644 --- a/app/templates/corpora/analyse_corpus.html.j2 +++ b/app/templates/corpora/analyse_corpus.html.j2 @@ -34,7 +34,7 @@

- {{ materialize.field(query_form.submit, material_icon='send') }} + {{ M.render_field(query_form.submit, material_icon='send') }}
@@ -49,13 +49,13 @@
- {{ materialize.field(display_options_form.results_per_page, material_icon='format_list_numbered') }} + {{ M.render_field(display_options_form.results_per_page, material_icon='format_list_numbered') }}
- {{ materialize.field(display_options_form.result_context, material_icon='short_text') }} + {{ M.render_field(display_options_form.result_context, material_icon='short_text') }}
- {{ materialize.field(display_options_form.expert_mode) }} + {{ M.render_field(display_options_form.expert_mode) }}
diff --git a/app/templates/corpora/edit_corpus_file.html.j2 b/app/templates/corpora/edit_corpus_file.html.j2 index 07953471..170cabcc 100644 --- a/app/templates/corpora/edit_corpus_file.html.j2 +++ b/app/templates/corpora/edit_corpus_file.html.j2 @@ -14,18 +14,18 @@
- {{ materialize.field(edit_corpus_file_form.author, data_length='255', material_icon='person') }} + {{ M.render_field(edit_corpus_file_form.author, data_length='255', material_icon='person') }}
- {{ materialize.field(edit_corpus_file_form.title, data_length='255', material_icon='title') }} + {{ M.render_field(edit_corpus_file_form.title, data_length='255', material_icon='title') }}
- {{ materialize.field(edit_corpus_file_form.publishing_year, material_icon='access_time') }} + {{ M.render_field(edit_corpus_file_form.publishing_year, material_icon='access_time') }}
- {{ materialize.field(edit_corpus_file_form.submit, material_icon='send') }} + {{ M.render_field(edit_corpus_file_form.submit, material_icon='send') }}

@@ -35,7 +35,7 @@
{% for field in edit_corpus_file_form if field.short_name not in ['author', 'csrf_token', 'publishing_year', 'submit', 'title'] %} - {{ materialize.field(field) }} + {{ M.render_field(field) }} {% endfor %}
diff --git a/app/templates/materialize.jinja b/app/templates/macros/materialize.html.j2 similarity index 75% rename from app/templates/materialize.jinja rename to app/templates/macros/materialize.html.j2 index 366654ad..d6a1d77c 100644 --- a/app/templates/materialize.jinja +++ b/app/templates/macros/materialize.html.j2 @@ -1,16 +1,16 @@ -{% macro field(field) %} +{% macro render_field(field) %} {% if field.type == 'BooleanField' %} - {{ boolean_field(field, *args, **kwargs) }} + {{ render_boolean_field(field, *args, **kwargs) }} {% elif field.type == 'SubmitField' %} - {{ submit_field(field, *args, **kwargs) }} + {{ render_submit_field(field, *args, **kwargs) }} {% elif field.type in ['FileField', 'MultipleFileField'] %} - {{ file_field(field, *args, **kwargs) }} + {{ render_file_field(field, *args, **kwargs) }} {% elif field.type in ['IntegerField', 'PasswordField', 'SelectField', 'StringField'] %} - {{ generic_field(field, *args, **kwargs) }} + {{ render_generic_field(field, *args, **kwargs) }} {% endif %} {% endmacro %} -{% macro boolean_field(field) %} +{% macro render_boolean_field(field) %}
{% if 'material_icon' in kwargs %} {{ kwargs.pop('material_icon') }} @@ -26,7 +26,7 @@
{% endmacro %} -{% macro file_field(field) %} +{% macro render_file_field(field) %}
{{ field.label.text }} @@ -38,7 +38,7 @@
{% endmacro %} -{% macro generic_field(field) %} +{% macro render_generic_field(field) %} {% if field.type == 'IntegerField' %} {% set tmp = kwargs.update({'type': 'number'}) %} {% if 'class_' in kwargs and 'validate' not in kwargs['class_'] %} @@ -59,7 +59,7 @@
{% endmacro %} -{% macro submit_field(field) %} +{% macro render_submit_field(field) %} {% endmacro %} - -{% macro submit_button(input) %} - -{% endmacro %} diff --git a/app/templates/main/feedback.html.j2 b/app/templates/main/feedback.html.j2 index b156c108..2e47fb8d 100644 --- a/app/templates/main/feedback.html.j2 +++ b/app/templates/main/feedback.html.j2 @@ -26,7 +26,7 @@
- {{ materialize.field(feedback_form.submit, material_icon='send') }} + {{ M.render_field(feedback_form.submit, material_icon='send') }}
diff --git a/app/templates/main/index.html.j2 b/app/templates/main/index.html.j2 index fa18e901..75c23349 100644 --- a/app/templates/main/index.html.j2 +++ b/app/templates/main/index.html.j2 @@ -145,19 +145,19 @@
Log in {{ login_form.hidden_tag() }} - {{ materialize.field(login_form.user, material_icon='person') }} - {{ materialize.field(login_form.password, material_icon='vpn_key') }} + {{ M.render_field(login_form.user, material_icon='person') }} + {{ M.render_field(login_form.password, material_icon='vpn_key') }}
- {{ materialize.field(login_form.remember_me) }} + {{ M.render_field(login_form.remember_me) }}
- {{ materialize.field(login_form.submit, material_icon='send') }} + {{ M.render_field(login_form.submit, material_icon='send') }}
diff --git a/app/templates/nopaque.html.j2 b/app/templates/nopaque.html.j2 index dd55f4bd..4ee92b14 100644 --- a/app/templates/nopaque.html.j2 +++ b/app/templates/nopaque.html.j2 @@ -1,4 +1,4 @@ -{% import "materialize.jinja" as materialize %} +{% import "macros/materialize.html.j2" as M %} diff --git a/app/templates/profile/settings.html.j2 b/app/templates/profile/settings.html.j2 index e24b386d..3ab20a0d 100644 --- a/app/templates/profile/settings.html.j2 +++ b/app/templates/profile/settings.html.j2 @@ -46,7 +46,7 @@
- {{ materialize.field(edit_general_settings_form.save_settings, material_icon='send') }} + {{ M.render_field(edit_general_settings_form.save_settings, material_icon='send') }}
@@ -65,12 +65,12 @@
{{ edit_password_form.hidden_tag() }} - {{ materialize.field(edit_password_form.current_password, data_length='128', material_icon='vpn_key') }} - {{ materialize.field(edit_password_form.password, data_length='128', material_icon='vpn_key') }} - {{ materialize.field(edit_password_form.password_confirmation, data_length='128', material_icon='vpn_key') }} + {{ M.render_field(edit_password_form.current_password, data_length='128', material_icon='vpn_key') }} + {{ M.render_field(edit_password_form.password, data_length='128', material_icon='vpn_key') }} + {{ M.render_field(edit_password_form.password_confirmation, data_length='128', material_icon='vpn_key') }}
- {{ materialize.field(edit_password_form.save_password, material_icon='send') }} + {{ M.render_field(edit_password_form.save_password, material_icon='send') }}
@@ -89,10 +89,10 @@
{{ edit_email_form.hidden_tag() }} - {{ materialize.field(edit_email_form.email, class_='validate', material_icon='email', type='email') }} + {{ M.render_field(edit_email_form.email, class_='validate', material_icon='email', type='email') }}
- {{ materialize.field(edit_email_form.save_email, material_icon='send') }} + {{ M.render_field(edit_email_form.save_email, material_icon='send') }}
diff --git a/app/templates/services/file-setup.html.j2 b/app/templates/services/file-setup.html.j2 index c2798294..50f70d59 100644 --- a/app/templates/services/file-setup.html.j2 +++ b/app/templates/services/file-setup.html.j2 @@ -30,16 +30,16 @@ {{ add_job_form.hidden_tag() }}
- {{ materialize.field(add_job_form.title, data_length='32', material_icon='title') }} + {{ M.render_field(add_job_form.title, data_length='32', material_icon='title') }}
- {{ materialize.field(add_job_form.description, data_length='255', material_icon='description') }} + {{ M.render_field(add_job_form.description, data_length='255', material_icon='description') }}
- {{ materialize.field(add_job_form.files, accept='image/jpeg, image/png, image/tiff') }} + {{ M.render_field(add_job_form.files, accept='image/jpeg, image/png, image/tiff') }}
- {{ materialize.field(add_job_form.version, material_icon='apps') }} + {{ M.render_field(add_job_form.version, material_icon='apps') }}
diff --git a/app/templates/services/nlp.html.j2 b/app/templates/services/nlp.html.j2 index 23ab5848..cf96befe 100644 --- a/app/templates/services/nlp.html.j2 +++ b/app/templates/services/nlp.html.j2 @@ -48,19 +48,19 @@ {{ add_job_form.hidden_tag() }}
- {{ materialize.field(add_job_form.title, data_length='32', material_icon='title') }} + {{ M.render_field(add_job_form.title, data_length='32', material_icon='title') }}
- {{ materialize.field(add_job_form.description, data_length='255', material_icon='description') }} + {{ M.render_field(add_job_form.description, data_length='255', material_icon='description') }}
- {{ materialize.field(add_job_form.files, accept='text/plain') }} + {{ M.render_field(add_job_form.files, accept='text/plain') }}
- {{ materialize.field(add_job_form.language, material_icon='language') }} + {{ M.render_field(add_job_form.language, material_icon='language') }}
- {{ materialize.field(add_job_form.version, material_icon='apps') }} + {{ M.render_field(add_job_form.version, material_icon='apps') }}
Preprocessing @@ -86,7 +86,7 @@
- {{ materialize.field(add_job_form.submit, material_icon='send') }} + {{ M.render_field(add_job_form.submit, material_icon='send') }}
diff --git a/app/templates/services/ocr.html.j2 b/app/templates/services/ocr.html.j2 index 0cc3e640..164dcc6a 100644 --- a/app/templates/services/ocr.html.j2 +++ b/app/templates/services/ocr.html.j2 @@ -30,19 +30,19 @@ {{ add_job_form.hidden_tag() }}
- {{ materialize.field(add_job_form.title, data_length='32', material_icon='title') }} + {{ M.render_field(add_job_form.title, data_length='32', material_icon='title') }}
- {{ materialize.field(add_job_form.description, data_length='255', material_icon='description') }} + {{ M.render_field(add_job_form.description, data_length='255', material_icon='description') }}
- {{ materialize.field(add_job_form.files, accept='application/pdf') }} + {{ M.render_field(add_job_form.files, accept='application/pdf') }}
- {{ materialize.field(add_job_form.language, material_icon='language') }} + {{ M.render_field(add_job_form.language, material_icon='language') }}
- {{ materialize.field(add_job_form.version, material_icon='apps') }} + {{ M.render_field(add_job_form.version, material_icon='apps') }}
Preprocessing @@ -113,7 +113,7 @@
- {{ materialize.field(add_job_form.submit, material_icon='send') }} + {{ M.render_field(add_job_form.submit, material_icon='send') }}