Commits

Christoffer Niska committed 1644b25

Add support for inputs in TbButton and fix minor bug in TbAlert

Comments (0)

Files changed (2)

 				if ($this->closeText !== false && !isset($alert['closeText']))
 					$alert['closeText'] = $this->closeText;
 
-				if ($alert['closeText'] !== false)
+				if (isset($alert['closeText']) && $alert['closeText'] !== false)
 					echo '<a class="close" data-dismiss="alert">'.$alert['closeText'].'</a>';
 
 				echo Yii::app()->user->getFlash($type);
 	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';
 				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);