Commit 0e319dd8 by Crisu83

added support for hero content capturing (thanks Christophe Boulain) and updated the less compiler

parent 5e3fec4d
@import "../css/highlight.css"; .clearfix{*zoom:1;}.clearfix:before,.clearfix:after{display:table;content:"";}
.clearfix { .clearfix:after{clear:both;}
*zoom: 1;
}
.clearfix:before, .clearfix:after {
display: table;
content: "";
}
.clearfix:after {
clear: both;
}
body { .php-hl-default{color:Black;}
padding-top: 60px; .php-hl-code{color:Gray;}
padding-bottom: 60px; .php-hl-brackets{color:Olive;}
} .php-hl-comment{color:#808080;font-style:italic;}
h1, .php-hl-quotes{color:red;}
h2, .php-hl-string{color:Red;}
h3, .php-hl-identifier{color:green;}
h4, .php-hl-builtin{color:Teal;}
h5, .php-hl-reserved{color:black;font-weight:bold;}
h6 { .php-hl-inlinedoc{color:Blue;}
margin-bottom: 0.6em; .php-hl-var{color:blue;}
} .php-hl-url{color:Blue;}
p { .php-hl-special{color:Navy;}
font-size: 14px; .php-hl-number{color:Maroon;}
margin-bottom: 1.6em; .php-hl-inlinetags{color:Blue;}
} .php-hl-main{font-family:'Courier New',Courier,monospace;font-weight:normal;font-size:12px;}
.hero-unit h1 { ol.php-hl-main pre{margin:0;padding:0;}
margin-bottom: 0.4em; .php-hl-gutter{background-color:#999999;color:White;}
} .php-hl-table{font-family:courier;font-size:12px;border:solid 1px #505050;}
.hero-unit p { .xml-hl-default{color:Black;}
margin-bottom: 0; .xml-hl-code{color:Gray;}
text-align: justify; .xml-hl-brackets{color:Olive;}
} .xml-hl-comment{color:#808080;font-style:italic;}
.navbar .add-this { .xml-hl-quotes{color:red;}
margin: 6px 0 6px 10px; .xml-hl-string{color:Red;}
padding: 6px 0; .xml-hl-identifier{color:Blue;}
} .xml-hl-builtin{color:Teal;}
.subnav { .xml-hl-reserved{color:Green;}
border: 1px solid #E5E5E5; .xml-hl-inlinedoc{color:Blue;}
font-size: 12px; .xml-hl-var{color:#000020;}
-webkit-border-radius: 4px; .xml-hl-url{color:Blue;}
-moz-border-radius: 4px; .xml-hl-special{color:Navy;}
border-radius: 4px; .xml-hl-number{color:Maroon;}
width: 100%; .xml-hl-inlinetags{color:Blue;}
height: 36px; .xml-hl-main{font-family:'Courier New',Courier,monospace;font-weight:normal;}
background-color: #f2f2f2; .xml-hl-gutter{background-color:#999999;color:White;}
background-image: -moz-linear-gradient(top, #f5f5f5, #eeeeee); .xml-hl-table{font-family:courier;font-size:12px;border:solid 1px #505050;}
background-image: -ms-linear-gradient(top, #f5f5f5, #eeeeee); .html-hl-default{color:Black;}
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#eeeeee)); .html-hl-code{color:Gray;}
background-image: -webkit-linear-gradient(top, #f5f5f5, #eeeeee); .html-hl-brackets{color:Olive;}
background-image: -o-linear-gradient(top, #f5f5f5, #eeeeee); .html-hl-comment{color:#808080;font-style:italic;}
background-image: linear-gradient(top, #f5f5f5, #eeeeee); .html-hl-quotes{color:red;}
background-repeat: repeat-x; .html-hl-string{color:Red;}
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#eeeeee', GradientType=0); .html-hl-identifier{color:Blue;}
} .html-hl-builtin{color:Teal;}
.subnav.subnav-fixed { .html-hl-reserved{color:Green;}
border-color: #D5D5D5; .html-hl-inlinedoc{color:Blue;}
border-width: 1px 0 0; .html-hl-var{color:#000020;}
bottom: 0; .html-hl-url{color:Blue;}
left: 0; .html-hl-special{color:Navy;}
position: fixed; .html-hl-number{color:Maroon;}
right: 0; .html-hl-inlinetags{color:Blue;}
z-index: 1030; .html-hl-main{font-family:'Courier New',Courier,monospace;font-weight:normal;}
-webkit-border-radius: 0; .html-hl-gutter{background-color:#999999;color:White;}
-moz-border-radius: 0; .html-hl-table{font-family:courier;font-size:12px;border:solid 1px #505050;}
border-radius: 0; .css-hl-default{color:Black;}
-webkit-box-shadow: inset 0 1px 0 #ffffff; .css-hl-code{color:Gray;}
-moz-box-shadow: inset 0 1px 0 #ffffff; .css-hl-brackets{color:Olive;}
box-shadow: inset 0 1px 0 #ffffff; .css-hl-comment{color:#808080;font-style:italic;}
} .css-hl-quotes{color:red;}
.subnav .nav { .css-hl-string{color:Red;}
margin: 0 auto; .css-hl-identifier{color:Blue;}
max-width: 1170px; .css-hl-builtin{color:Teal;}
} .css-hl-reserved{color:Green;}
.subnav .nav > li > a { .css-hl-inlinedoc{color:Blue;}
margin: 0; .css-hl-var{color:#000020;}
padding: 11px; .css-hl-url{color:Blue;}
border-left: 1px solid whiteSmoke; .css-hl-special{color:Navy;}
border-right: 1px solid #E5E5E5; .css-hl-number{color:Maroon;}
-webkit-border-radius: 0; .css-hl-inlinetags{color:Blue;}
-moz-border-radius: 0; .css-hl-main{font-family:'Courier New',Courier,monospace;font-weight:normal;}
border-radius: 0; .css-hl-gutter{background-color:#999999;color:White;}
} .css-hl-table{font-family:courier;font-size:12px;border:solid 1px #505050;}
.subnav .nav > li:first-child > a { .javascript-hl-default{color:Black;}
border-left: 0; .javascript-hl-code{color:Gray;}
} .javascript-hl-brackets{color:Olive;}
.subnav .nav > li:last-child > a { .javascript-hl-comment{color:#808080;font-style:italic;}
border-right: 0; .javascript-hl-quotes{color:red;}
} .javascript-hl-string{color:Red;}
.subnav .nav > .active > a, .subnav .nav .action > a:hover { .javascript-hl-identifier{color:Blue;}
background-color: #E9E9E9; .javascript-hl-builtin{color:Teal;}
border-right-color: #DDD; .javascript-hl-reserved{color:Green;}
color: #777; .javascript-hl-inlinedoc{color:Blue;}
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.05); .javascript-hl-var{color:#000020;}
-moz-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.05); .javascript-hl-url{color:Blue;}
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.05); .javascript-hl-special{color:Navy;}
} .javascript-hl-number{color:Maroon;}
footer .powered { .javascript-hl-inlinetags{color:Blue;}
color: #888; .javascript-hl-main{font-family:'Courier New',Courier,monospace;font-weight:normal;}
margin-bottom: 20px; .javascript-hl-gutter{background-color:#999999;color:White;}
} .javascript-hl-table{font-family:courier;font-size:12px;border:solid 1px #505050;}
footer .copy { .sql-hl-default{color:Black;}
color: #666; .sql-hl-code{color:Gray;}
} .sql-hl-brackets{color:Olive;}
span.required { .sql-hl-comment{color:#808080;font-style:italic;}
color: #F00; .sql-hl-quotes{color:red;}
} .sql-hl-string{color:Red;}
.popover h3.popover-title { .sql-hl-identifier{color:Blue;}
margin-bottom: 0; .sql-hl-builtin{color:Teal;}
} .sql-hl-reserved{color:Green;}
section { .sql-hl-inlinedoc{color:Blue;}
padding-top: 40px; .sql-hl-var{color:#000020;}
} .sql-hl-url{color:Blue;}
section a.top { .sql-hl-special{color:Navy;}
display: block; .sql-hl-number{color:Maroon;}
text-align: right; .sql-hl-inlinetags{color:Blue;}
} .sql-hl-main{font-family:'Courier New',Courier,monospace;font-weight:normal;}
#bootNavbar .navbar-inner > .container { .sql-hl-gutter{background-color:#999999;color:White;}
width: auto; .sql-hl-table{font-family:courier;font-size:12px;border:solid 1px #505050;}
} .source .copycode{text-align:right;float:right;}
#bootMenu .menuCol { .source .copycode a{cursor:pointer;color:blue;}
min-height: 140px; .source .copycode_hover a{color:red;}
} body{padding-top:60px;padding-bottom:60px;}
#bootTabbable .tabbable { h1,h2,h3,h4,h5,h6{margin-bottom:0.6em;}
margin-bottom: 20px; p{font-size:14px;margin-bottom:1.6em;}
} .hero-unit h1{margin-bottom:0.4em;}
#bootTabbable .tabbable.tabbable-placed { .hero-unit p{margin-bottom:0;text-align:justify;}
width: 340px;
} .navbar .add-this{margin:6px 0 6px 10px;padding:6px 0;}
#bootThumbnails .list-view {
padding-top: 30px; .subnav{border:1px solid #E5E5E5;font-size:12px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;width:100%;height:36px;background-color:#f2f2f2;background-image:-moz-linear-gradient(top, #f5f5f5, #eeeeee);background-image:-ms-linear-gradient(top, #f5f5f5, #eeeeee);background-image:-webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#eeeeee));background-image:-webkit-linear-gradient(top, #f5f5f5, #eeeeee);background-image:-o-linear-gradient(top, #f5f5f5, #eeeeee);background-image:linear-gradient(top, #f5f5f5, #eeeeee);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f5f5f5', endColorstr='#eeeeee', GradientType=0);}.subnav.subnav-fixed{border-color:#D5D5D5;border-width:1px 0 0;bottom:0;left:0;position:fixed;right:0;z-index:1030;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:inset 0 1px 0 #ffffff;-moz-box-shadow:inset 0 1px 0 #ffffff;box-shadow:inset 0 1px 0 #ffffff;}
} .subnav .nav{margin:0 auto;max-width:1170px;}.subnav .nav >li>a{margin:0;padding:11px;border-left:1px solid whiteSmoke;border-right:1px solid #E5E5E5;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;}
#bootActiveForm .form-vertical .control-group > label { .subnav .nav >li:first-child>a{border-left:0;}
font-weight: bold; .subnav .nav >li:last-child>a{border-right:0;}
} .subnav .nav >.active>a,.subnav .nav .action>a:hover{background-color:#E9E9E9;border-right-color:#DDD;color:#777;-webkit-box-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.05);-moz-box-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.05);box-shadow:inset 0 3px 5px rgba(0, 0, 0, 0.05);}
#bootHero .hero-unit {
width: 650px;
} footer .powered{color:#888;margin-bottom:20px;}
#bootHero .hero-unit h1 { footer .copy{color:#666;}
margin-bottom: 0;
} span.required{color:#F00;}
#bootHero .hero-unit p { .popover h3.popover-title{margin-bottom:0;}
margin-bottom: 9px; section{padding-top:40px;}section a.top{display:block;text-align:right;}
}
#bootHero .hero-unit p:last-child { #bootNavbar .navbar-inner>.container{width:auto;}
margin-bottom: 0; #bootMenu .menuCol{min-height:140px;}
} #bootTabbable .tabbable{margin-bottom:20px;}#bootTabbable .tabbable.tabbable-placed{width:340px;}
#bootCarousel .carousel {
width: 770px; #bootThumbnails .list-view{padding-top:30px;}
} #bootActiveForm .form-vertical .control-group>label{font-weight:bold;}
#bootCarousel .carousel .carousel-caption p { #bootHero .hero-unit{width:650px;}#bootHero .hero-unit h1{margin-bottom:0;}
margin-bottom: 9px; #bootHero .hero-unit p{margin-bottom:9px;}#bootHero .hero-unit p:last-child{margin-bottom:0;}
}
#bootTypeahead input {
margin-bottom: 0; #bootCarousel .carousel{width:770px;}#bootCarousel .carousel .carousel-caption p{margin-bottom:9px;}
}
.hl-code { #bootTypeahead input{margin-bottom:0;}
margin-bottom: 20px; .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;}
}
.hl-code pre { .maintenance .hero-unit{text-align:center;}.maintenance .hero-unit p{text-align:inherit;}
background: #FCFCFC;
border-color: #EEE transparent #EEE; @media (max-width: 980px){body{padding-top:0px;}}
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;
}
@media (max-width: 980px) {
body {
padding-top: 0px;
}
}
// IMPORTS // IMPORTS
@import "../../lib/bootstrap/less/mixins.less"; @import "../../lib/bootstrap/less/mixins.less";
@import "../css/highlight.css"; @import "highlight.less";
// VARIABLES // VARIABLES
......
...@@ -6,8 +6,12 @@ ...@@ -6,8 +6,12 @@
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License * @license http://www.opensource.org/licenses/bsd-license.php New BSD License
*/ */
Yii::setPathOfAlias('Less', realpath(dirname(__FILE__).'/../lib/lessphp/lib/Less')); Yii::setPathOfAlias('Less', dirname(__FILE__).'/../lib/lessphp/lib/Less');
/**
* Less compiler application component.
* Preload the component to enable auto compiling.
*/
class LessCompiler extends CApplicationComponent class LessCompiler extends CApplicationComponent
{ {
/** /**
...@@ -19,9 +23,9 @@ class LessCompiler extends CApplicationComponent ...@@ -19,9 +23,9 @@ class LessCompiler extends CApplicationComponent
*/ */
public $paths = array(); public $paths = array();
/** /**
* @var boolean whether to auto compile * @var boolean indicates whether to force compiling.
*/ */
public $autoCompile = false; public $forceCompile = false;
/** /**
* @var boolean compiler debug mode. * @var boolean compiler debug mode.
*/ */
...@@ -30,29 +34,26 @@ class LessCompiler extends CApplicationComponent ...@@ -30,29 +34,26 @@ class LessCompiler extends CApplicationComponent
* @var boolean whether to compress css or not. * @var boolean whether to compress css or not.
*/ */
public $compress = false; public $compress = false;
/**
* @var \Less\Parser the less parser.
*/
protected $_parser; protected $_parser;
/** /**
* Initializes the component. * Initializes the component.
* @throws CException if the base path does not exist
*/ */
public function init() public function init()
{ {
if (!isset($this->basePath)) if ($this->basePath === null)
$this->basePath = Yii::getPathOfAlias('webroot'); $this->basePath = Yii::getPathOfAlias('webroot');
if (!file_exists($this->basePath)) if (!file_exists($this->basePath))
throw new CException(__CLASS__.': Failed to initialize compiler. Base path does not exist!'); throw new CException(__CLASS__.': Failed to initialize compiler. Base path does not exist.');
$env = new \Less\Environment(); $env = new \Less\Environment();
$env->compress = $this->compress; $env->setDebug($this->debug);
$env->debug = $this->debug; $env->setCompress($this->compress);
$this->_parser = new \Less\Parser($env); $this->_parser = new \Less\Parser($env);
if ($this->autoCompile/* && $this->hasChanges()*/) if ($this->forceCompile || $this->hasChanges())
$this->compile(); $this->compile();
} }
...@@ -70,17 +71,16 @@ class LessCompiler extends CApplicationComponent ...@@ -70,17 +71,16 @@ class LessCompiler extends CApplicationComponent
if (file_exists($fromPath)) if (file_exists($fromPath))
file_put_contents($toPath, $this->parse($fromPath)); file_put_contents($toPath, $this->parse($fromPath));
else else
throw new CException(__CLASS__.': Failed to compile less file. Source path does not exist!'); throw new CException(__CLASS__.': Failed to compile less file. Source path does not exist.');
$this->_parser->clearCss(); $this->_parser->clearCss();
} }
} }
/** /**
* Parses the less code to css. * Parses the less code to CSS.
* @param string $filename the file path to the less file * @param string $filename the file path to the less file
* @return string the css * @return string the CSS
* @throws CException
*/ */
public function parse($filename) public function parse($filename)
{ {
...@@ -90,7 +90,7 @@ class LessCompiler extends CApplicationComponent ...@@ -90,7 +90,7 @@ class LessCompiler extends CApplicationComponent
} }
catch (\Less\Exception\ParserException $e) catch (\Less\Exception\ParserException $e)
{ {
throw new CException(__CLASS__.': Failed to compile less file with message: "'.$e->getMessage().'".'); throw new CException(__CLASS__.': Failed to parse less file. "'.$e->getMessage().'".');
} }
return $css; return $css;
...@@ -100,16 +100,18 @@ class LessCompiler extends CApplicationComponent ...@@ -100,16 +100,18 @@ class LessCompiler extends CApplicationComponent
* Returns whether any of files configured to be compiled has changed. * Returns whether any of files configured to be compiled has changed.
* @return boolean the result * @return boolean the result
*/ */
public function hasChanges() protected function hasChanges()
{ {
$dirs = array(); $dirs = array();
foreach ($this->paths as $source => $destination) foreach ($this->paths as $source => $destination)
{ {
$destination = realpath($destination);
$compiled = $this->getLastModified($destination); $compiled = $this->getLastModified($destination);
if (!isset($lastCompiled) || $compiled < $lastCompiled ) if (!isset($lastCompiled) || $compiled < $lastCompiled )
$lastCompiled = $compiled; $lastCompiled = $compiled;
if (!in_array(dirname($source), $dirs)) $source = realpath($source);
if (!in_array($source, $dirs))
$dirs[] = $source; $dirs[] = $source;
} }
...@@ -142,20 +144,19 @@ class LessCompiler extends CApplicationComponent ...@@ -142,20 +144,19 @@ class LessCompiler extends CApplicationComponent
{ {
$lastModified = null; $lastModified = null;
/** @var Directory $dir */
$dir = dir($path); $dir = dir($path);
while ($entry = $dir->read()) while ($entry = $dir->read())
{ {
if (strpos($entry, '.') === 0) if (strpos($entry, '.') === 0)
continue; continue;
$path .= '/'.$entry; $entry = $path.'/'.$entry;
if( is_dir($path) ) if( is_dir($entry) )
$modified = $this->getLastModified($path); $modified = $this->getLastModified($entry);
else else
{ {
$stat = stat($path); $stat = stat($entry);
$modified = $stat['mtime']; $modified = $stat['mtime'];
} }
......
...@@ -305,7 +305,7 @@ class Parser { ...@@ -305,7 +305,7 @@ class Parser {
if ($this->peek('/', 1)) { if ($this->peek('/', 1)) {
return new \Less\Node\Comment($this->match('/^\/\/.*/'), true); return new \Less\Node\Comment($this->match('/^\/\/.*/'), true);
} else { } else {
if ($comment = $this->match('/^\\/\*(?:[^*]|\*+[^\\/*])*\*+\\/\n?/')) { if ($comment = $this->match('/\/\*.*?\*\//s')) {
return new \Less\Node\Comment($comment, false); return new \Less\Node\Comment($comment, false);
} }
} }
......
...@@ -86,19 +86,18 @@ ...@@ -86,19 +86,18 @@
<div class="container"> <div class="container">
<?php $this->widget('bootstrap.widgets.BootHero', array( <?php $this->beginWidget('bootstrap.widgets.BootHero', array(
'heading'=>Yii::app()->name, 'heading'=>Yii::app()->name,
'content'=>"
<p>
Bringing together the ".CHtml::link('Yii PHP framework', 'http://www.yiiframework.com')." and
".CHtml::link('Bootstrap', 'http://twitter.github.com/bootstrap/').", Twitter's new web development toolkit.
Now with support for Bootstrap 2!
".CHtml::link('Yii-Bootstrap', 'http://www.yiiframework.com/extension/bootstrap/')."
is an extension for Yii that provides a wide range of server-side widgets that allow you to easily use Bootstrap with Yii.
All widgets have been developed following Yii's conventions and work seemlessly together with Bootstrap and its jQuery plugins.
</p>
",
)); ?> )); ?>
<p>
Bringing together the <?php echo CHtml::link('Yii PHP framework', 'http://www.yiiframework.com'); ?> and
<?php echo CHtml::link('Bootstrap', 'http://twitter.github.com/bootstrap/'); ?> Twitter's new web development toolkit.
Now with support for Bootstrap 2!
<?php echo CHtml::link('Yii-Bootstrap', 'http://www.yiiframework.com/extension/bootstrap/'); ?>
is an extension for Yii that provides a wide range of server-side widgets that allow you to easily use Bootstrap with Yii.
All widgets have been developed following Yii's conventions and work seamlessly together with Bootstrap and its jQuery plugins.
</p>
<?php $this->endWidget(); ?>
<?php if (!empty($this->breadcrumbs)):?> <?php if (!empty($this->breadcrumbs)):?>
<?php $this->widget('bootstrap.widgets.BootBreadcrumbs', array( <?php $this->widget('bootstrap.widgets.BootBreadcrumbs', array(
......
...@@ -1190,13 +1190,12 @@ $('#buttonStateful').click(function() { ...@@ -1190,13 +1190,12 @@ $('#buttonStateful').click(function() {
<h2>Hero unit <small>Coming in version 0.9.10</small></h2> <h2>Hero unit <small>Coming in version 0.9.10</small></h2>
<?php $this->widget('bootstrap.widgets.BootHero', array( <?php $this->beginWidget('bootstrap.widgets.BootHero', array(
'heading'=>'Hello, world!', 'heading'=>'Hello, world!',
'content'=>"
<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>
",
)); ?> )); ?>
<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 $this->endWidget(); ?>
<h4>Source code</h4> <h4>Source code</h4>
...@@ -1204,11 +1203,16 @@ $('#buttonStateful').click(function() { ...@@ -1204,11 +1203,16 @@ $('#buttonStateful').click(function() {
[php] [php]
<?php \$this->widget('bootstrap.widgets.BootHero', array( <?php \$this->widget('bootstrap.widgets.BootHero', array(
'heading'=>'Hello, world!', 'heading'=>'Hello, world!',
'content'=>\"
<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>
\",
)); ?> )); ?>
~~~
~~~
[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(); ?>
~~~"); ?> ~~~"); ?>
<a class="top" href="#top">Back to top &uarr;</a> <a class="top" href="#top">Back to top &uarr;</a>
......
...@@ -12,6 +12,7 @@ Yii::import('bootstrap.widgets.BootWidget'); ...@@ -12,6 +12,7 @@ Yii::import('bootstrap.widgets.BootWidget');
/** /**
* Modest bootstrap hero widget. * Modest bootstrap hero widget.
* Thanks to Christphe Boulain for suggesting content capturing.
*/ */
class BootHero extends BootWidget class BootHero extends BootWidget
{ {
...@@ -20,10 +21,6 @@ class BootHero extends BootWidget ...@@ -20,10 +21,6 @@ class BootHero extends BootWidget
*/ */
public $heading; public $heading;
/** /**
* @var string the content text.
*/
public $content;
/**
* @var boolean indicates whether to encode the heading. * @var boolean indicates whether to encode the heading.
*/ */
public $encodeHeading = true; public $encodeHeading = true;
...@@ -41,6 +38,9 @@ class BootHero extends BootWidget ...@@ -41,6 +38,9 @@ class BootHero extends BootWidget
if ($this->encodeHeading) if ($this->encodeHeading)
$this->heading = CHtml::encode($this->heading); $this->heading = CHtml::encode($this->heading);
ob_start();
ob_implicit_flush(false);
} }
/** /**
...@@ -48,9 +48,13 @@ class BootHero extends BootWidget ...@@ -48,9 +48,13 @@ class BootHero extends BootWidget
*/ */
public function run() public function run()
{ {
$content = ob_get_clean();
echo CHtml::openTag('div', $this->htmlOptions); echo CHtml::openTag('div', $this->htmlOptions);
echo CHtml::tag('h1', array(), $this->heading);
echo $this->content; if (isset($this->heading))
echo CHtml::tag('h1', array(), $this->heading);
echo $content;
echo '</div>'; echo '</div>';
} }
} }
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