mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-25 19:04:18 +00:00
fix wtf macros
This commit is contained in:
parent
cb53b27ebf
commit
16bf891654
@ -7,6 +7,8 @@
|
||||
{{ render_integer_field(field, *args, **kwargs) }}
|
||||
{% elif field.type == 'MultipleFileField' %}
|
||||
{{ render_multiple_file_field(field, *args, **kwargs) }}
|
||||
{% elif field.type == 'StringField' %}
|
||||
{{ render_string_field(field, *args, **kwargs) }}
|
||||
{% elif field.type == 'SubmitField' %}
|
||||
{{ render_submit_field(field, *args, **kwargs) }}
|
||||
{% elif field.type == 'TextAreaField' %}
|
||||
@ -20,7 +22,7 @@
|
||||
{% macro render_boolean_field(field) %}
|
||||
<div>
|
||||
<label>
|
||||
<input id="{{ field.id }}" name="{{ field.name }}" type="checkbox">
|
||||
{{ field(*args, **kwargs) }}
|
||||
<span>{{ field.label.text }}</span>
|
||||
{% for error in field.errors %}
|
||||
<span class="helper-text error-color-text">{{ error }}</span>
|
||||
@ -36,25 +38,7 @@
|
||||
<div class="file-field input-field">
|
||||
<div class="btn">
|
||||
<span>{{ field.label.text }}</span>
|
||||
<input id="{{ field.id }}" name="{{ field.name }}" type="file">
|
||||
</div>
|
||||
<div class="file-path-wrapper">
|
||||
<input class="file-path validate" type="text" placeholder="{{ placeholder }}">
|
||||
</div>
|
||||
{% for error in field.errors %}
|
||||
<span class="helper-text error-color-text">{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro render_multiple_file_field(field) %}
|
||||
{% set placeholder = kwargs.pop('placeholder', '') %}
|
||||
|
||||
<div class="file-field input-field">
|
||||
<div class="btn">
|
||||
<span>{{ field.label.text }}</span>
|
||||
<input id="{{ field.id }}" name="{{ field.name }}" type="file" multiple>
|
||||
{{ field(*args, **kwargs) }}
|
||||
</div>
|
||||
<div class="file-path-wrapper">
|
||||
<input class="file-path validate" type="text" placeholder="{{ placeholder }}">
|
||||
@ -67,12 +51,29 @@
|
||||
|
||||
|
||||
{% macro render_integer_field(field) %}
|
||||
<div class="input-field">
|
||||
{% if 'material_icon' in kwargs %}
|
||||
<i class="material-icons prefix">{{ kwargs.pop('material_icon') }}</i>
|
||||
{% set classes = kwargs.pop('class_', '').split(' ') %}
|
||||
|
||||
{% if 'validate' not in classes %}
|
||||
{% set _ = classes.append('validate') %}
|
||||
{% endif %}
|
||||
<input class="validate" id="{{ field.id }}" name="{{ field.name }}" type="number">
|
||||
<label for="{{ field.id }}">{{ field.label.text }}</label>
|
||||
|
||||
{% set _ = kwargs.update({'class_': ' '.join(classes)}) %}
|
||||
|
||||
{{ render_generic_field(field, *args, **kwargs) }}
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro render_multiple_file_field(field) %}
|
||||
{% set placeholder = kwargs.pop('placeholder', '') %}
|
||||
|
||||
<div class="file-field input-field">
|
||||
<div class="btn">
|
||||
<span>{{ field.label.text }}</span>
|
||||
{{ field(*args, **kwargs) }}
|
||||
</div>
|
||||
<div class="file-path-wrapper">
|
||||
<input class="file-path validate" type="text" placeholder="{{ placeholder }}">
|
||||
</div>
|
||||
{% for error in field.errors %}
|
||||
<span class="helper-text error-color-text">{{ error }}</span>
|
||||
{% endfor %}
|
||||
@ -80,6 +81,19 @@
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro render_string_field(field) %}
|
||||
{% set classes = kwargs.pop('class_', '').split(' ') %}
|
||||
|
||||
{% if 'validate' not in classes %}
|
||||
{% set _ = classes.append('validate') %}
|
||||
{% endif %}
|
||||
|
||||
{% set _ = kwargs.update({'class_': ' '.join(classes)}) %}
|
||||
|
||||
{{ render_generic_field(field, *args, **kwargs) }}
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro render_submit_field(field) %}
|
||||
<button class="btn waves-effect waves-light" id="{{ field.id }}" name="{{ field.name }}" type="submit">
|
||||
{{ field.label.text }}
|
||||
@ -91,26 +105,23 @@
|
||||
|
||||
|
||||
{% macro render_text_area_field(field) %}
|
||||
<div class="input-field">
|
||||
{% if 'material_icon' in kwargs %}
|
||||
<i class="material-icons prefix">{{ kwargs.pop('material_icon') }}</i>
|
||||
{% set classes = kwargs.pop('class_', '').split(' ') %}
|
||||
|
||||
{% if 'materialize-textarea' not in classes %}
|
||||
{% set _ = classes.append('materialize-textarea') %}
|
||||
{% endif %}
|
||||
<textarea class="materialize-textarea validate" id="{{ field.id }}" name="{{ field.name }}"></textarea>
|
||||
<label for="{{ field.id }}">{{ field.label.text }}</label>
|
||||
{% for error in field.errors %}
|
||||
<span class="helper-text error-color-text">{{ error }}</span>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% if 'validate' not in classes %}
|
||||
{% set _ = classes.append('validate') %}
|
||||
{% endif %}
|
||||
|
||||
{% set _ = kwargs.update({'class_': ' '.join(classes)}) %}
|
||||
|
||||
{{ render_generic_field(field, *args, **kwargs) }}
|
||||
{% endmacro %}
|
||||
|
||||
|
||||
{% macro render_generic_field(field) %}
|
||||
{% set classes_ = kwargs.pop('class_', '').split(' ') %}
|
||||
{% if 'validate' not in classes_ %}
|
||||
{% set _ = classes_.append('validate') %}
|
||||
{% endif %}
|
||||
{% set _ = kwargs.update({'class_': ' '.join(classes_)}) %}
|
||||
|
||||
<div class="input-field">
|
||||
{% if 'material_icon' in kwargs %}
|
||||
<i class="material-icons prefix">{{ kwargs.pop('material_icon') }}</i>
|
||||
|
Loading…
Reference in New Issue
Block a user