Commit 2a0a234a by niskac

Minor bug fixes.

Fixed an issue with hiding alerts created with JS. Fixed a few minor issues in the BootActiveForm. Fixed an issue with the homeLink in BootCrumb. Fixed the password type in both BootActiveForm and BootInputBlock.
parent 04247b75
......@@ -37,16 +37,8 @@
alerts = self.element.find( '.alert-message' );
for ( var i = 0, l = alerts.length; i < l; ++i ) {
var alert = $( alerts[ i ] ),
closeLink = self._createCloseLink( alert );
closeLink.prependTo( alert );
if ( self.options.closeTime > 0 ) {
setTimeout( function() {
self.close( alert );
}, self.options.displayTime );
}
var alert = $( alerts[ i ] );
self._initAlert( alert );
}
},
/**
......@@ -56,25 +48,42 @@
*/
alert: function( key, message ) {
if ( this.options.keys.indexOf( key ) !== -1 ) {
var template = this.options.template;
var self = this,
template = this.options.template;
template = template.replace( '{key}', key );
template = template.replace( '{message}', message );
var alert = $( template )
.appendTo( this.element );
var closeLink = this._createCloseLink( alert );
closeLink.prependTo( alert );
var alert = $( template );
self._initAlert( alert );
alert.appendTo( self.element );
}
return this;
},
/**
* Initializes the alert by appending the close link
* and by setting a time out for the close callback.
* @param {Object} alert The alert element.
*/
_initAlert: function( alert ) {
var self = this,
closeLink = self._createCloseLink( alert );
closeLink.prependTo( alert );
if ( self.options.closeTime > 0 ) {
setTimeout( function() {
self.close( alert );
}, self.options.displayTime );
}
},
/**
* Closes a specific alert message.
* @param {Object} alert The alert element.
*/
close: function( alert ) {
if (alert) {
if ( alert ) {
alert.fadeOut( this.options.closeTime, function() {
$( this ).html( '' );
});
......
......@@ -141,7 +141,7 @@ class BootActiveForm extends CActiveForm
*/
public function passwordFieldBlock($model, $attribute, $htmlOptions = array())
{
return $this->inputBlock('passwordfield', $model, $attribute, null, $htmlOptions);
return $this->inputBlock('password', $model, $attribute, null, $htmlOptions);
}
/**
......@@ -258,7 +258,7 @@ class BootActiveForm extends CActiveForm
public function errorSummary($models, $header = null, $footer = null, $htmlOptions = array())
{
if (!isset($htmlOptions['class']))
$htmlOptions['class'] = 'alert-message error'; // Bootstrap error class as default
$htmlOptions['class'] = 'alert-message block-message error'; // Bootstrap error class as default
return parent::errorSummary($models, $header, $footer, $htmlOptions);
}
......
......@@ -25,18 +25,16 @@ class BootCrumb extends CBreadcrumbs
{
$links = array();
if ($this->homeLink === null)
if ($this->homeLink === null || !(isset($this->homeLink['label']) && isset($this->homeLink['url'])))
$this->homeLink = array('label'=>Yii::t('bootstrap', 'Home'),'url'=>Yii::app()->homeUrl);
if (!empty($this->links))
{
if (!empty($this->links))
{
$content = BootHtml::link(Yii::t('bootstrap', 'Home'), Yii::app()->homeUrl);
$links[] = $this->renderItem($content);
}
else
$links[] = $this->renderItem(Yii::t('bootstrap', 'Home'), true);
$content = BootHtml::link($this->homeLink['label'], $this->homeLink['url']);
$links[] = $this->renderItem($content);
}
else if ($this->homeLink !== false)
$links[] = $this->homeLink;
else
$links[] = $this->renderItem($this->homeLink['label'], true);
foreach ($this->links as $label=>$url)
{
......
......@@ -18,7 +18,7 @@ class BootInputBlock extends CInputWidget
public $label;
/**
* @property string the input type.
* Following types are supported: checkbox, checkboxlist, dropdownlist, filefield, passwordfield,
* Following types are supported: checkbox, checkboxlist, dropdownlist, filefield, password,
* radiobutton, radiobuttonlist, textarea, textfield and captcha.
*/
public $type;
......@@ -70,7 +70,7 @@ class BootInputBlock extends CInputWidget
$input = $this->form->fileField($this->model, $this->attribute, $this->htmlOptions);
break;
case 'passwordfield':
case 'password':
$input = $this->form->passwordField($this->model, $this->attribute, $this->htmlOptions);
break;
......
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