{% extends "index.html" %}
{% from "macros.html" import switch, text_input, numeric_input, dropdown, submit %}
{% block page %}

<form method="POST" action="{{ url_for('edit_engine', engine_name=engine.name) }}" id="server">
    <div class="engine-container">
        <h2 class="mdl-card__title-text">"{{ engine.name }}" engine edit</h2>
    </div>
    <!--
    {{ text_input('Shortcut', 'shortcut', engine.shortcut) }}
    {{ text_input('Categories', 'categories', engine.categories|join(',') ) }}
    {{ numeric_input('Timeout', 'timeout', engine.timeout) }}
    {{ switch('Disabled', 'disabled', engine.disabled) }}
    -->
    {% for key, value, type in engine_attrs %}
        {% if type == 'str' %}
            {{ text_input(key.capitalize().replace('_', ' '), key, value) }}
        {% elif type == 'float' %}
            {{ numeric_input(key.capitalize().replace('_', ' '), key, value) }}
        {% elif type == 'bool' %}
            {{ switch(key.capitalize().replace('_', ' '), key, value) }}
        {% endif %}
    {% endfor %}
    {{ submit() }}
</form>

{% endblock %}
