Commits

Christoffer Niska  committed 9930aba

fixes an issue with form input addons

  • Participants
  • Parent commits b2bd7aa

Comments (0)

Files changed (2)

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

 	'dataProvider'=>\$listDataProvider,
 	'template'=>\"{items}\\n{pager}\",
 	'itemView'=>'_thumb',
-	// Remove the existing tooltips and rebind the plugin after each ajax-call.
-	'afterAjaxUpdate'=>\"js:function() {
-		jQuery('.tooltip').remove();
-		jQuery('a[rel=tooltip]').tooltip();
-	}\",
 )); ?>"); ?>
 
 <?php echo $htmlLighter->highlight("<li class=\"span3\">
 	<h2>Popovers</h2>
 
 	<div class="well">
-		<?php echo CHtml::link('Hover me', '#', array(
-			'class'=>'btn btn-primary btn-danger',
-			'data-title'=>'Heading',
-			'data-content'=>'Content ...',
-			'rel'=>'popover'
+		<?php $this->widget('bootstrap.widgets.BootButton', array(
+			'label'=>'Hover me',
+			'type'=>'danger',
+			'htmlOptions'=>array('data-title'=>'Heading', 'data-content'=>'Content ...', 'rel'=>'popover'),
 		)); ?>
 	</div>
 
 	<h4>Source code</h4>
 
-<?php echo $phpLighter->highlight("<?php echo CHtml::link('Hover me', '#', array('class'=>'btn btn-primary btn-danger', 'data-title'=>'Heading', 'data-content'=>'Content ...', 'rel'=>'popover')); ?>"); ?>
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootButton', array(
+	'label'=>'Hover me',
+	'type'=>'danger',
+	'htmlOptions'=>array('data-title'=>'Heading', 'data-content'=>'Content ...', 'rel'=>'popover'),
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 	<?php $this->endWidget(); ?>
 
 	<div class="well">
-		<?php echo CHtml::link('Click me','#myModal', array(
-			'class'=>'btn btn-primary',
-			'data-toggle'=>'modal',
+		<?php $this->widget('bootstrap.widgets.BootButton', array(
+			'label'=>'Click me',
+			'url'=>'#myModal',
+			'type'=>'primary',
+			'htmlOptions'=>array('data-toggle'=>'modal'),
 		)); ?>
 	</div>
 
 	)); ?>
 </div>
 
-<?php \$this->endWidget(); ?>
+<?php \$this->endWidget(); ?>"); ?>
 
-<?php echo CHtml::link('Click me','#myModal', array('class'=>'btn btn-primary', 'data-toggle'=>'modal')); ?>"); ?>
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootButton', array(
+	'label'=>'Click me',
+	'url'=>'#myModal',
+	'type'=>'primary',
+	'htmlOptions'=>array('data-toggle'=>'modal'),
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 

File widgets/input/BootInput.php

 	 */
 	public $data = array();
 
+	private $_addon = false;
+
 	/**
 	 * Initializes the widget.
 	 * @throws CException if the widget could not be initialized.
 			echo '<div class="'.$classes.'">';
 			if (isset($this->htmlOptions['prepend']))
 			{
+				$this->_addon = true;
 				echo CHtml::tag('span', $htmlOptions, $this->htmlOptions['prepend']);
 				unset($this->htmlOptions['prepend']);
 			}
 			ob_start();
 			if (isset($this->htmlOptions['append']))
 			{
+				$this->_addon = true;
 				echo CHtml::tag('span', $htmlOptions, $this->htmlOptions['append']);
 				unset($this->htmlOptions['append']);
 			}
 	 */
 	protected function hasAddOn()
 	{
-		return isset($this->htmlOptions['prepend']) || isset($this->htmlOptions['append']);
+		return $this->_addon || isset($this->htmlOptions['prepend']) || isset($this->htmlOptions['append']);
 	}
 
 	/**