denny/ShinyCMS

View on GitHub
root/admin/form/edit_form.tt

Summary

Maintainability
Test Coverage
[%- IF form.id;
        meta.title = 'Edit Form Handler';
    ELSE;
        meta.title = 'Add Form Handler';
    END;
-%]

<form id="edit_form" action="[% c.uri_for( '/admin/form/edit-form-do' ) %]" method="post">
    <p>
        <label for="name">Name</label>
        <br><input class="textshort" type="text" id="name" name="name" value="[% form.name | html %]">
    </p>
    <p>
        <label for="url_name">URL name</label>
        <br><input class="textshort" type="text" id="url_name" name="url_name" value="[% form.url_name | html %]">
    </p>
    <p>
        <label for="redirect">Redirect (optional; where to send user after form is processed)</label>
        <br><input class="textlong" type="text" id="redirect" name="redirect" value="[% form.redirect | html %]">
    </p>
    <p>
        <label for="action">Action</label>
        <br><select id="action" name="action">
                <option value="Email">Email</option>
        </select>
    </p>
    <p>
        <label for="email_to">Email to (if left blank, defaults to site_email from config file)</label>
        <br><input class="textlong" type="text" id="email_to" name="email_to" value="[% form.email_to | html %]">
    </p>
    <p>
        <label for="template">Template (optional; for formatting emails)</label>
        <br><select id="template" name="template">
                <option value="">None</option>
                [%- FOREACH t IN templates %]
                <option [% IF form.template == t %]selected="selected" [% END %]value="[% t | html %]">[% t | html %]</option>
                [%- END %]
        </select>
    </p>
    <p>
        <label for="has_captcha">Protect form with reCaptcha?</label>
        <br><input type="checkbox" id="has_captcha" name="has_captcha" [% 'checked="checked"' IF form.has_captcha %]>
    </p>
    <p>
        <input type="submit" value="Save">
        <input type="reset"  value="Reset">
        [%- IF form.id %]
        <input type="hidden" name="form_id" value="[% form.id %]">
        <input name="delete"  type="submit" value="Delete" onclick="javascript:return confirm('Are you sure you want to delete this form?')">
        [%- END %]
    </p>
</form>