Commit 55a44b92 by Crisu83

fixed carousel sliding (fixes #110)

parent 082ba8a2
......@@ -1253,6 +1253,10 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<h2>Carousel</h2>
<div class="row">
<div class="span8">
<?php $this->widget('bootstrap.widgets.TbCarousel', array(
'items'=>array(
array('image'=>'http://placehold.it/770x400&text=First+thumbnail', 'label'=>'First Thumbnail label', 'caption'=>'Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.'),
......@@ -1265,6 +1269,10 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
),
)); ?>
</div>
</div>
<h4>Source code</h4>
<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.TbCarousel', array(
......
......@@ -20,6 +20,7 @@
<?php endforeach; ?>
<div class="form-actions">
<?php echo "<?php \$this->widget('bootstrap.widgets.TbButton', array(
'buttonType'=>'submit'
'type'=>'primary',
'label'=>'Search',
)); ?>\n"; ?>
......
......@@ -22,6 +22,10 @@ class TbCarousel extends CWidget
*/
public $next = '&rsaquo;';
/**
* @var boolean whether the carousel should slide items.
*/
public $slide = true;
/**
* @var boolean whether to display the previous and next links.
*/
public $displayPrevAndNext = true;
......@@ -50,7 +54,12 @@ class TbCarousel extends CWidget
if (!isset($this->htmlOptions['id']))
$this->htmlOptions['id'] = $this->getId();
$classes = 'carousel';
$classes = array('carousel');
if ($this->slide === true)
$classes[] = 'slide';
$classes = implode($classes, ' ');
if (isset($this->htmlOptions['class']))
$this->htmlOptions['class'] .= ' '.$classes;
else
......@@ -63,7 +72,7 @@ class TbCarousel extends CWidget
*/
public function run()
{
$id = $this->id;
$id = $this->htmlOptions['id'];
echo CHtml::openTag('div', $this->htmlOptions);
echo '<div class="carousel-inner">';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment