{% set colors = ['indigo', 'green', 'orange', 'teal', 'maroon', 'purple', 'olive'] %} {% macro timeline(events, public_only=True) %}
{% set dates = [] %} {% for event in events | sort(attribute='created_at', reverse=True) %} {% if event.public or not public_only %} {% if not event.created_at.date() == dates[-1] %} {% set _ = dates.append(event.created_at.date()) %}
{{ event.created_at.date() }}
{% endif %}
{{ event.created_at.time().strftime("%H:%M") }}

{{ event.actor.username or event.user.username }} {{ event.description }}

{% if event.comment %}
{{ event.comment }}
{% endif %}
{% endif %} {% endfor %}
{% endmacro %} {% macro profile_status(profile) %} {% set current = profile.STATUSES[profile.status] %} {{ current[1] }} {% if profile.transition_step %} {% set transition = profile.TRANSITIONS[profile.transition] %} {% set target = profile.STATUSES[transition.to] %} {{ target[1] }} {% if profile.transition_step == profile.INIT %} {{ transition.delta(profile) }} {% elif profile.transition_step == profile.START %} {% elif profile.transition_step == profile.DONE %} {% elif profile.transition_step == profile.MANUAL %} {% endif %} {% endif %} {% endmacro %} {% macro auths_badges(auths) %} {% for realm, auth in auths.items() %} {{ realm }} {% endfor %} {% endmacro %} {% macro infobox(title, text, color, icon) %}
{{ title }} {{ text }}
{% endmacro %} {% macro form_fields(fields, layout='', prepend='', append='', label=True) %}
{% for field in fields %} {{ form_individual_field(field, layout=layout, prepend=prepend, append=append, label=label, **kwargs) }} {% endfor %}
{% endmacro %} {% macro form_individual_field(field, layout='', prepend='', append='', label=True, class_="") %} {% if field.type == "BooleanField" %} {% if layout == "" %}
{% endif %}
{{ field(class_="custom-control-input", **kwargs) }}  {{ field.label(class_="custom-control-label") if label else '' }}
{% if layout == "" %}
{% endif %} {% else %} {{ field.label(class_="col-md-2 col-form-label" if layout == "") if label else '' }} {% if layout == "" %}
{% endif %} {% if prepend or append %}
{% endif %} {% if field.type == "MultiCheckboxField" %} {% else %} {{ prepend|safe }}{{ field(class_="form-control " + ("border-danger" if field.errors else "") + class_, **kwargs) }}{{ append|safe }} {% endif %} {% if field.errors %} {% for error in field.errors %} {% endfor %} {% elif field.description %} {{ field.description }} {% endif %} {% if prepend or append %}
{% endif %} {% if layout == "" %}
{% endif %} {% endif %} {% endmacro %} {% macro form_field(field, layout='') %} {% if field.type == 'SubmitField' %} {{ form_fields((field,), layout=layout, label=False, class="btn btn-info", **kwargs) }} {% elif field.type not in ('HiddenField', 'CSRFTokenField') %} {{ form_fields((field,), layout=layout, **kwargs) }} {% endif %} {% endmacro %} {% macro form(form, layout='') %}
{{ form.hidden_tag() }} {% for field in form %} {{ form_field(field, layout=layout) }} {% endfor %}
{% endmacro %}