Commits

Christoffer Niska committed 02e96fe Merge

Merge with default

Comments (0)

Files changed (17)

components/Bootstrap.php

 	 * @since 0.9.8
 	 */
 	public $plugins = array();
+	/**
+	 * @var boolean indicates whether assets should be republished on every request.
+	 */
+	public $publishAssets = YII_DEBUG;
 
 	protected $_assetsUrl;
 
 		else
 		{
 			$assetsPath = Yii::getPathOfAlias('bootstrap.assets');
-			$assetsUrl = Yii::app()->assetManager->publish($assetsPath, true, -1, YII_DEBUG);
+			$assetsUrl = Yii::app()->assetManager->publish($assetsPath, true, -1, $this->publishAssets);
 			return $this->_assetsUrl = $assetsUrl;
 		}
 	}
   padding:6px 0;
 }
 .subnav.navbar-fixed-top { top:40px; }
+.donate h3 { margin-top:0; }
 footer .powered {
   color:#888888;
   margin-bottom:20px;

demo/less/styles.less

 	top: 40px;
 }
 
+.donate h3 {
+    margin-top: 0;
+}
+
 footer {
 	.powered {
 		color: #888;

demo/protected/views/layouts/main.php

 <?php $this->widget('bootstrap.widgets.TbNavbar',array(
 	'type'=>'inverse',
 	'brand'=>CHtml::encode(Yii::app()->name),
+	'brandUrl'=>false,
 	'collapse'=>true,
 	'items'=>array(
 		array(

demo/protected/views/site/index.php

 	<h5>Source code</h5>
 
 <?php echo $phpLighter->highlight("<?php \$this->widget('bootstrap.widgets.TbTypeahead', array(
+	'name'=>'typeahead',
 	'options'=>array(
-	    'name'=>'typeahead',
 		'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,
 		'matcher'=>\"js:function(item) {

demo/protected/views/site/setup.php

 
 	<h2>Setup</h2>
 
-	<p>Download the latest release.</p>
+	<p>Download the latest release from Yii extensions by following the link below:</p>
 
 	<p>
-		<?php echo CHtml::link('<i class="icon-share icon-white"></i> Get Yii-Bootstrap from Yii extensions',
-				'http://www.yiiframework.com/extension/bootstrap/', array('class'=>'btn btn-primary btn-large', 'target'=>'_blank')); ?>
+		<?php $this->widget('bootstrap.widgets.TbButton', array(
+			'type'=>'primary',
+			'size'=>'large',
+			'icon'=>'download-alt white',
+			'label'=>'Download Yii-Bootstrap',
+			'url'=>'http://www.yiiframework.com/extension/bootstrap/',
+			'htmlOptions'=>array('target'=>'_blank'),
+		)); ?>
 	</p>
 
-	<p>Unzip the extension under <strong>protected/extensions/bootstrap</strong> and add the following code to your application configuration:</p>
+	<p>Unzip the extension under <strong>protected/extensions/bootstrap</strong> and modify your application configuration accordingly:</p>
+
+	<p>If you wish to use the provided Bootstrap theme copy the <strong>theme</strong> directory to your themes directory.</p>
 
 <?php echo $parser->safeTransform("~~~
 [php]
-'preload'=>array(
-    .....
-    'bootstrap', // preload the bootstrap component
-),
-'modules'=>array(
-    .....
-    'gii'=>array(
-        .....
-        'generatorPaths'=>array(
-            'bootstrap.gii',
-        ),
-    ),
-),
-'components'=>array(
-    .....
-    'bootstrap'=>array(
-        'class'=>'ext.bootstrap.components.Bootstrap', // assuming you extracted bootstrap under extensions
-    ),
-),
+// Define a path alias for the Bootstrap extension as it's used internally.
+// In this example we assume that you unzipped the extension under protected/extensions.
+Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
+
+return array(
+	'theme'=>'bootstrap', // requires you to copy the theme under your themes directory
+	'modules'=>array(
+		'gii'=>array(
+			'generatorPaths'=>array(
+				'bootstrap.gii',
+			),
+		),
+	),
+	'components'=>array(
+		'bootstrap'=>array(
+			'class'=>'bootstrap.components.Bootstrap',
+		),
+	),
+);
 ~~~"); ?>
 
 	<p>
 		You're done! Now you can start using Bootstrap in your application. For examples on how to use the widgets please visit the
-		<?php echo CHtml::link('demo page', array('site/index')); ?>.
+		<?php echo CHtml::link('docs', array('site/index')); ?>.
 	</p>
 
 </section>

gii/bootstrap/BootstrapCode.php

 
 Yii::import('gii.generators.crud.CrudCode');
 
-class BootstrapCode extendS CrudCode
+class BootstrapCode extends CrudCode
 {
 	public function generateActiveRow($modelClass, $column)
 	{

gii/bootstrap/templates/default/_search.php

 <?php endforeach; ?>
 	<div class="form-actions">
 		<?php echo "<?php \$this->widget('bootstrap.widgets.TbButton', array(
-		    'buttonType'=>'submit'
+			'buttonType'=>'submit',
 			'type'=>'primary',
 			'label'=>'Search',
 		)); ?>\n"; ?>
 	</div>
 
-<?php echo "<?php \$this->endWidget(); ?>\n"; ?>
+<?php echo "<?php \$this->endWidget(); ?>\n"; ?>
 	 */
 	public function init()
 	{
-		echo CHtml::tag($this->tagName, $this->htmlOptions);
+		echo CHtml::openTag($this->tagName, $this->htmlOptions);
 	}
 
 	/**
 
 				if ($this->closeText !== false && !isset($alert['closeText']))
 					$alert['closeText'] = $this->closeText;
+				else
+					$alert['closeText'] = false;
 
 				if ($alert['closeText'] !== false)
 					echo '<a class="close" data-dismiss="alert">'.$alert['closeText'].'</a>';
 	const BUTTON_AJAXLINK = 'ajaxLink';
 	const BUTTON_AJAXBUTTON = 'ajaxButton';
 	const BUTTON_AJAXSUBMIT = 'ajaxSubmit';
+	const BUTTON_INPUTBUTTON = 'inputButton';
+	const BUTTON_INPUTSUBMIT = 'inputSubmit';
 
 	// Button types.
 	const TYPE_PRIMARY = 'primary';
 			$classes[] = 'active';
 
 		if ($this->disabled)
+		{
+			$disableTypes = array(self::BUTTON_BUTTON, self::BUTTON_SUBMIT, self::BUTTON_RESET,
+				self::BUTTON_AJAXBUTTON, self::BUTTON_AJAXSUBMIT, self::BUTTON_INPUTBUTTON, self::BUTTON_INPUTSUBMIT);
+
+			if (in_array($this->buttonType, $disableTypes))
+				$this->htmlOptions['disabled'] = 'disabled';
+
 			$classes[] = 'disabled';
+		}
 
         if (!isset($this->url) && isset($this->htmlOptions['href']))
         {
 				return CHtml::htmlButton($this->label, $this->htmlOptions);
 
 			case self::BUTTON_AJAXSUBMIT:
-				$this->ajaxOptions['type'] = 'POST';
+				$this->ajaxOptions['type'] = isset($this->ajaxOptions['type']) ? $this->ajaxOptions['type'] : 'POST';
 				$this->ajaxOptions['url'] = $this->url;
 				$this->htmlOptions['type'] = 'submit';
 				$this->htmlOptions['ajax'] = $this->ajaxOptions;
 				return CHtml::htmlButton($this->label, $this->htmlOptions);
 
+			case self::BUTTON_INPUTBUTTON:
+				return CHtml::button($this->label, $this->htmlOptions);
+
+			case self::BUTTON_INPUTSUBMIT:
+				$this->htmlOptions['type'] = 'submit';
+				return CHtml::button($this->label, $this->htmlOptions);
+
 			default:
 			case self::BUTTON_LINK:
 				return CHtml::link($this->label, $this->url, $this->htmlOptions);

widgets/TbCarousel.php

 		echo CHtml::openTag('div', $this->htmlOptions);
 		echo '<div class="carousel-inner">';
 		$this->renderItems($this->items);
+		echo '</div>';
 
 		if ($this->displayPrevAndNext)
 		{
-			echo '</div>';
 			echo '<a class="carousel-control left" href="#'.$id.'" data-slide="prev">'.$this->prevLabel.'</a>';
 			echo '<a class="carousel-control right" href="#'.$id.'" data-slide="next">'.$this->nextLabel.'</a>';
-			echo '</div>';
 		}
 
+		echo '</div>';
+
 		/** @var CClientScript $cs */
 		$cs = Yii::app()->getClientScript();
 		$options = !empty($this->options) ? CJavaScript::encode($this->options) : '';

widgets/TbCollapse.php

 		if (isset($this->toggle) && !isset($this->options['toggle']))
 			$this->options['toggle'] = $this->toggle;
 
-		echo CHtml::tag($this->tagName, $this->htmlOptions);
+		echo CHtml::openTag($this->tagName, $this->htmlOptions);
 	}
 
 	/**

widgets/TbGridView.php

 	const TYPE_STRIPED = 'striped';
 	const TYPE_BORDERED = 'bordered';
 	const TYPE_CONDENSED = 'condensed';
+	const TYPE_HOVER = 'hover';
 
 	/**
 	 * @var string|array the table type.
 
 			if (!empty($this->type))
 			{
-				$validTypes = array(self::TYPE_STRIPED, self::TYPE_BORDERED, self::TYPE_CONDENSED);
+				$validTypes = array(self::TYPE_STRIPED, self::TYPE_BORDERED, self::TYPE_CONDENSED, self::TYPE_HOVER);
 
 				foreach ($this->type as $type)
 				{
 		if ($this->autoOpen === false && !isset($this->options['show']))
 			$this->options['show'] = false;
 
-		$classes = array('modal');
+		$classes = array('modal hide');
 
 		if ($this->fade === true)
 			$classes[] = 'fade';
 		}
 
 		if ($this->brand !== false)
-			echo CHtml::openTag('a', $this->brandOptions).$this->brand.'</a>';
+		{
+			if ($this->brandUrl !== false)
+				echo CHtml::openTag('a', $this->brandOptions).$this->brand.'</a>';
+			else
+			{
+				unset($this->brandOptions['href']); // spans cannot have a href attribute
+				echo CHtml::openTag('span', $this->brandOptions).$this->brand.'</span>';
+			}
+		}
 
 		if ($this->collapse !== false)
 		{
 Yii::import('bootstrap.widgets.TbMenu');
 
 /**
- * Bootstrap Javascript tabs widget.
+ * Bootstrap JavaScript tabs widget.
  * @see http://twitter.github.com/bootstrap/javascript.html#tabs
  */
 class TbTabs extends CWidget