<form method="post" class="form-horizontal">
    <legend>Message Detail</legend>
    <div class="control-group">
        <label for="txtTitle" class="control-label">Title</label>

        <div class="controls">
            <input type="text" id="txtTitle" class="input-block-level" ng-model="message.Title"
                   ng-disabled="message.ThreadID"/>
        </div>
    </div>
    <div class="control-group">
        <label for="txtTags" class="control-label">Tags</label>

        <div class="controls">
            <select id="txtTags" data-placeholder="Tags" multiple class="input-block-level chzn-select" chosen="tags"
                    ng-model="message.Tags" ng-options="tag for tag in tags" create-function="addTag">
            </select>
        </div>
    </div>

    <div class="control-group">
        <label for="ddlPriority" class="control-label">Priority</label>

        <div class="controls">
            <select id="ddlPriority" class="select-box inline" ng-model="message.Priority" chosen="priorities"
                    ng-options="l.id as l.name for l in priorities"> </select>

            <label class="checkbox inline">
                <input type="checkbox" ng-model="message.Public"> Is Public
            </label>
            <label class="checkbox inline">
                <input type="checkbox" ng-model="message.Closed"> Is Closed
            </label>
        </div>
    </div>
    <div class="control-group">
        <label for="txtUsers" class="control-label">Users</label>

        <div class="controls">
            <select id="txtUsers" data-placeholder="Users" multiple class="input-block-level chzn-select" chosen="users"
                    ng-model="message.Subscribers" ng-options="user for user in users">
            </select>
        </div>
    </div>
    <ul class="media-list">
        <li class="media" ng-repeat="post in message.Posts" ng-disabled="post.PostID">
            <div ng-switch="post.Readonly" class="media-body">
                <div ng-switch-when="true" class="media">
                    <div class="controls widget-box">
                        <div class="widget-title">
                            <h5>Created on {{post.CreationDate | localTime}} by {{post.User}} (Dated: {{post.Date}})</h5>
                            <ul class="nav nav-tabs pull-right">
                                <li>
                                    <a href ng-click="edit(post)" ng-hide="!perms['Messages']"><b class="icon-edit"></b></a>
                                </li>
                            </ul>

                        </div>
                        <div class="widget-content" ng-bind-html-unsafe="post.Content | md"></div>
                    </div>
                </div>
                <div ng-switch-when="false" class="media">
                    <label for="txtTitle" class="control-label">Title</label>

                    <div class="controls">
                        <datepicker id="txtDate" model="post.Date" ng-model="post.Date"></datepicker>
                        <div ace-editor class="input-block-level" ng-model="post.Content"></div>

                    </div>
                    <div class="row-fluid">
                        Created on {{post.CreationDate}} by {{post.User}}.
                    </div>
                </div>

            </div>
        </li>
    </ul>
    <div class="form-actions">
        <button class="btn btn-primary" ng-click="save()">Save</button>
    </div>
</form>
