denny/ShinyCMS

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

Summary

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

<form id="edit_post" action="[% c.uri_for( '/admin/forums/post', forum_post.id, 'save' ) %]" method="post">
    <p>
        <label for="title">Title</label>
        <br><input class="textshort" type="text" id="title" name="title" value="[% forum_post.title | html %]">
    </p>
    <p>
        <label for="url_title">URL Title</label>
        <br><input class="textshort" type="text" id="url_title" name="url_title" value="[% forum_post.url_title | html %]">
    </p>
    <p>
        [%- IF c.user.has_role( 'Site Admin' ) %]
        <label for="posted">Posted</label>
        <br><input class="textshort" type="text" id="posted" name="posted" value="[% forum_post.posted.date _ ' ' _ forum_post.posted.strftime('%H:%M') %]">
        [%- ELSE %]
        <span class="label">Posted</span>
        <br>[% forum_post.posted.day %] [% forum_post.posted.month_abbr %] [% forum_post.posted.year %]
        [%- END %]
    </p>
    <p>
        <label for="display_order">Display Order</label>
        <br><input class="textshort" type="text" id="display_order" name="display_order" value="[% forum_post.display_order | html %]">
    </p>
    <p>
        <label for="body">Body</label>
        <br><textarea class="ckeditor" id="body" name="body" cols="60" rows="4">[% forum_post.body | html %]</textarea>
    </p>

    <p>
        <input type="submit" value="Save">
        <input type="reset"  value="Reset">
        [%- IF forum_post.id %]
        <input name="delete"  type="submit" value="Delete" onclick="javascript:return confirm('Are you sure you want to delete this item?')">
        [%- END %]
        <input type="hidden" name="forum_id" value="[% forum.id %]">
    </p>
</form>