<?php
/* @var $this TabberController */
/* @var $model Tabber */
$this->breadcrumbs = array(
    'Tabbers' => array('admin'),
    $model->title,
);
$this->menu = array(
    array('label' => 'Manage Tabber', 'url' => array('admin')),
    array('label' => 'Create Tabber', 'url' => array('create')),
    array('label' => 'Update Tabber', 'url' => array('update', 'id' => $model->id)),
    array('label' => 'Delete Tabber', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => 'Are you sure you want to delete this item?')),
);
?>
    <div class="page-header">
        <h1>
            View Tabber
            <small>
                <i class="icon-double-angle-right"></i>
                <?php echo $model->title; ?>
            </small>
        </h1>
    </div>
<?php if (count($tabberTabs)): ?>
    <?php
    $baseUrl = Yii::app()->baseUrl;
    ?>
    <div id="ajax-flashes" class="ajax-flashes"></div>
    <div class="col-xs-12">
        <div class="form-actions">
            <?php
            // Add a Submit button to send data to the controller
            echo CHtml::ajaxButton(Yii::t('admin', 'Save'), array('tabber/order', 'tabber_id' => $model->id), array(
                'type' => 'POST',
                'data' => array(
                    // Turn the Javascript array into a PHP-friendly string
                    'Order' => 'js:$("ul#sortable").sortable("toArray")',
                    Yii::app()->request->csrfTokenName => Yii::app()->request->getCsrfToken(),
                ),
                'success' => 'js:function(data) {
                                            jQuery(".ajax-flashes").append(data);
                                            jQuery(".page-loader").hide();
                                    }',
            ), array(
                'class' => 'btn btn-primary',
                'onClick' => 'jQuery(".page-loader").show();'));
            ?>
            <span
                class="note"> <?php echo Yii::t('admin', 'Click "Save" After reordering the tabs inside this Tabber.'); ?></span>
        </div>
        <div class="space"></div>
    </div>

    <div class="thumb-container">

        <?php
        $items = array();
        foreach ($tabberTabs as $tab) {
            $items[$tab->id] = $this->renderPartial('/tabberTab/_updateForm', array('model' => $tab), true);
        }
        $this->widget('zii.widgets.jui.CJuiSortable', array(
            'id' => 'sortable',
            'htmlOptions' => array('class' => 'col-xs-12'),
            'items' => $items,
            'options' => array(
                'cursor' => 'n-resize',
            ),
        ));
        ?>
    </div>
<?php
else:
    echo Yii::t('zii', 'No results found.');
endif;
?>