mirror of
https://github.com/aljazceru/CTFd.git
synced 2026-02-21 14:14:21 +01:00
Squashed 'CTFd/themes/core-beta/' changes from 9126d77d..5ce3003b
5ce3003b Merge pull request #47 from aCursedComrade/patch-1 c9887cb1 Fix team template git-subtree-dir: CTFd/themes/core-beta git-subtree-split: 5ce3003b4d68352e629ee2d390bc999e7d6b071e
This commit is contained in:
60
templates/macros/forms.html
Normal file
60
templates/macros/forms.html
Normal file
@@ -0,0 +1,60 @@
|
||||
{% macro render_extra_fields(fields, show_labels=True, show_optionals=True, show_descriptions=True) -%}
|
||||
{% for field in fields %}
|
||||
{% if field.field_type == "text" %}
|
||||
|
||||
<div class="mb-3">
|
||||
{% if show_labels %}
|
||||
<b>{{ field.label(class="form-label") }}</b>
|
||||
{% endif %}
|
||||
|
||||
{% if show_optionals %}
|
||||
{% if field.flags.required is false %}
|
||||
<small class="ms-1 text-muted">
|
||||
{% trans %}(Optional){% endtrans %}
|
||||
</small>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{{ field(class="form-control") }}
|
||||
|
||||
{% if show_descriptions %}
|
||||
{% if field.description %}
|
||||
<small class="form-text text-muted">
|
||||
{{ field.description }}
|
||||
</small>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% elif field.field_type == "boolean" %}
|
||||
|
||||
<div>
|
||||
{{ field.label(class="form-label") }}
|
||||
{% if show_optionals %}
|
||||
{% if field.flags.required is false %}
|
||||
<small class="ms-1 text-muted">
|
||||
{% trans %}(Optional){% endtrans %}
|
||||
</small>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="mb-3 border border-1 p-3">
|
||||
<div class="form-check">
|
||||
{{ field(class="form-check-input") }}
|
||||
{{ field.label(class="form-check-label") }}
|
||||
</div>
|
||||
|
||||
{% if show_descriptions %}
|
||||
{% if field.description %}
|
||||
<small class="form-text text-muted">
|
||||
{{ field.description }}
|
||||
</small>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{%- endmacro %}
|
||||
Reference in New Issue
Block a user