Christoffer Niska avatar Christoffer Niska committed 66e5960

changed BootButton::fn to buttonType and updated the demo

Comments (0)

Files changed (8)

components/Bootstrap.php

  * @author Christoffer Niska <ChristofferNiska@gmail.com>
  * @copyright Copyright &copy; Christoffer Niska 2011-
  * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
- * @version 1.0.0
+ * @version 0.9.11
  */
 
 /**
 
 	/**
 	 * Registers the Yii-specific CSS missing from Bootstrap.
-	 * @since 1.0.0
+	 * @since 0.9.11
 	 */
 	public function registerYiiCss()
 	{

demo/css/styles.css

 .input-block-level{display:block;width:100%;min-height:28px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;}
 
 
+
 .php-hl-default{color:Black;}
 .php-hl-code{color:Gray;}
 .php-hl-brackets{color:Olive;}
 #bootCarousel .carousel{width:770px;}#bootCarousel .carousel .carousel-caption p{margin-bottom:9px;}
 
 #bootTypeahead input{margin-bottom:0;}
-.hl-code{margin-bottom:20px;}.hl-code pre{background:#FCFCFC;border-color:#EEE transparent #EEE;font-family:"Menlo","Consolas","Courier New",Courier,mono;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}
+.php-hl-main,.html-hl-main,.javascript-hl-main{margin-bottom:20px;}.php-hl-main pre,.html-hl-main pre,.javascript-hl-main pre{background:#FCFCFC;border-color:#EEE transparent #EEE;font-family:"Menlo","Consolas","Courier New",Courier,mono;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}
 
 .maintenance .hero-unit{text-align:center;}.maintenance .hero-unit p{text-align:inherit;}
 

demo/less/styles.less

 	margin-bottom: 0;
 }
 
-.hl-code {
+.php-hl-main,
+.html-hl-main,
+.javascript-hl-main {
 	margin-bottom: 20px;
 
 	pre {

demo/protected/controllers/SiteController.php

 		);
 
 		$tabbable = array(
-			array('label'=>'Section 1', 'content'=>'<p>I\'m in Section 1.</p>'),
+			array('label'=>'Section 1', 'content'=>'<p>I\'m in Section 1.</p>', 'active'=>true),
 			array('label'=>'Section 2', 'content'=>'<p>Howdy, I\'m in Section 2.</p>'),
 			array('label'=>'Section 3', 'content'=>'<p>What up girl, this is Section 3.</p>'),
 		);
 			'pagination'=>array('pageSize'=>8),
 		));
 
+		$phpLighter = new CTextHighlighter();
+		$phpLighter->language = 'PHP';
+
+		$jsLighter = new CTextHighlighter();
+		$jsLighter->language = 'JAVASCRIPT';
+
+		$htmlLighter = new CTextHighlighter();
+		$htmlLighter->language = 'HTML';
+
 		$this->render('index', array(
 			'model'=>$model,
 			'person'=>new Person(),
 			'gridDataProvider'=>$gridDataProvider,
 			'gridColumns'=>$gridColumns,
 			'listDataProvider'=>$listDataProvider,
-			'parser'=>new CMarkdownParser(),
+			'phpLighter'=>$phpLighter,
+			'jsLighter'=>$jsLighter,
+			'htmlLighter'=>$htmlLighter,
 		));
 	}
 

demo/protected/views/site/index.php

 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<?php
+<?php echo $phpLighter->highlight("<?php
 Yii::app()->user->setFlash('success', '<strong>Well done!</strong> You successfully read this important alert message.');
 Yii::app()->user->setFlash('info', '<strong>Heads up!</strong> This alert needs your attention, but it\'s not super important.');
 Yii::app()->user->setFlash('warning', '<strong>Warning!</strong> Best check yo self, you\'re not looking too good.');
 Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few things up and try submitting again.');
-?>
-~~~
-~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootAlert'); ?>
-~~~"); ?>
+?>"); ?>
+
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootAlert'); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootBreadcrumbs', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootBreadcrumbs', array(
 	'links'=>array('Library'=>'#', 'Data'),
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootNavbar', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootNavbar', array(
 	'fixed'=>false,
 	'brand'=>'Project name',
 	'brandUrl'=>'#',
 			),
 		),
 	),
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootMenu', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootMenu', array(
 	'type'=>'tabs', // '', 'tabs', 'pills' (or 'list')
 	'stacked'=>false, // whether this is a stacked menu
 	'items'=>array(
 		array('label'=>'Profile', 'url'=>'#'),
 		array('label'=>'Messages', 'url'=>'#'),
 	),
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 	<h3>Nav list</h3>
 
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootMenu', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootMenu', array(
 	'type'=>'list',
 	'items'=>array(
 		array('label'=>'LIST HEADER'),
 		array('label'=>'Settings', 'icon'=>'cog', 'url'=>'#'),
 		array('label'=>'Help', 'icon'=>'flag', 'url'=>'#'),
 	),
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-	<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootTabbable', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootTabbable', array(
 	'type'=>'tabs', // 'tabs' or 'pills'
 	'tabs'=>array(
 		array('label'=>'Home', 'content'=>'Raw denim you probably haven\'t heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth. Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.', 'active'=>true),
 			'shown'=>\"js:function() { console.log('Tabbable shown.'); }\",
 		),
 	),
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 	<div class="alert alert-block alert-warning">
 		<strong>Note!</strong>
 
 	</div>
 
-	<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootTabbable', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootTabbable', array(
 	'type'=>'tabs',
 	'placement'=>'below', // 'above', 'right', 'below' or 'left'
 	'tabs'=>array(
 		array('label'=>'Section 2', 'content'=>'<p>Howdy, I\'m in Section 2.</p>'),
 		array('label'=>'Section 3', 'content'=>'<p>What up girl, this is Section 3.</p>'),
 	),
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootDetailView', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootDetailView', array(
 	'data'=>array('id'=>1, 'firstName'=>'Mark', 'lastName'=>'Otto', 'language'=>'CSS'),
 	'attributes'=>array(
 		array('name'=>'firstName', 'label'=>'First name'),
 		array('name'=>'lastName', 'label'=>'Last name'),
 		array('name'=>'language', 'label'=>'Language'),
 	),
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 	<?php $this->widget('bootstrap.widgets.BootGridView', array(
 		'type'=>'striped bordered condensed',
 		'dataProvider'=>$gridDataProvider,
-		'template'=>"{summary}\n{items}\n{pager}",
+		'template'=>"{items}",
 		'filter'=>$person->search(),
 		'columns'=>$gridColumns,
 	)); ?>
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-\$gridDataProvider = new CArrayDataProvider(array(
+<?php echo $phpLighter->highlight("\$gridDataProvider = new CArrayDataProvider(array(
 	array('id'=>1, 'firstName'=>'Mark', 'lastName'=>'Otto', 'language'=>'CSS'),
 	array('id'=>2, 'firstName'=>'Jacob', 'lastName'=>'Thornton', 'language'=>'JavaScript'),
 	array('id'=>3, 'firstName'=>'Stu', 'lastName'=>'Dent', 'language'=>'HTML'),
-));
-~~~
-~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootGridView', array(
+));"); ?>
+
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootGridView', array(
+	'type'=>'striped bordered condensed',
 	'dataProvider'=>\$gridDataProvider,
 	'template'=>\"{items}\",
-	'itemsCssClass'=>'table table-striped table-bordered table-condensed',
 	'columns'=>array(
 		array('name'=>'id', 'header'=>'#'),
 		array('name'=>'firstName', 'header'=>'First name'),
 			'htmlOptions'=>array('style'=>'width: 50px'),
 		),
 	),
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootThumbnails', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootThumbnails', array(
 	'dataProvider'=>\$listDataProvider,
 	'template'=>\"{items}\\n{pager}\",
 	'itemView'=>'_thumb',
 		jQuery('.tooltip').remove();
 		jQuery('a[rel=tooltip]').tooltip();
 	}\",
-)); ?>
-~~~
-**\_thumb.php**
-~~~
-[html]
-<li class=\"span3\">
+)); ?>"); ?>
+
+<?php echo $htmlLighter->highlight("<li class=\"span3\">
 	<a href=\"#\" class=\"thumbnail\" rel=\"tooltip\" data-title=\"Tooltip\">
 		<img src=\"http://placehold.it/280x180\" alt=\"\">
 	</a>
-</li>
-~~~"); ?>
+</li>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[html]
-<p class=\"well\">
+<?php echo $htmlLighter->highlight("<p class=\"well\">
 	Lorem ipsum dolor sit <a href=\"#\" rel=\"tooltip\" title=\"First tooltip\">amet</a>,
 	consectetur adipiscing elit.
 	Fusce ut velit sem, id elementum elit. Quisque tincidunt magna in quam luctus a ultrices tellus luctus.
 	Maecenas nec ligula sed ipsum posuere sollicitudin pretium ac sapien.
 	Sed odio dui, pretium eu pellentesque ac,
 	<a href=\"#\" rel=\"tooltip\" title=\"Yet another tooltip\">tempor</a> sed sem.
-</p>
-~~~"); ?>
+</p>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<?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 echo CHtml::link('Hover me', '#', array('class'=>'btn btn-primary btn-danger', 'data-title'=>'Heading', 'data-content'=>'Content ...', 'rel'=>'popover')); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<?php $this->beginWidget('bootstrap.widgets.BootModal', array(
 		'id'=>'modal',
-		'htmlOptions'=>array('class'=>'hide'),
 		'events'=>array(
-			'show'=>"js:function() { console.log('modal show.'); }",
-			'shown'=>"js:function() { console.log('modal shown.'); }",
-			'hide'=>"js:function() { console.log('modal hide.'); }",
-			'hidden'=>"js:function() { console.log('modal hidden.'); }",
+			'show'=>"js:function() { console.log('Modal show.'); }",
+			'shown'=>"js:function() { console.log('Modal shown.'); }",
+			'hide'=>"js:function() { console.log('Modal hide.'); }",
+			'hidden'=>"js:function() { console.log('Modal hidden.'); }",
 		),
 	)); ?>
 
 		<a class="close" data-dismiss="modal">&times;</a>
 		<h3>Modal header</h3>
 	</div>
+
 	<div class="modal-body">
 		<p>One fine body...</p>
 	</div>
+
 	<div class="modal-footer">
-		<?php echo CHtml::link('Save changes', '#', array('class'=>'btn btn-primary', 'data-dismiss'=>'modal')); ?>
-		<?php echo CHtml::link('Close', '#', array('class'=>'btn', 'data-dismiss'=>'modal')); ?>
+		<?php $this->widget('bootstrap.widgets.BootButton', array('type'=>'primary', 'label'=>'Save changes', 'url'=>'#', 'htmlOptions'=>array('data-dismiss'=>'modal'))); ?>
+		<?php $this->widget('bootstrap.widgets.BootButton', array('label'=>'Close', 'url'=>'#', 'htmlOptions'=>array('data-dismiss'=>'modal'))); ?>
 	</div>
 
 	<?php $this->endWidget(); ?>
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->beginWidget('bootstrap.widgets.BootModal', array(
+<?php echo $phpLighter->highlight("<?php \$this->beginWidget('bootstrap.widgets.BootModal', array(
 	'id'=>'modal',
-	'htmlOptions'=>array('class'=>'hide'),
 	'events'=>array(
-		'show'=>\"js:function() { console.log('modal show.'); }\",
-		'shown'=>\"js:function() { console.log('modal shown.'); }\",
-		'hide'=>\"js:function() { console.log('modal hide.'); }\",
-		'hidden'=>\"js:function() { console.log('modal hidden.'); }\",
+		'show'=>\"js:function() { console.log('Modal show.'); }\",
+		'shown'=>\"js:function() { console.log('Modal shown.'); }\",
+		'hide'=>\"js:function() { console.log('Modal hide.'); }\",
+		'hidden'=>\"js:function() { console.log('Modal hidden.'); }\",
 	),
 )); ?>
-~~~
-~~~
-[html]
+
 <div class=\"modal-header\">
 	<a class=\"close\" data-dismiss=\"modal\">&times;</a>
 	<h3>Modal header</h3>
 </div>
+
 <div class=\"modal-body\">
 	<p>One fine body…</p>
 </div>
+
 <div class=\"modal-footer\">
-	<?php echo CHtml::link('Save changes', '#', array('class'=>'btn btn-primary', 'data-dismiss'=>'modal')); ?>
-	<?php echo CHtml::link('Close', '#', array('class'=>'btn', 'data-dismiss'=>'modal')); ?>
+	<?php \$this->widget('bootstrap.widgets.BootButton', array(
+		'type'=>'primary',
+		'label'=>'Save changes',
+		'url'=>'#',
+		'htmlOptions'=>array('data-dismiss'=>'modal'),
+	)); ?>
+	<?php \$this->widget('bootstrap.widgets.BootButton', array(
+		'label'=>'Close',
+		'url'=>'#',
+		'htmlOptions'=>array('data-dismiss'=>'modal'),
+	)); ?>
 </div>
-~~~
-~~~
-[php]
+
 <?php \$this->endWidget(); ?>
-~~~
-~~~
-[php]
-<?php echo CHtml::link('Click me','#modal', array('class'=>'btn btn-primary', 'data-toggle'=>'modal')); ?>
-~~~"); ?>
+
+<?php echo CHtml::link('Click me','#modal', array('class'=>'btn btn-primary', 'data-toggle'=>'modal')); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 	<?php echo $form->textFieldRow($model, 'textField', array('class'=>'span3')); ?>
 	<?php echo $form->passwordFieldRow($model, 'password', array('class'=>'span3')); ?>
 	<?php echo $form->checkboxRow($model, 'checkbox'); ?>
-	<?php echo CHtml::htmlButton('<i class="icon-ok"></i> Submit', array('class'=>'btn', 'type'=>'submit')); ?>
+	<?php $this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'icon'=>'ok', 'label'=>'Submit')); ?>
 
 	<?php $this->endWidget(); ?>
 
+	<h4>Source code</h4>
+
+<?php echo $phpLighter->highlight("<?php /** @var BootActiveForm \$form */
+\$form = \$this->beginWidget('bootstrap.widgets.BootActiveForm', array(
+	'id'=>'verticalForm',
+	'htmlOptions'=>array('class'=>'well'),
+)); ?>
+
+<?php echo \$form->textFieldRow(\$model, 'textField', array('class'=>'span3')); ?>
+<?php echo \$form->passwordFieldRow(\$model, 'password', array('class'=>'span3')); ?>
+<?php echo \$form->checkboxRow(\$model, 'checkbox'); ?>
+<?php \$this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'icon'=>'ok', 'label'=>'Submit')); ?>
+
+<?php \$this->endWidget(); ?>"); ?>
+
 	<h3>Search</h3>
 
 	<?php /** @var BootActiveForm $form */
 	)); ?>
 
 	<?php echo $form->textFieldRow($model, 'textField', array('class'=>'input-medium')); ?>
-	<?php echo CHtml::htmlButton('<i class="icon-search"></i> Search', array('class'=>'btn', 'type'=>'submit')); ?>
+	<?php $this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'icon'=>'search', 'label'=>'Search')); ?>
 
 	<?php $this->endWidget(); ?>
 
+	<h4>Source code</h4>
+
+<?php echo $phpLighter->highlight("<?php /** @var BootActiveForm \$form */
+\$form = \$this->beginWidget('bootstrap.widgets.BootActiveForm', array(
+	'id'=>'searchForm',
+	'type'=>'search',
+	'htmlOptions'=>array('class'=>'well'),
+)); ?>
+
+<?php echo \$form->textFieldRow(\$model, 'textField', array('class'=>'input-medium')); ?>
+<?php \$this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'icon'=>'search', 'label'=>'Search')); ?>
+
+<?php \$this->endWidget(); ?>"); ?>
+
 	<h3>Inline</h3>
 
 	<?php /** @var BootActiveForm $form */
 
 	<?php echo $form->textFieldRow($model, 'textField', array('class'=>'input-small')); ?>
 	<?php echo $form->passwordFieldRow($model, 'password', array('class'=>'input-small')); ?>
-	<?php echo CHtml::htmlButton('Go', array('class'=>'btn', 'type'=>'submit')); ?>
+	<?php $this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'icon'=>'arrow-right', 'label'=>'Log in')); ?>
 
 	<?php $this->endWidget(); ?>
 
+	<h4>Source code</h4>
+
+<?php echo $phpLighter->highlight("<?php /** @var BootActiveForm \$form */
+\$form = \$this->beginWidget('bootstrap.widgets.BootActiveForm', array(
+	'id'=>'inlineForm',
+	'type'=>'inline',
+	'htmlOptions'=>array('class'=>'well'),
+)); ?>
+
+<?php echo \$form->textFieldRow(\$model, 'textField', array('class'=>'input-small')); ?>
+<?php echo \$form->passwordFieldRow(\$model, 'password', array('class'=>'input-small')); ?>
+<?php \$this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'icon'=>'arrow-right', 'label'=>'Log in')); ?>
+
+<?php \$this->endWidget(); ?>"); ?>
+
 	<h3>Horizontal</h3>
 
 	<?php /** @var BootActiveForm $form */
 	</fieldset>
 
 	<div class="form-actions">
-		<?php echo CHtml::htmlButton('<i class="icon-ok icon-white"></i> Submit', array('class'=>'btn btn-primary', 'type'=>'submit')); ?>
-		<?php echo CHtml::htmlButton('<i class="icon-ban-circle"></i> Reset', array('class'=>'btn', 'type'=>'reset')); ?>
+		<?php $this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'type'=>'primary', 'icon'=>'ok white', 'label'=>'Submit')); ?>
+		<?php $this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'reset', 'icon'=>'remove', 'label'=>'Reset')); ?>
 	</div>
 
 	<?php $this->endWidget(); ?>
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<?php /** @var BootActiveForm \$form */
-\$form = \$this->beginWidget('bootstrap.widgets.BootActiveForm', array(
-	'id'=>'verticalForm',
-	'htmlOptions'=>array('class'=>'well'),
-)); ?>
-
-<?php echo \$form->textFieldRow(\$model, 'textField', array('class'=>'span3')); ?>
-<?php echo \$form->passwordFieldRow(\$model, 'password', array('class'=>'span3')); ?>
-<?php echo \$form->checkboxRow(\$model, 'checkbox'); ?>
-<?php echo CHtml::htmlButton('<i class=\"icon-ok\"></i> Submit', array('class'=>'btn', 'type'=>'submit')); ?>
-
-<?php \$this->endWidget(); ?>
-~~~
-~~~
-[php]
-<?php /** @var BootActiveForm \$form */
-\$form = \$this->beginWidget('bootstrap.widgets.BootActiveForm', array(
-	'id'=>'searchForm',
-	'type'=>'search',
-	'htmlOptions'=>array('class'=>'well'),
-)); ?>
-
-<?php echo \$form->textFieldRow(\$model, 'textField', array('class'=>'input-medium')); ?>
-<?php echo CHtml::htmlButton('<i class=\"icon-search\"></i> Search', array('class'=>'btn','type'=>'submit')); ?>
-
-<?php \$this->endWidget(); ?>
-~~~
-~~~
-[php]
-<?php /** @var BootActiveForm \$form */
-\$form = \$this->beginWidget('bootstrap.widgets.BootActiveForm', array(
-	'id'=>'inlineForm',
-	'type'=>'inline',
-	'htmlOptions'=>array('class'=>'well'),
-)); ?>
-
-<?php echo \$form->textFieldRow(\$model, 'textField', array('class'=>'input-small')); ?>
-<?php echo \$form->passwordFieldRow(\$model, 'password', array('class'=>'input-small')); ?>
-<?php echo CHtml::htmlButton('Go', array('class'=>'btn', 'type'=>'submit')); ?>
-
-<?php \$this->endWidget(); ?>
-~~~
-~~~
-[php]
-<?php /** @var BootActiveForm \$form */
+<?php echo $phpLighter->highlight("<?php /** @var BootActiveForm \$form */
 \$form = \$this->beginWidget('bootstrap.widgets.BootActiveForm', array(
 	'id'=>'horizontalForm',
 	'type'=>'horizontal',
 </fieldset>
 
 <div class=\"form-actions\">
-	<?php echo CHtml::htmlButton('<i class=\"icon-ok icon-white\"></i> Submit', array('class'=>'btn btn-primary', 'type'=>'submit')); ?>
-	<?php echo CHtml::htmlButton('<i class=\"icon-ban-circle\"></i> Reset', array('class'=>'btn', 'type'=>'reset')); ?>
+	<?php \$this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'submit', 'type'=>'primary', 'icon'=>'ok white', 'label'=>'Submit')); ?>
+	<?php \$this->widget('bootstrap.widgets.BootButton', array('buttonType'=>'reset', 'icon'=>'remove', 'label'=>'Reset')); ?>
 </div>
 
-<?php \$this->endWidget(); ?>
-~~~"); ?>
+<?php \$this->endWidget(); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<p>
-	<?php \$this->widget('bootstrap.widgets.BootButton', array(
-		'label'=>'Primary',
-		'type'=>'primary', // '', 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'
-		'size'=>'large', // '', 'large', 'small' or 'mini'
-	)); ?>
-</p>
-~~~"); ?>
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootButton', array(
+	'label'=>'Primary',
+	'type'=>'primary', // '', 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'
+	'size'=>'large', // '', 'large', 'small' or 'mini'
+)); ?>"); ?>
 
 	<h3>Button groups</h3>
 
 		)); ?>
 	</div>
 
+	<h4>Source code</h4>
+
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootButtonGroup', array(
+	'buttons'=>array(
+		array('label'=>'1', 'url'=>'#'),
+		array('label'=>'2', 'url'=>'#'),
+		array('label'=>'3', 'url'=>'#'),
+		array('label'=>'4', 'url'=>'#'),
+	),
+)); ?>"); ?>
+
 	<h3>Dropdowns</h3>
 
 	<div class="btn-toolbar">
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<div class=\"btn-toolbar\">
+<?php echo $phpLighter->highlight("<div class=\"btn-toolbar\">
 	<?php \$this->widget('bootstrap.widgets.BootButtonGroup', array(
 		'type'=>'primary', // '', 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'
 		'buttons'=>array(
 			)),
 		),
 	)); ?>
-</div>
-~~~"); ?>
+</div>"); ?>
 
 	<h3>Split dropdowns</h3>
 
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<div class=\"btn-toolbar\">
+<?php echo $phpLighter->highlight("<div class=\"btn-toolbar\">
 	<?php \$this->widget('bootstrap.widgets.BootButtonGroup', array(
 	    'type'=>'primary', // '', 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'
 		'buttons'=>array(
 			)),
 		),
 	)); ?>
-</div>
-~~~"); ?>
+</div>"); ?>
 
 	<h3>Stateful</h3>
 
 	<p>
 		<?php $this->widget('bootstrap.widgets.BootButton', array(
-			'fn'=>'button',
+			'buttonType'=>'button',
 			'type'=>'primary',
 			'label'=>'Click me',
 			'loadingText'=>'loading...',
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootButton', array(
-	'fn'=>'button',
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootButton', array(
+	'buttonType'=>'button',
 	'type'=>'primary',
 	'label'=>'Click me',
 	'loadingText'=>'loading...',
 	'htmlOptions'=>array('id'=>'buttonStateful'),
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
-<?php echo $parser->safeTransform("~~~
-[javascript]
-$('#buttonStateful').click(function() {
+<?php echo $jsLighter->highlight("$('#buttonStateful').click(function() {
 	var btn = $(this);
 	btn.button('loading'); // call the loading function
 	setTimeout(function() {
 		btn.button('reset'); // call the reset function
 	}, 3000);
-});
-~~~"); ?>
+});"); ?>
 
 	<h3>Single state</h3>
 
 	<p>
 		<?php $this->widget('bootstrap.widgets.BootButton', array(
-			'fn'=>'button',
+			'buttonType'=>'button',
 			'type'=>'primary',
 			'label'=>'Toggle me',
 			'toggle'=>true,
 
 	<h4>Source code</h4>
 
-<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootButton', array(
-	'fn'=>'button',
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootButton', array(
+	'buttonType'=>'button',
 	'type'=>'primary',
 	'label'=>'Toggle me',
 	'toggle'=>true,
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
-	<h3>Checkbox</h3>
+	<div class="row">
 
-	<p>@todo</p>
+		<div class="span3">
 
-	<h3>Radio</h3>
+			<h3>Checkbox</h3>
 
-	<p>@todo</p>
+			<?php $this->widget('bootstrap.widgets.BootButtonGroup', array(
+				'type' => 'primary',
+				'toggle' => 'checkbox',
+				'buttons' => array(
+					array('label'=>'Left'),
+					array('label'=>'Middle'),
+					array('label'=>'Right'),
+				),
+			)); ?>
+			<br />
+
+		</div>
+
+		<div class="span3">
+
+			<h3>Radio</h3>
+
+			<?php $this->widget('bootstrap.widgets.BootButtonGroup', array(
+				'type' => 'primary',
+				'toggle' => 'radio',
+				'buttons' => array(
+					array('label'=>'Left'),
+					array('label'=>'Middle'),
+					array('label'=>'Right'),
+				),
+			)); ?>
+			<br />
+
+		</div>
+
+	</div>
+
+	<h4>Source code</h4>
+
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootButtonGroup', array(
+	'type' => 'primary',
+	'toggle' => 'radio', // 'checkbox' or 'radio'
+	'buttons' => array(
+		array('label'=>'Left'),
+		array('label'=>'Middle'),
+		array('label'=>'Right'),
+	),
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-	<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->beginWidget('bootstrap.widgets.BootHero', array(
+<?php echo $phpLighter->highlight("<?php \$this->beginWidget('bootstrap.widgets.BootHero', array(
 	'heading'=>'Hello, world!',
-)); ?>
-~~~
-~~~
-[html]
-<p>This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
-<p><a class=\"btn btn-primary btn-large\">Learn more</a></p>
-~~~
-~~~
-[php]
-<?php \$this->endWidget(); ?>
-~~~"); ?>
+)); ?>"); ?>
+
+<?php echo $htmlLighter->highlight("<p>This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
+<p><a class=\"btn btn-primary btn-large\">Learn more</a></p>"); ?>
+
+<?php echo $phpLighter->highlight("<?php \$this->endWidget(); ?>"); ?>
 
 		<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-	<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootCarousel', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootCarousel', 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.'),
 		'slide'=>\"js:function() { console.log('Carousel slide.'); }\",
 		'slid'=>\"js:function() { console.log('Carousel slid.'); }\",
 	),
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 		<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-	<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootProgress', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootProgress', array(
 	'type'=>'danger', // '', 'info', 'success' or 'danger'
 	'percent'=>40, // the progress
 	'striped'=>true,
 	'animated'=>true,
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 	<h4>Source code</h4>
 
-	<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootTypeahead', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootTypeahead', array(
 	'options'=>array(
 		'source'=>array('Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Dakota', 'North Carolina', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'),
 		'items'=>4,
 	        return ~item.toLowerCase().indexOf(this.query.toLowerCase());
 	    }\",
 	),
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 <section id="bootLabel">
 
-	<h2>Labels <small>Coming in 1.0.0</small></h2>
+	<h2>Labels</h2>
 
 	<p>
 		<?php $this->widget('bootstrap.widgets.BootLabel', array('label'=>'Default')); ?>
 
 	<h4>Source code</h4>
 
-	<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootLabel', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootLabel', array(
 	'type'=>'success', // '', 'success', 'warning', 'important', 'info' or 'inverse'
 	'label'=>'Success',
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 
 
 <section id="bootBadge">
 
-	<h2>Badges <small>Coming in 1.0.0</small></h2>
+	<h2>Badges</h2>
 
 	<p>
 		<?php $this->widget('bootstrap.widgets.BootBadge', array('label'=>'1')); ?>
 
 	<h4>Source code</h4>
 
-	<?php echo $parser->safeTransform("~~~
-[php]
-<?php \$this->widget('bootstrap.widgets.BootBadge', array(
+<?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.BootBadge', array(
 	'type'=>'success', // '', 'success', 'warning', 'error', 'info' or 'inverse'
 	'label'=>'2',
-)); ?>
-~~~"); ?>
+)); ?>"); ?>
 
 	<a class="top" href="#top">Back to top &uarr;</a>
 

widgets/BootButton.php

  */
 class BootButton extends BootWidget
 {
-	// Button callback functions.
-	const FN_LINK = 'link';
-	const FN_BUTTON = 'button';
-	const FN_SUBMIT = 'submit';
-	const FN_SUBMITLINK = 'submitLink';
-	const FN_RESET = 'reset';
-	const FN_AJAXLINK = 'ajaxLink';
-	const FN_AJAXBUTTON = 'ajaxButton';
-	const FN_AJAXSUBMIT = 'ajaxSubmit';
+	// Button callback types.
+	const BUTTON_LINK = 'link';
+	const BUTTON_BUTTON = 'button';
+	const BUTTON_SUBMIT = 'submit';
+	const BUTTON_SUBMITLINK = 'submitLink';
+	const BUTTON_RESET = 'reset';
+	const BUTTON_AJAXLINK = 'ajaxLink';
+	const BUTTON_AJAXBUTTON = 'ajaxButton';
+	const BUTTON_AJAXSUBMIT = 'ajaxSubmit';
 
 	// Button types.
 	const TYPE_NORMAL = '';
 	const SIZE_LARGE = 'large';
 
 	/**
-	 * @var string the callback function for rendering the button.
+	 * @var string the button callback types.
 	 * Valid values are 'link', 'button', 'submit', 'submitLink', 'reset', 'ajaxLink', 'ajaxButton' and 'ajaxSubmit'.
 	 */
-	public $fn = self::FN_LINK;
+	public $buttonType = self::BUTTON_LINK;
 	/**
 	 * @var string the button type.
 	 * Valid values are '', 'primary', 'info', 'success', 'warning', 'danger' and 'inverse'.
 	public $ajaxOptions = array();
 	/**
 	 * @var array the HTML options for the dropdown menu.
-	 * @since 1.0.0
+	 * @since 0.9.11
 	 */
 	public $dropdownOptions = array();
 
 		echo $this->createButton();
 
 		if ($this->hasDropdown())
+		{
 			$this->controller->widget('bootstrap.widgets.BootDropdown', array(
 				'encodeLabel'=>$this->encodeLabel,
 				'items'=>$this->items,
 				'htmlOptions'=>$this->dropdownOptions,
 			));
+		}
 	}
 
 	/**
 	 */
 	protected function createButton()
 	{
-		switch ($this->fn)
+		switch ($this->buttonType)
 		{
-			case self::FN_BUTTON:
+			case self::BUTTON_BUTTON:
 				return CHtml::htmlButton($this->label, $this->htmlOptions);
 
-			case self::FN_SUBMIT:
+			case self::BUTTON_SUBMIT:
 				$this->htmlOptions['type'] = 'submit';
 				return CHtml::htmlButton($this->label, $this->htmlOptions);
 
-			case self::FN_RESET:
+			case self::BUTTON_RESET:
 				$this->htmlOptions['type'] = 'reset';
 				return CHtml::htmlButton($this->label, $this->htmlOptions);
 
-			case self::FN_SUBMITLINK:
+			case self::BUTTON_SUBMITLINK:
 				return CHtml::linkButton($this->label, $this->htmlOptions);
 
-			case self::FN_AJAXLINK:
+			case self::BUTTON_AJAXLINK:
 				return CHtml::ajaxLink($this->label, $this->url, $this->ajaxOptions, $this->htmlOptions);
 
-			case self::FN_AJAXBUTTON:
+			case self::BUTTON_AJAXBUTTON:
 				$this->ajaxOptions['url'] = $this->url;
 				$this->htmlOptions['ajax'] = $this->ajaxOptions;
 				return CHtml::htmlButton($this->label, $this->htmlOptions);
 
-			case self::FN_AJAXSUBMIT:
+			case self::BUTTON_AJAXSUBMIT:
 				$this->ajaxOptions['type'] = 'POST';
 				$this->ajaxOptions['url'] = $this->url;
 				$this->htmlOptions['type'] = 'submit';
 				return CHtml::htmlButton($this->label, $this->htmlOptions);
 
 			default:
-			case self::FN_LINK:
+			case self::BUTTON_LINK:
 				return CHtml::link($this->label, $this->url, $this->htmlOptions);
 		}
 	}

widgets/BootButtonGroup.php

 	const TOGGLE_RADIO = 'radio';
 
 	/**
-	 * @var string the button function.
-	 * @see BootButton::fn
+	 * @var string the button callback type.
+	 * @see BootButton::buttonType
 	 */
-	public $fn = BootButton::FN_LINK;
+	public $buttonType = BootButton::BUTTON_LINK;
 	/**
 	 * @var string the button type.
 	 * @see BootButton::type
 		foreach ($this->buttons as $button)
 		{
 			$this->controller->widget('bootstrap.widgets.BootButton', array(
-				'fn'=>isset($button['fn']) ? $button['fn'] : $this->fn,
+				'buttonType'=>isset($button['buttonType']) ? $button['buttonType'] : $this->buttonType,
 				'type'=>isset($button['type']) ? $button['type'] : $this->type,
 				'size'=>$this->size,
 				'icon'=>isset($button['icon']) ? $button['icon'] : null,

widgets/BootModal.php

 		if (!isset($this->htmlOptions['id']))
 			$this->htmlOptions['id'] = $this->getId();
 
-		if (isset($this->htmlOptions['class']))
-			$this->htmlOptions['class'] .= ' modal';
-		else
-			$this->htmlOptions['class'] = 'modal';
+		$class = array('modal');
 
 		if (Yii::app()->bootstrap->isPluginRegistered(Bootstrap::PLUGIN_TRANSITION))
-			$this->htmlOptions['class'] .= ' fade';
+			$class[] = 'fade';
+
+		$cssClass = implode(' ', $class);
+		if (isset($this->htmlOptions['class']))
+			$this->htmlOptions['class'] .= ' '.$cssClass;
+		else
+			$this->htmlOptions['class'] = $cssClass;
+
+
 
 		echo CHtml::openTag('div', $this->htmlOptions).PHP_EOL;
 	}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.