The Framework Code

twigs/framework/devel/testajax.twig

File List

{% set ajax = TRUE %}
{% set fwutils = TRUE %}
{% set usebootbox = TRUE %}

{% extends '@content/page.twig' %}

{% import '@util/formmacro.twig' as f %}
{% import '@util/modalmacro.twig' as m %}

{% set ops = [ 'bean', 'config', 'hints', 'paging', 'pwcheck', 'shared', 'table', 'tablecheck', 'tablesearch', 'toggle', 'unique', 'uniquenl'] %}

{% block scripts %}
    <script src="{{assets}}/js/testajax.js"></script>
{% endblock scripts %}

{% block setup %}
    let goodlogin = '{{context.user.login}}';
    let userbean = '{{constant('Config\\Framework::USER')}}';
    let testtable = '{{constant('Config\\Framework::TEST')}}';
    let testbeanid = {{bean.getID}};
{% endblock setup %}

{% block onload %}
    for (var op of testing.ajaxops)
    {
        document.getElementById(op).addEventListener('click', testing['test'+op]);
    }
{% endblock onload %}

{% block header %}
    <section class="col-md-12 mt-5">
        <h1>Test Framework AJAX calls</h1>
        {% if context.hasadmin %}
            <h2>Running as Site Admin</h2>
        {% elseif context.user.hasrole('Test', 'Tester') %}
            <h2>Running as Test Tester</h2>
        {% endif %}
    </section>
{% endblock header %}

{% block main %}
    <section class="row">
        <article class="ml-auto col-md-10 mr-auto mt-4 mb-5">
            {% for x in ops %}
                <div class="mb-3">
                    <button class="btn btn-info" id="{{x}}">Test {{x}}</button>
                </div>
            {% endfor %}
        </article>
    </section>
{% endblock main %}

{% block pagefooter %}
{% endblock pagefooter %}