The Framework Code

twigs/framework/edit/fwconfig.twig

File List

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

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

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

{% block onload %}
    $('#more').on('click', function(e){
        e.preventDefault();
        e.stopPropagation();
        const mrow = $('#mrow');
        mrow.before($('#example').clone());
        const pr = $mrow.prev();
        $('input', pr).val(''); // clear the inputs
        $('option', pr).prop('selected', false); // clear any selections
        $('.delb', pr).on('click', function(e){
            framework.dodelbean(e, this, '{{constant('Config\\Framework::ROLE')}}');
        });
    });
    $('#uform').on('submit', function(e){
        return $(this).parsley().validate();
    });
{% endblock onload %}

{% block header %}
    <section class="col-md-12 mt-5">
        <h1>Config Item "{{bean.name}}"</h1>
    </section>
{% endblock header %}

{% block main %}
    <section class="row">
        <article class="offset-md-1 col">
            {% include '@util/message.twig' %}
            <form action="#" method="post" id="uform" data-parsley-validate>
                {{f.hidden({name: 'bean', value: bean.id})}}
                {{bean.guard|raw}}
                <fieldset>
                    <legend>Details</legend>
                    {{f.text({ label: 'Value', id: 'vl', name: 'value', value: bean.value})}}
                    {{f.text({ label: 'Integrity', id: 'it', name: 'integrity', value: bean.integrity, help: 'The hashcode value for the integrity attribute for URLs'})}}
                    {{f.text({ label: 'CrossOrigin', id: 'co', name: 'crossorigin', value: bean.crossorigin, help:'Valid values are <i>anonymous</i> or <i>use-credentials</i>'})}}
                    {{f.checkbox({group: TRUE, names: ['defer'], values:[1], check: [bean.defer], labels: ['Defer']})}}
                    {{f.checkbox({group: TRUE, names: ['async'], values:[1], check: [bean.async], labels: ['Async']})}}
                    {{f.select({label : 'Type', name: 'type', required: TRUE, selected: bean.type,
                        options: [
                            { value: '',  text: '&mdash; Pick a Type &mdash;' },
                            { value: 'boolean', text: 'boolean' },
                            { value: 'css', text: 'css' },
                            { value: 'integer', text: 'integer' },
                            { value: 'js', text: 'js' },
                            { value: 'string', text: 'string' },
                        ]
                    })}}
                </fieldset>
                <button class="btn btn-primary btn-lg" type="submit">Save</button>
            </form>
        </article>
    </section>
{% endblock main %}

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