{% load i18n %}

<!DOCTYPE HTML>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>LTI</title>
    </head>
    <body>
    {% comment %} 
        This form will be hidden.
        LTI block JavaScript will trigger a "submit" on the form, and the
        result will be rendered instead.
    {% endcomment %}
        <form
            id="lti-{{ element_id }}"
            action="{{ launch_url }}"
            method="post"
            encType="application/x-www-form-urlencoded"
            style="display:none;"
        >

            {% for param_name, param_value in input_fields.items %}
                <input name="{{ param_name }}" value="{{ param_value }}" />
            {% endfor %}

            <input type="submit" value="{% trans 'Press to Launch' %}" />
        </form>
        <script type="text/javascript">
            (function (d) {
                var element = d.getElementById("lti-{{ element_id|escapejs }}");
                if (element) {
                    element.submit();
                }
            }(document));
        </script>
    </body>
</html>
