Commit 947106a4 by Crisu83

fixes an issue with form input addons

parent 3abf0951
......@@ -482,11 +482,6 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
'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\">
......@@ -538,17 +533,20 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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>
......@@ -585,9 +583,11 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<?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>
......@@ -618,9 +618,14 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
)); ?>
</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>
......
......@@ -47,6 +47,8 @@ abstract class BootInput extends CInputWidget
*/
public $data = array();
private $_addon = false;
/**
* Initializes the widget.
* @throws CException if the widget could not be initialized.
......@@ -184,6 +186,7 @@ abstract class BootInput extends CInputWidget
echo '<div class="'.$classes.'">';
if (isset($this->htmlOptions['prepend']))
{
$this->_addon = true;
echo CHtml::tag('span', $htmlOptions, $this->htmlOptions['prepend']);
unset($this->htmlOptions['prepend']);
}
......@@ -217,6 +220,7 @@ abstract class BootInput extends CInputWidget
ob_start();
if (isset($this->htmlOptions['append']))
{
$this->_addon = true;
echo CHtml::tag('span', $htmlOptions, $this->htmlOptions['append']);
unset($this->htmlOptions['append']);
}
......@@ -335,7 +339,7 @@ abstract class BootInput extends CInputWidget
*/
protected function hasAddOn()
{
return isset($this->htmlOptions['prepend']) || isset($this->htmlOptions['append']);
return $this->_addon || isset($this->htmlOptions['prepend']) || isset($this->htmlOptions['append']);
}
/**
......
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