<div class="form" id="comments-form">

    <?php
    $id = "{$this->getId()}-comment-form";
    $form = $this->beginWidget('CActiveForm', array(
        'id' => $id,
    ));
    echo CHtml::hiddenField('returnUrl', Yii::app()->request->url);
    ?>
    <div id="status-message"></div>

    <div class="row span-half">
        <?php echo $form->labelEx($model, 'sender_name'); ?>
        <?php echo $form->textField($model, 'sender_name', array('maxlength' => 100)); ?>
        <?php echo $form->error($model, 'sender_name'); ?>
    </div>


    <div class="row span-half last">
        <?php echo $form->labelEx($model, 'sender_email'); ?>
        <?php echo $form->textField($model, 'sender_email', array('maxlength' => 100)); ?>
        <?php echo $form->error($model, 'sender_email'); ?>
    </div>  
    <div class="clear"></div>

    <!--    <div class="row">
    <?php // echo $form->labelEx($model, 'sender_homepage'); ?>
    <?php // echo $form->textField($model, 'sender_homepage', array('maxlength' => 100));  ?>
    <?php // echo $form->error($model, 'sender_homepage');  ?>
        </div>-->

    <div class="row">
        <?php echo $form->labelEx($model, 'body'); ?>
        <?php echo $form->textArea($model, 'body', array('rows' => 6, 'cols' => 50)); ?>
        <?php echo $form->error($model, 'body'); ?>
    </div>


    <?php echo $form->hiddenField($model, 'owner_route', array('maxlength' => 100)); ?>
    <?php echo $form->hiddenField($model, 'owner_params', array('maxlength' => 300)); ?>
    <?php echo $form->hiddenField($model, 'parent_id'); ?>



    <div class="row buttons">

        <?php
        echo CHtml::ajaxSubmitButton(
                Yii::t('site', 'Post Comment'), array('site/postComment'), array(
            'dataType' => 'json',
            'success' => 'function(data) {
                         $("#ajax-loader").hide();  
                         $("#status-message").html(data.message);
                         $("#' . $id . '")[0].reset();
                       
                    }',
            'beforeSend' => 'function(){                        
                           $("#ajax-loader").show();
                      }'
                ), array(
            'id' => 'post-comment-button',
                )
        );
        ?>
    </div>
    <?php $this->endWidget(); ?>

</div>


<?php
$this->widget('zii.widgets.CListView', array(
    'dataProvider' => $dataProvider,
    'id' => 'comments-listview',
    'itemView' => "{$this->shortCode}/_view",
    'template' => '{items}{pager}',
    'emptyText' => '',
    'pager' => array(
        'header' => false,
        'maxButtonCount' => '4',
        'nextPageLabel' => '>>',
        'prevPageLabel' => '<<',
    ),
));
?>