denny/ShinyCMS

View on GitHub
root/admin/forums/edit_forum.tt

Summary

Maintainability
Test Coverage
[%- IF forum.id;
        meta.title = 'Edit Forum';
    ELSE;
        meta.title = 'Add Forum';
    END;
-%]

[%- IF forum.id %]
<form id="edit_forum" action="[% c.uri_for( '/admin/forums/forum', forum.id, 'save' ) %]" method="post">
[%- ELSE %]
<form id="add_forum" action="[% c.uri_for( '/admin/forums/forum/add-do' ) %]" method="post">
[%- END %]
    <p>
        <label for="name">Forum name</label>
        <br><input type="text" class="textshort" id="name" name="name" value="[% forum.name | html %]">
    </p>
    <p>
        <label for="name">URL name</label>
        <br><input type="text" class="textshort" id="url_name" name="url_name" value="[% forum.url_name | html %]">
    </p>
    <p>
        <label for="section">Section</label>
        <br><select id="section" name="section">
            [%- FOREACH section IN sections %]
            [%- IF section.id == forum.section.id %]
            <option value="[% section.id %]" selected="selected">[% section.name | html %]</option>
            [%- ELSE %]
            <option value="[% section.id %]">[% section.name | html %]</option>
            [%- END %]
            [%- END %]
        </select>
    </p>
    <p>
        <label for="menu_position">Display order</label>
        <br><input class="textshort" type="text" id="display_order" name="display_order" value="[% forum.display_order | html %]">
    </p>
    <p>
        <label for="name">Description</label>
        <br><textarea cols="60" rows="4" id="description" name="description">[% forum.description | html %]</textarea>
    </p>
    <p>
        [%- IF forum.id %]
        <input name="submit" type="submit" value="Update">
        <input name="delete" type="submit" value="Delete" onclick="javascript:return confirm('Are you sure you want to delete this forum and all of the discussion threads in it?')">
        [%- ELSE %]
        <input name="submit" type="submit" value="Create">
        [%- END %]
    </p>
</form>