Commits

Christoffer Niska committed dec1b7f Merge

Merged heads.

  • Participants
  • Parent commits 314fd8b, ae6dbcb

Comments (0)

Files changed (3)

File assets/js/jquery.ui.bootalert.js

 			template: '<div class="alert-message {key}"><p>{message}</p></div>',
 			displayTime: 5000,
 			closeTime: 350,
-			closeText: '×'
+			closeText: '&times;'
 		},
 		/**
 		 * Creates the widget.

File widgets/BootActiveForm.php

 	public function inputRow($type, $model, $attribute, $data = null, $htmlOptions = array())
 	{
 		ob_start();
-		Yii::app()->controller->widget('ext.bootstrap.widgets.BootInput',array(
+		Yii::app()->controller->widget('bootstrap.widgets.BootInput',array(
 			'type'=>$type,
 			'form'=>$this,
 			'model'=>$model,

File widgets/BootNav.php

 class BootNav extends BootWidget
 {
 	/**
+	 * @var string the topbar type. Defaults to 'normal'. Valid values are 'normal' and 'fluid'.
+	 */
+	public $type = 'normal';
+	/**
+	 * @var string the text for the brand.
+	 */
+	public $brand;
+	/**
 	 * @var string the URL for the brand link.
 	 */
 	public $brandUrl;
 	/**
-	 * @var string the text for the brand link.
-	 */
-	public $brandText;
-	/**
 	 * @var array the HTML attributes for the brand link.
 	 */
 	public $brandOptions = array();
 	/**
+	 * @var string the item template.
+	 */
+	public $itemTemplate = '{menu}';
+	/**
 	 * @var array the primary menu items.
 	 */
 	public $primaryItems = array();
 	/**
 	 * @var array the secondary menu items.
 	 */
-	public $secondaryItems = array();
+	public $secondaryItems = array(); 
 	/**
 	 * @var array the HTML attributes for the primary menu.
 	 */
 	public $secondaryOptions = array();
 
 	/**
+	 * Initializes the widget.
+	 */
+	public function init()
+	{
+		if (!in_array($this->type, array('normal', 'fluid')))
+			throw new CException(__CLASS__.'.type is invalid. Valid values are "normal" and "fluid".');
+
+		if (!isset($this->brand))
+			$this->brand = CHtml::encode(Yii::app()->name);
+
+		if (!isset($this->brandUrl))
+			$this->brandUrl = Yii::app()->homeUrl;
+	}
+
+	/**
 	 * Runs the widget.
 	 */
 	public function run()
 			$this->primaryOptions['class'] = 'nav';
 
 		if (isset($this->secondaryOptions['class']))
-			$this->secondaryOptions['class'] .= ' secondary-nav';
+			$this->secondaryOptions['class'] .= ' nav secondary-nav';
 		else
-			$this->secondaryOptions['class'] = 'secondary-nav';
+			$this->secondaryOptions['class'] = 'nav secondary-nav';
+
+		$cssClass = $this->type === 'normal' ? 'container' : 'container-fluid';
 
 		echo CHtml::openTag('div', $this->htmlOptions);
-		echo '<div class="topbar-inner"><div class="container">';
-		echo CHtml::openTag('a', $this->brandOptions);
-		echo $this->brandText;
-		echo '</a>';
+		echo '<div class="topbar-inner"><div class="'.$cssClass.'">';
+		echo CHtml::openTag('a', $this->brandOptions).$this->brand.'</a>';
 
 		if (!empty($this->primaryItems))
 		{
 			$this->controller->widget('bootstrap.widgets.BootMenu', array(
 				'type'=>'',
 				'items'=>$this->primaryItems,
+				'itemTemplate'=>$this->itemTemplate,
+				'encodeLabel'=>false,
 				'htmlOptions'=>$this->primaryOptions,
 			));
 		}
 			$this->controller->widget('bootstrap.widgets.BootMenu', array(
 				'type'=>'',
 				'items'=>$this->secondaryItems,
+				'itemTemplate'=>$this->itemTemplate,
+				'encodeLabel'=>false,
 				'htmlOptions'=>$this->secondaryOptions,
 			));
 		}