Commits

Christoffer Niska  committed 01a5727

fixed carousel sliding (fixes #110)

  • Participants
  • Parent commits 11d01d6
  • Branches 1.0.0-wip

Comments (0)

Files changed (3)

File demo/protected/views/site/index.php

 
 	<h2>Carousel</h2>
 
-	<?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.'),
-			array('image'=>'http://placehold.it/770x400&text=Second+thumbnail', 'label'=>'Second 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.'),
-			array('image'=>'http://placehold.it/770x400&text=Third+thumbnail', 'label'=>'Third 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.'),
-		),
-		'events'=>array(
-			'slide'=>"js:function() { console.log('Carousel slide.'); }",
-			'slid'=>"js:function() { console.log('Carousel slid.'); }",
-		),
-	)); ?>
+    <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.'),
+                    array('image'=>'http://placehold.it/770x400&text=Second+thumbnail', 'label'=>'Second 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.'),
+                    array('image'=>'http://placehold.it/770x400&text=Third+thumbnail', 'label'=>'Third 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.'),
+                ),
+                'events'=>array(
+                    'slide'=>"js:function() { console.log('Carousel slide.'); }",
+                    'slid'=>"js:function() { console.log('Carousel slid.'); }",
+                ),
+            )); ?>
+
+        </div>
+
+    </div>
 
 	<h4>Source code</h4>
 

File gii/bootstrap/templates/default/_search.php

 <?php endforeach; ?>
 	<div class="form-actions">
 		<?php echo "<?php \$this->widget('bootstrap.widgets.TbButton', array(
+		    'buttonType'=>'submit'
 			'type'=>'primary',
 			'label'=>'Search',
 		)); ?>\n"; ?>

File widgets/TbCarousel.php

 	 * @var string the next button content.
 	 */
 	public $next = '&rsaquo;';
+    /**
+     * @var boolean whether the carousel should slide items.
+     */
+    public $slide = true;
 	/**
 	 * @var boolean whether to display the previous and next links.
 	 */
 		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
 	 */
 	public function run()
 	{
-		$id = $this->id;
+		$id = $this->htmlOptions['id'];
 
 		echo CHtml::openTag('div', $this->htmlOptions);
 		echo '<div class="carousel-inner">';