Commit f0d6adc5 by Crisu83

changed BootButton::fn to buttonType and updated the demo

parent 1a464dbc
......@@ -4,7 +4,7 @@
* @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
*/
/**
......@@ -99,7 +99,7 @@ class Bootstrap extends CApplicationComponent
/**
* Registers the Yii-specific CSS missing from Bootstrap.
* @since 1.0.0
* @since 0.9.11
*/
public function registerYiiCss()
{
......
......@@ -7,6 +7,7 @@
.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;}
......@@ -150,7 +151,7 @@ section{padding-top:40px;}section a.top{display:block;text-align:right;}
#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;}
......
......@@ -138,7 +138,9 @@ section {
margin-bottom: 0;
}
.hl-code {
.php-hl-main,
.html-hl-main,
.javascript-hl-main {
margin-bottom: 20px;
pre {
......
......@@ -45,7 +45,7 @@ class SiteController extends Controller
);
$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>'),
);
......@@ -93,6 +93,15 @@ class SiteController extends Controller
'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(),
......@@ -101,7 +110,9 @@ class SiteController extends Controller
'gridDataProvider'=>$gridDataProvider,
'gridColumns'=>$gridColumns,
'listDataProvider'=>$listDataProvider,
'parser'=>new CMarkdownParser(),
'phpLighter'=>$phpLighter,
'jsLighter'=>$jsLighter,
'htmlLighter'=>$htmlLighter,
));
}
......
......@@ -24,19 +24,14 @@ $this->addMetaProperty('fb:app_id', Yii::app()->fb->appID);
<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>
......@@ -52,12 +47,9 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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>
......@@ -112,9 +104,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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'=>'#',
......@@ -153,8 +143,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
),
),
),
)); ?>
~~~"); ?>
)); ?>"); ?>
<a class="top" href="#top">Back to top &uarr;</a>
......@@ -212,9 +201,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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(
......@@ -222,8 +209,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
array('label'=>'Profile', 'url'=>'#'),
array('label'=>'Messages', 'url'=>'#'),
),
)); ?>
~~~"); ?>
)); ?>"); ?>
<h3>Nav list</h3>
......@@ -247,9 +233,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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'),
......@@ -261,8 +245,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
array('label'=>'Settings', 'icon'=>'cog', 'url'=>'#'),
array('label'=>'Help', 'icon'=>'flag', 'url'=>'#'),
),
)); ?>
~~~"); ?>
)); ?>"); ?>
<a class="top" href="#top">Back to top &uarr;</a>
......@@ -284,9 +267,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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),
......@@ -300,8 +281,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
'shown'=>\"js:function() { console.log('Tabbable shown.'); }\",
),
),
)); ?>
~~~"); ?>
)); ?>"); ?>
<div class="alert alert-block alert-warning">
<strong>Note!</strong>
......@@ -351,9 +331,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
</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(
......@@ -361,8 +339,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
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>
......@@ -383,17 +360,14 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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>
......@@ -443,27 +417,23 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<?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'),
......@@ -474,8 +444,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
'htmlOptions'=>array('style'=>'width: 50px'),
),
),
)); ?>
~~~"); ?>
)); ?>"); ?>
<a class="top" href="#top">Back to top &uarr;</a>
......@@ -498,9 +467,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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',
......@@ -509,17 +476,13 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
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>
......@@ -543,9 +506,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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.
......@@ -555,8 +516,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
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>
......@@ -577,10 +537,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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>
......@@ -592,12 +549,11 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<?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.'); }",
),
)); ?>
......@@ -605,12 +561,14 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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(); ?>
......@@ -624,41 +582,42 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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>
......@@ -679,10 +638,25 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<?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 */
......@@ -693,10 +667,24 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
)); ?>
<?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 */
......@@ -708,10 +696,25 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<?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 */
......@@ -751,61 +754,15 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
</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',
......@@ -840,12 +797,11 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
</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>
......@@ -911,16 +867,11 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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>
......@@ -957,6 +908,17 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
)); ?>
</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">
......@@ -1025,9 +987,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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(
......@@ -1040,8 +1000,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
)),
),
)); ?>
</div>
~~~"); ?>
</div>"); ?>
<h3>Split dropdowns</h3>
......@@ -1116,9 +1075,7 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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(
......@@ -1132,14 +1089,13 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
)),
),
)); ?>
</div>
~~~"); ?>
</div>"); ?>
<h3>Stateful</h3>
<p>
<?php $this->widget('bootstrap.widgets.BootButton', array(
'fn'=>'button',
'buttonType'=>'button',
'type'=>'primary',
'label'=>'Click me',
'loadingText'=>'loading...',
......@@ -1159,33 +1115,27 @@ Yii::app()->user->setFlash('error', '<strong>Oh snap!</strong> Change a few thin
<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,
......@@ -1194,23 +1144,62 @@ $('#buttonStateful').click(function() {
<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,
)); ?>
~~~"); ?>
)); ?>"); ?>
<div class="row">
<div class="span3">
<h3>Checkbox</h3>
<?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>
<h3>Checkbox</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>
<p>@todo</p>
</div>
<h3>Radio</h3>
<h4>Source code</h4>
<p>@todo</p>
<?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>
......@@ -1229,21 +1218,14 @@ $('#buttonStateful').click(function() {
<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>
......@@ -1267,9 +1249,7 @@ $('#buttonStateful').click(function() {
<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.'),
......@@ -1279,8 +1259,7 @@ $('#buttonStateful').click(function() {
'slide'=>\"js:function() { console.log('Carousel slide.'); }\",
'slid'=>\"js:function() { console.log('Carousel slid.'); }\",
),
)); ?>
~~~"); ?>
)); ?>"); ?>
<a class="top" href="#top">Back to top &uarr;</a>
......@@ -1331,15 +1310,12 @@ $('#buttonStateful').click(function() {
<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>
......@@ -1365,9 +1341,7 @@ $('#buttonStateful').click(function() {
<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,
......@@ -1375,8 +1349,7 @@ $('#buttonStateful').click(function() {
return ~item.toLowerCase().indexOf(this.query.toLowerCase());
}\",
),
)); ?>
~~~"); ?>
)); ?>"); ?>
<a class="top" href="#top">Back to top &uarr;</a>
......@@ -1384,7 +1357,7 @@ $('#buttonStateful').click(function() {
<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')); ?>
......@@ -1397,13 +1370,10 @@ $('#buttonStateful').click(function() {
<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>
......@@ -1411,7 +1381,7 @@ $('#buttonStateful').click(function() {
<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')); ?>
......@@ -1424,13 +1394,10 @@ $('#buttonStateful').click(function() {
<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>
......
......@@ -15,15 +15,15 @@ Yii::import('bootstrap.widgets.BootWidget');
*/
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 = '';
......@@ -41,10 +41,10 @@ class BootButton extends BootWidget
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'.
......@@ -97,7 +97,7 @@ class BootButton extends BootWidget
public $ajaxOptions = array();
/**
* @var array the HTML options for the dropdown menu.
* @since 1.0.0
* @since 0.9.11
*/
public $dropdownOptions = array();
......@@ -181,11 +181,13 @@ class BootButton extends BootWidget
echo $this->createButton();
if ($this->hasDropdown())
{
$this->controller->widget('bootstrap.widgets.BootDropdown', array(
'encodeLabel'=>$this->encodeLabel,
'items'=>$this->items,
'htmlOptions'=>$this->dropdownOptions,
));
}
}
/**
......@@ -194,31 +196,31 @@ class BootButton extends BootWidget
*/
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';
......@@ -226,7 +228,7 @@ class BootButton extends BootWidget
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);
}
}
......
......@@ -21,10 +21,10 @@ class BootButtonGroup extends BootWidget
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
......@@ -78,7 +78,7 @@ class BootButtonGroup extends BootWidget
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,
......
......@@ -27,13 +27,18 @@ class BootModal extends BootWidget
if (!isset($this->htmlOptions['id']))
$this->htmlOptions['id'] = $this->getId();
$class = array('modal');
if (Yii::app()->bootstrap->isPluginRegistered(Bootstrap::PLUGIN_TRANSITION))
$class[] = 'fade';
$cssClass = implode(' ', $class);
if (isset($this->htmlOptions['class']))
$this->htmlOptions['class'] .= ' modal';
$this->htmlOptions['class'] .= ' '.$cssClass;
else
$this->htmlOptions['class'] = 'modal';
$this->htmlOptions['class'] = $cssClass;
if (Yii::app()->bootstrap->isPluginRegistered(Bootstrap::PLUGIN_TRANSITION))
$this->htmlOptions['class'] .= ' fade';
echo CHtml::openTag('div', $this->htmlOptions).PHP_EOL;
}
......
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