Commit 5b86e8fe by Crisu83

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

parent 9468580a
......@@ -116,7 +116,7 @@ class TbAlert extends CWidget
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);
......
......@@ -23,6 +23,8 @@ class TbButton extends CWidget
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';
......@@ -232,12 +234,19 @@ class TbButton extends CWidget
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);
......
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