The Framework Code

twigs/framework/edit/user.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();
    });
    $('.delb').on('click', function(e){
        framework.dodelbean(e, this, '{{constant('Config\\Framework::ROLE')}}');
    });
{% endblock onload %}

{% block header %}
    <section class="col-md-12 mt-5">
        <h1>User &ldquo;{{bean.login}}&rdquo;</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>Login details</legend>
                    {{f.text({ label: 'Login', id: 'ln', name: 'login', value: bean.login, readonly: true })}}
                    {{f.email({ label: 'Email', id: 'em', name: 'email', value: bean.email, required: true })}}
                    {{f.password({ label: 'Password', id: 'psw', name: 'pw', ph: 'Password' })}}
                    {{f.password({ label: 'Repeat Password', id: 'rpsw', name: 'rpw', ph: 'Repeat Password', data: {'parsley-equalto': '#psw', 'parsley-trigger': 'change'} })}}
                </fieldset>
                {% include '@admin/roleselect.twig' with { bean : bean } %}
                <button class="btn btn-primary btn-lg" type="submit">Save</button>
            </form>
        </article>
    </section>
{% endblock main %}

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