{% macro flashed_messages(messages=None, container=True, transform={ 'critical': 'danger', 'error': 'danger', 'info': 'info', 'warning': 'warning', 'success': 'success', 'debug': 'info', 'notset': 'info', 'message': 'info', }, default_category=None, dismissible=False) -%} {% with messages = messages or get_flashed_messages(with_categories=True) -%} {% if messages -%} {# don't output anything if there are no messages #} {% if container -%}
{% endif -%} {% for cat, msg in messages %} {%- endfor -%} {% if container %}
{% endif -%} {% endif -%} {% endwith -%} {% endmacro -%} {% macro is_active(active) -%} {% if active %}active{% endif %} {%- endmacro %} {% macro link_to_scope(scope) -%} {{ scope.name }} {%- endmacro %} {% macro link_to_network(network) -%} {{ network.vlan_name }} {%- endmacro %} {% macro link_to_host(host) -%} {{ host.fqdn|default(host.name) }} {%- endmacro %} {% macro link_to_networks(networks) -%} {% for network in networks %} {{ link_to_network(network) }} {% endfor %} {%- endmacro %} {% macro link_to_hosts(hosts) -%} {% for host in hosts %} {{ link_to_host(host) }} {% endfor %} {%- endmacro %} {% macro link_to_interfaces_host(interfaces) -%} {% for interface in interfaces %} {{ link_to_host(interface.host) }} {% endfor %} {%- endmacro %} {% macro link_to_item(ics_id) -%} {% if ics_id %} {{ ics_id }} {% else %} {{ ics_id }} {% endif %} {%- endmacro %} {% macro link_to_items(ics_ids) -%} {% for ics_id in ics_ids %} {{ link_to_item(ics_id) }} {% endfor %} {%- endmacro %} {% macro link_to_stack_member(item) -%} {% if item.stack_member is not none %} {{ item.ics_id }} ({{ item.stack_member }}) {% else %} {{ item.ics_id }} {% endif %} {%- endmacro %} {% macro link_to_stack_members(items) -%} {% for item in items %} {{ link_to_stack_member(item) }} {% endfor %} {%- endmacro %} {% macro link_to_ansible_group(group) -%} {{ group.name }} {%- endmacro %} {% macro link_to_ansible_groups(groups) -%} {% for group in groups %} {{ link_to_ansible_group(group) }} {% endfor %} {%- endmacro %} {% macro link_to_task(task) -%} {{ task.id }} {%- endmacro %} {% macro link_to_tasks(tasks) -%} {% for task in tasks %} {{ link_to_task(task) }} {% endfor %} {%- endmacro %} {% macro render_field(field) -%} {% set field_class = kwargs.pop('class_', '') + ' form-control' %} {% set label_size = kwargs.pop('label_size', '2') %} {% set input_size = kwargs.pop('input_size', '10') %} {% if field.errors %} {% set field_class = field_class + ' is-invalid' %} {% endif %}
{% if field.type == 'BooleanField' %}
{{ field(class_="form-check-input", **kwargs) }} {{ field.label(class_="form-check-label") }}
{% else %} {{ field.label(class_="col-sm-" + label_size + " col-form-label") }}
{{ field(class_=field_class, **kwargs) }} {% if field.description %} {{ field.description|safe }} {% endif %} {% if field.errors %}
{{ field.errors|join(' / ') }}
{% endif %}
{% endif %}
{%- endmacro %} {% macro format_datetime(dt) -%} {{ dt.strftime("%Y-%m-%d %H:%M") }} {%- endmacro %} {% macro delete_button_with_confirmation(title, modal_id, message) -%} {%- endmacro %} {% macro submit_button_with_confirmation(title, message) -%} {%- endmacro %} {% macro figure(filename, description) -%}
{{ description }}
{{ description }}
{%- endmacro %} {% macro waiting_for(title, label) -%} {%- endmacro %} {% macro item_comment_form(form, item) -%}
{{ form.hidden_tag() }}
{{ form.body.label() }} {{ form.body(class_="form-control", rows=5, required=True) }} Styling with Markdown is supported using Showdown. A preview is visible below.
Comment preview

Cancel
{%- endmacro %} {% macro item_comment(comment) -%}
{{ comment.user }} commented on {{ format_datetime(comment.created_at) }} {% if comment.updated_at != comment.created_at %} Edited {{ format_datetime(comment.updated_at) }} {% endif %}
{{ delete_button_with_confirmation("Delete comment", "deleteConfirmation-%s" | format(comment.id), "Are you sure you want to delete this comment?") }}
{{ comment.body }}
{%- endmacro %}